fix startup #42
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
urgent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_ledger#42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
check how we start all components in heroledger
and make sure we use hero_proc properly
use skills
/hero_proc_service_selfstart
/hero_crates_best_practices_check
Implementation Spec for Issue #42 — Fix Startup (hero_proc selfstart pattern)
Objective
Replace the current ad-hoc startup model (where
heroledger gatewayruns the gateway inline inside the CLI process) with the canonicalhero_proc_service_selfstartpattern. TheheroledgerCLI binary gains dedicatedstartandstopsubcommands that register and manage theheroledger_gatewayprocess via thehero_procsupervisor.Current State
heroledgerCLIsrc/bin/heroledger.rsCommands::Gatewaywhich runs the gateway inline in the CLI process (blocking)src/cli/cli/execute.rsexecute_gateway()run_gateway()directly — no hero_procheroledger_gatewaydaemonsrc/bin/heroledger_gateway.rssrc/provision/gateway_service.rsCargo.tomlRequirements
hero_proc_sdkas an optional dependency, activated by theclifeatureheroledger startandheroledger stopsubcommands to the CLIheroledger start: connect to hero_proc, registerheroledger_gatewayaction, start itheroledger stop: connect to hero_proc and stop the serviceheroledger_gatewaydaemon must NOT call hero_proc on startup (already clean)Commands::Gatewayinline-runner (superseded bystart)tcp_port: Some(9090)(HTTP port the gateway exposes)Files to Modify
Cargo.tomlhero_proc_sdkoptional dep, pull intoclifeaturesrc/cli/cli/mod.rsStartandStopvariants; removeGatewayvariantsrc/cli/cli/execute.rsexecute_start()andexecute_stop(); removeexecute_gateway()src/bin/heroledger.rsStart/Stoparms; removeGatewayarmImplementation Plan
Step 1 — Add
hero_proc_sdktoCargo.tomlAdd as optional dep in
[dependencies]:Pull into
clifeature in[features].Dependencies: none
Step 2 — Add
Start/Stopcommands to CLI enum + wiremain()File:
src/cli/cli/mod.rs— addStartandStopvariants; removeGatewayvariant.File:
src/bin/heroledger.rs— add explicitCommands::StartandCommands::Stoparms callingexecute_start()/execute_stop()via a tokio runtime; removeCommands::Gatewayarm.Dependencies: Step 1
Step 3 — Implement
execute_startandexecute_stopFile:
src/cli/cli/execute.rs— add service definition builder (usingcurrent_exe()for binary path,tcp_port: Some(9090)for health check),execute_start(),execute_stop(); removeexecute_gateway().Dependencies: Step 1
Acceptance Criteria
cargo build --features clisucceeds with no errorsheroledger startregistersheroledger_gatewaywith hero_proc and starts itheroledger stopstops the serviceheroledger_gatewaydoes not importhero_proc_sdkheroledger gatewaycommand is removedheroledger --helpshowsstartandstopheroledger startexits (supervised by hero_proc)cargo build --no-default-featuresstill compiles (no accidental hero_proc_sdk pull)heroledger starttwice is idempotent (no error)Notes
Commands::Gateway? Inline runner requires CLI to stay alive; not supervised. The standaloneheroledger_gatewaybinary is the correct artifact.HeroNearCmdneeded for start/stop — they only need the hero_proc socket, not RPC URLs.std::env::current_exe()?.parent()to find siblingheroledger_gatewaybinary.src/provision/gateway_service.rs) is a separate concern — do not touch it.hero_inspectorCLI binary forstart/stopstructure.