feat(generate): C3c — emit compose healthcheck: + lower intra-project dependsOn (spec 10) - #6
Merged
Merged
Conversation
… dependsOn (spec 10)
Translate the spec-10 readiness config into the generated compose document:
- A service-declared healthcheck lowers to a Compose-native `healthcheck:` block
(per-kind `test`): tcp→`nc -z`, http/https→`curl -fsS [-k] -o /dev/null URL`,
exec→`CMD <argv>`, pg_isready→`pg_isready -p -U [-d]`, redis→`redis-cli -p
[-a] PING`. Timing (interval/timeout/retries/start_period) is emitted only
when set, keeping output deterministic. A secret:// redis auth is NEVER
embedded (§7.5) — redis-cli reads $REDISCLI_AUTH from the container env.
- Intra-project dependsOn lowers to compose `depends_on: { dep: { condition:
service_healthy|service_started } }`. CROSS-project edges (shared services,
other projects) are skipped — compose can't express them; the up saga gates
them tool-side via internal/health. A missing intra-project target is a
generate error.
The richer generate-time "condition:healthy ⇒ target declares a healthcheck"
validation with file:line:col is X2; here compose-go's consistency check is the
backstop (verified: it accepts service_healthy only when the target has a
healthcheck — covered by an end-to-end test).
Unit tests: per-kind test lowering, timing-only-when-set, dependsOn
classification (intra bare/qualified emitted; shared/other-project skipped;
missing target errors), redis secret-auth omission. End-to-end: a sibling
depends_on healthy edge reaches compose and compose-go accepts it. The api
golden gains its lowered http healthcheck (regenerated).
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 C3c (M2-remainder)
Translates the spec-10 readiness config into the generated compose document, completing the Compose-native (intra-project) enforcement layer.
What
healthcheck:lowering — a service-declared healthcheck → a Compose-native block with a per-kindtest:tcp→nc -z localhost PORThttp/https→curl -fsS [-k] -o /dev/null URLexec→["CMD", <argv...>]pg_isready→pg_isready -p PORT -U USER [-d DB]redis→redis-cli -p PORT [-a AUTH] PINGTiming is emitted only when set (deterministic). A
secret://redis auth is never embedded (§7.5) —redis-clireads$REDISCLI_AUTHfrom the container env.intra-project
dependsOnlowering →depends_on: { dep: { condition: service_healthy|service_started } }. Cross-project edges (shared services, other projects) are skipped — compose can't express them; the up saga gates them tool-side viainternal/health. A missing intra-project target is a generate error.Scope
The richer generate-time "
condition: healthy⇒ target declares a healthcheck" validation withfile:line:colis X2; here compose-go's own consistency check is the backstop (verified by an end-to-end test that it acceptsservice_healthyonly when the target has a healthcheck).Tests
testlowering, timing-only-when-set, dependsOn classification (intra bare/qualified emitted; shared/other-project skipped; missing target errors), redis secret-auth omission.depends_on: healthyedge reaches compose and compose-go accepts it.devstack-apigolden gains its lowered http healthcheck (regenerated; diff is exactly the block).Gate
make ci+make determinism+make smokeall green.🤖 Generated with Claude Code