feat(health): X2 — workspace dependency DAG (cycles, waves, healthy-needs-healthcheck) - #37
Merged
Conversation
…eeds-healthcheck) (spec 10) The full dependsOn graph the saga orders startup by: - BuildGraph(model): one workspace-wide graph — project services + shared services are nodes; each service's dependsOn becomes an edge (target resolved via the canonical ref grammar: bare→intra-project, workspace.shared.*, workspace.<project>.<service>). An edge to a non-existent target is a hard error. - Cycle(): returns the full human-readable cycle path (a → b → a) or nil, deterministically (sorted DFS). - Waves(): stable topological waves — wave 0 is the dependency-free nodes (shared services land first), each later wave depends only on earlier ones; reproducible for the up checklist/--json. Errors with the path on a cycle. - RequireHealthchecks(pred): enforces spec-10's rule that every condition:healthy edge's target declares a healthcheck (the predicate is supplied by the caller: project services from config, shared from their template) — the generate-time guard that turns "healthy edge to a check-less service" into an error. Pure logic, no daemon. Unit-tested: node/edge build, topo waves order (shared→cache→web), cycle-with-path + Waves error, unknown-target error, healthy-needs-healthcheck (fails on missing, allows started edges). Unblocks X4 (profile-aware pruning) and X5 (saga consumes Waves). 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 X2 (M6) — the full readiness DAG
internal/healthgains the workspace-wide dependsOn graph the saga orders startup by (spec 10).BuildGraph(model)— project services + shared services are nodes; eachdependsOnis an edge (target resolved via the canonical ref grammar). An edge to a non-existent target is a hard error.Cycle()— the full human cycle path (a → b → a) or nil, deterministically.Waves()— stable topological waves (shared services in wave 0; each later wave depends only on earlier ones); reproducible for the checklist/--json. Errors with the path on a cycle.RequireHealthchecks(pred)— spec-10's generate-time guard: everycondition: healthyedge's target must declare a healthcheck (predicate supplied by the caller — config for project services, template for shared).Pure logic, no daemon. Unblocks X4 (profile-aware pruning) and X5 (saga consumes
Waves).Tests
node/edge build, topo order (shared→cache→web), cycle-with-path +
Waveserror, unknown-target error, healthy-needs-healthcheck (fails on missing, allowsstartededges).Gate
make cigreen (race).🤖 Generated with Claude Code