Skip to content

feat(workspace,cli): C8 — shared gc + doctor --rebuild-state (spec 09/13) - #12

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/C8
Jun 29, 2026
Merged

feat(workspace,cli): C8 — shared gc + doctor --rebuild-state (spec 09/13)#12
gustavobertoi merged 1 commit into
mainfrom
nightly/C8

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Chunk C8 (M2-remainder) — completes M2

The two ledger-maintenance verbs.

  • Manager.RebuildState — reconstruct the shared_service + service_ref rows from on-disk config ∩ live tool-labelled containers — the recovery path when state.db is lost/corrupt (the ledger is a cache of reality). Under the flock.
  • Manager.GC — reconcile, then find shared services at zero refs; with --stop compose stop each on the shared stack (label-driven when the generated file is absent) and mark it stopped. Default is a dry-run report — warm DBs are cheap, reclamation is opt-in. Volumes/network never touched. A new injectable Manager.Runner makes the stop path unit-testable.
  • CLI: shared gc [--stop], shared doctor (self-healing reconcile), and doctor --rebuild-state replace their stubs.

Tests

Mock client + fake runner + temp ledger: rebuild re-derives exactly the live shared services + refs (excluding not-live minio); gc lists then stops a zero-ref service (dry-run runs no compose). CLI: registration, gc dry-run (daemon-free), --rebuild-state flag.

Gate

make ci green (race included).

This is the last M2-remainder chunk — after merge, M2 is complete (the full up/down/status saga + shared lifecycle).

🤖 Generated with Claude Code

…/13)

Complete M2-remainder with the two ledger-maintenance verbs.

- Manager.RebuildState: reconstruct the shared_service + service_ref rows from
  on-disk config intersected with live tool-labelled containers — the recovery
  path when state.db is lost/corrupt (the ledger is a cache of reality). Under
  the flock.
- Manager.GC: reconcile, then find shared services at zero refs; with stop=true
  `compose stop` each on the shared stack (label-driven when the generated file
  is absent) and mark it stopped. Default is a dry-run report — warm DBs are
  cheap, reclamation is opt-in. Volumes/network never touched. A new injectable
  Manager.Runner makes the stop path unit-testable.
- CLI: `shared gc [--stop]`, `shared doctor` (the self-healing reconcile), and
  `doctor --rebuild-state` replace their stubs.

Unit-tested with a mock client + fake runner + temp ledger: rebuild re-derives
exactly the live shared services + refs (excluding the not-live minio), and gc
lists then stops a zero-ref service (dry-run runs no compose). CLI tests cover
registration, the gc dry-run (daemon-free), and the --rebuild-state flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi
gustavobertoi merged commit c34fb4b into main Jun 29, 2026
9 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/C8 branch June 29, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant