Skip to content

feat(health): X2 — workspace dependency DAG (cycles, waves, healthy-needs-healthcheck) - #37

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

feat(health): X2 — workspace dependency DAG (cycles, waves, healthy-needs-healthcheck)#37
gustavobertoi merged 1 commit into
mainfrom
nightly/X2

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Chunk X2 (M6) — the full readiness DAG

internal/health gains the workspace-wide dependsOn graph the saga orders startup by (spec 10).

  • BuildGraph(model) — project services + shared services are nodes; each dependsOn is 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: every condition: healthy edge'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 + Waves error, unknown-target error, healthy-needs-healthcheck (fails on missing, allows started edges).

Gate

make ci green (race).

🤖 Generated with Claude Code

…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>
@gustavobertoi
gustavobertoi merged commit 6c84444 into main Jun 29, 2026
2 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/X2 branch June 29, 2026 16:24
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