feat(workspace,cli): C8 — shared gc + doctor --rebuild-state (spec 09/13) - #12
Merged
Conversation
…/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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chunk C8 (M2-remainder) — completes M2
The two ledger-maintenance verbs.
Manager.RebuildState— reconstruct theshared_service+service_refrows from on-disk config ∩ live tool-labelled containers — the recovery path whenstate.dbis lost/corrupt (the ledger is a cache of reality). Under the flock.Manager.GC— reconcile, then find shared services at zero refs; with--stopcompose stopeach 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 injectableManager.Runnermakes the stop path unit-testable.shared gc [--stop],shared doctor(self-healing reconcile), anddoctor --rebuild-statereplace 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-stateflag.Gate
make cigreen (race included).This is the last M2-remainder chunk — after merge, M2 is complete (the full
up/down/statussaga + shared lifecycle).🤖 Generated with Claude Code