refactor(services): pilot service_whiteboard as selfstart CLI delegator #101
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills!101
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_issue_100_delegator_pilot"
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?
Summary
Introduces the delegator pattern for
service_*.numodules.start/stopnow delegate to the service's selfstart CLI (hero_whiteboard --start/--stop); the Rust CLI'sbuild_service_definition()is the canonical source of truth for the action spec instead of every nu module hand-transcribing it.lib.nu:+svc_cli_start,+svc_cli_stop(shared private dispatchersvc_cli_invokehandles the three--rootcases — non-root, root-as-root viawith-env { HOME: "/root" }, root-as-user viasudo -E HOME=/root).service_whiteboard.nu: 317 → 85 lines (−232). Removedsvx_server_action,svx_ui_action,svx_service_config,svx_drop_registration, the "already running → skip" precheck, the 13-line summary block, and the redundantsvc_require_procinstart.installandstatusunchanged.Pilot scope
One module only. The remaining 11 non-blocked modules (
os,books,collab,biz,db,indexer,voice,aibroker,foundry+ four yet-to-be-created:agent,claude,compute,shrimp) will be mass-applied in a follow-up PR once this shape is validated.service_office+service_osisremain blocked on hero_office#2 and hero_osis#32.Smoke test (Hetzner,
--root)All 8 assertions green —
installshort-circuit,startcold + warm, both sockets bound,curl ui.sock /health→ 200,statusrecord shape intact,stopclean, post-stopstatus,stopwith hero_proc down. Full matrix on the sub-issue.Behavioural note
Post-
stopstatusreturns{state: exited, pid: 0}instead of pre-refactor's "service not found". The CLI'sstop_servicestops without deleting the record; pre-refactor calledproc service deleteadditionally. Net-positive — hero_proc keeps the history row; no callers inhero_skillsrely on the old shape.Related
Refs #100
Introduces the delegator pattern for service_*.nu modules. Instead of hand-transcribing the hero_proc action spec in Nushell, start/stop now delegate to the service's selfstart CLI (hero_whiteboard --start/--stop), whose build_service_definition() in the Rust crate owns the canonical spec. install and status stay local — install owns cargo build + copy, status returns the structured hero_proc record that downstream skills depend on. New lib.nu helpers: - svc_cli_start / svc_cli_stop dispatch the CLI with correct sudo/HOME handling for --root (three cases: non-root, root-as-root, root-as-user). - Private svc_cli_invoke shares the dispatch logic. CLI stdout/stderr flow through to the terminal; non-zero exit raises with stderr attached. Pilot scope: lib.nu helpers + service_whiteboard.nu only. The remaining 11 non-blocked modules (os, books, collab, biz, db, indexer, voice, aibroker, foundry — plus the yet-to-be-created agent, claude, compute, shrimp) will be mass-applied in a follow-up PR once the delegator shape is validated. service_whiteboard.nu: 317 → 85 lines (-232). Smoke-tested end to end on Hetzner with --root — all 8 assertions green (install short-circuit, start cold/warm, socket + /health probes, status record shape, stop, post-stop status, hero_proc-down stop warning). One behavioural nuance: post-stop `status` now returns {state: exited, pid: 0} instead of "service not found" — the CLI's stop_service stops without deleting the record. Net-positive (hero_proc keeps history row); no callers in hero_skills rely on the old "not found" shape. Refs: #100Closing unmerged — direction reversed based on upstream architectural feedback.
The pivot: instead of making the Rust CLI (
--start/--stop) the canonical source of truth and the nu module a delegator, we are going the opposite way. Nushell owns full lifecycle management,service_*.nustays the canonical spec, and the--start/--stopflags should eventually be removed from everyhero_*binary (they add no value beyond what the nu layer already does — they are redundant glue).The recent
5df145f Refactor service lifecycle management into shared lib.nu helpersondevelopmentis aligned with this direction (~1,700lines of duplication removed; eachservice_*.nucallsproc service set/proc service startdirectly via the SDK, not through a binary flag).Follow-up tracked in new issue #. Referencing #100 (also being closed) and replacing it.
Successor: #102 —
refactor: remove --start/--stop from hero_* binaries; nushell owns full lifecycle.Pull request closed