Skip to content

feat(generate): C3c — emit compose healthcheck: + lower intra-project dependsOn (spec 10) - #6

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

feat(generate): C3c — emit compose healthcheck: + lower intra-project dependsOn (spec 10)#6
gustavobertoi merged 1 commit into
mainfrom
nightly/C3c

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

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-kind test:

    • tcpnc -z localhost PORT
    • http/httpscurl -fsS [-k] -o /dev/null URL
    • exec["CMD", <argv...>]
    • pg_isreadypg_isready -p PORT -U USER [-d DB]
    • redisredis-cli -p PORT [-a AUTH] PING

    Timing is emitted only when set (deterministic). A secret:// redis auth is never embedded (§7.5) — redis-cli reads $REDISCLI_AUTH from the container env.

  • intra-project dependsOn loweringdepends_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.

Scope

The richer generate-time "condition: healthy ⇒ target declares a healthcheck" validation with file:line:col is X2; here compose-go's own consistency check is the backstop (verified by an end-to-end test that it accepts service_healthy only when the target has a healthcheck).

Tests

  • Unit: 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 devstack-api golden gains its lowered http healthcheck (regenerated; diff is exactly the block).

Gate

make ci + make determinism + make smoke all green.

🤖 Generated with Claude Code

… 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>
@gustavobertoi
gustavobertoi merged commit a6f3195 into main Jun 29, 2026
9 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/C3c branch June 29, 2026 12:59
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