feat(indexer): protected-main auto-deploy and /health git SHA #1282

Merged
PlasticDigits merged 16 commits from issue/1276 into main 2026-09-21 03:49:54 +00:00

Summary

  • Slice 1–2 for #1276: generic GET /health stays liveness ({"status":"ok"}) and adds optional "git_sha" when baked GIT_SHA (non-empty after trim) or else SOURCE_COMMIT parses as lowercase hex 7–40 (H1276-1, H1276-2). HEAD / main / refs/ / secrets / non-hex are omitted, never echoed. Handler reads env per request; fee-discount health unchanged (H1276-4).
  • docker/indexer/Dockerfile re-declares runtime ARG/ENV GIT_SHA + SOURCE_COMMIT after COPY --from=builder and before the HTTP health probe (H1276-3). Empty GIT_SHA falls through to include-source-commit.
  • make verify-issue-1276 covers parser units, serial API tests, Dockerfile pin, leftover-complete FAIL-before-curl without VERIFY1276_EXPECT_SHA, and SKIP live Coolify unless a live flag is set.
  • Expand-only sqlx fix: rename colliding 20260916120000_usdt_quote_usd_null_backfill.sql → 20260916120001_… so a fresh _sqlx_migrations can apply both #1258 and #1269 files. verify-issue-1258 path updated.
  • Docs/invariants/skill: architecture + indexer-invariants Health git SHA (#1276) describe the shipped handler; leftover checkbox remains operator / #297 (H1276-6). AGENTS.md unchanged (it does not list 1276). M573/M590 not rewritten.

Closes #1276

Test plan

  • make verify-issue-1276 — 7 passed, 0 failed (lib health_git_sha, api_health, api_fee_discount_health, docs/Dockerfile pin, leftover-complete selftest)
  • Live GET https://indexer.dex.cl8y.com/health → {"status":"ok"} with omitted git_sha (expected until leftover bake)
  • Coolify leftover (operator / #297, not this implement): auto-deploy on protected main, include-source-commit, never copy HEAD into GIT_SHA, then VERIFY1276_REQUIRE_LIVE=1 VERIFY1276_EXPECT_SHA=<merge hex> make verify-issue-1276
  • Do not infer the checkbox from HTTP. Do not scrape Coolify.

Gaps

  • Slice 3 leftover is operator: live /health currently omits git_sha (no bake yet). Loki {service="coolify"} |= "git_sha" last 15m returned 0 lines. Checkbox + tip-match are not merge blockers for this code MR.
  • This implement did not flip Coolify, merge main, or deploy.
## Summary - Slice 1–2 for **#1276**: generic `GET /health` stays liveness (`{"status":"ok"}`) and adds optional `"git_sha"` when baked `GIT_SHA` (non-empty after trim) or else `SOURCE_COMMIT` parses as lowercase hex 7–40 (**H1276-1**, **H1276-2**). `HEAD` / `main` / `refs/` / secrets / non-hex are omitted, never echoed. Handler reads env per request; fee-discount health unchanged (**H1276-4**). - `docker/indexer/Dockerfile` re-declares runtime `ARG`/`ENV` `GIT_SHA` + `SOURCE_COMMIT` after `COPY --from=builder` and before the HTTP health probe (**H1276-3**). Empty `GIT_SHA` falls through to include-source-commit. - `make verify-issue-1276` covers parser units, serial API tests, Dockerfile pin, leftover-complete **FAIL-before-curl** without `VERIFY1276_EXPECT_SHA`, and SKIP live Coolify unless a live flag is set. - Expand-only sqlx fix: rename colliding `20260916120000_usdt_quote_usd_null_backfill.sql` → `20260916120001_…` so a fresh `_sqlx_migrations` can apply both #1258 and #1269 files. `verify-issue-1258` path updated. - Docs/invariants/skill: architecture + indexer-invariants **Health git SHA (#1276)** describe the shipped handler; leftover checkbox remains operator / #297 (**H1276-6**). AGENTS.md unchanged (it does not list 1276). M573/M590 not rewritten. Closes #1276 ## Test plan - [x] `make verify-issue-1276` — 7 passed, 0 failed (lib `health_git_sha`, `api_health`, `api_fee_discount_health`, docs/Dockerfile pin, leftover-complete selftest) - [x] Live `GET https://indexer.dex.cl8y.com/health` → `{"status":"ok"}` with **omitted** `git_sha` (expected until leftover bake) - [ ] Coolify leftover (operator / #297, not this implement): auto-deploy on protected `main`, include-source-commit, never copy `HEAD` into `GIT_SHA`, then `VERIFY1276_REQUIRE_LIVE=1 VERIFY1276_EXPECT_SHA=<merge hex> make verify-issue-1276` - [ ] Do not infer the checkbox from HTTP. Do not scrape Coolify. ## Gaps - **Slice 3 leftover** is operator: live `/health` currently omits `git_sha` (no bake yet). Loki `{service="coolify"} |= "git_sha"` last 15m returned **0** lines. Checkbox + tip-match are not merge blockers for this code MR. - This implement did not flip Coolify, merge `main`, or deploy.
Pin git_sha parser, Dockerfile ARG bake, invariant amendment, and
forward-fix when schema moves. Coolify checkbox stays operator leftover.

Co-authored-by: Cursor <cursoragent@cursor.com>
Select SOURCE_COMMIT when GIT_SHA is empty after trim; re-declare ARG/ENV on the runtime stage; specify VERIFY1276_REQUIRE_LIVE leftover probe.
Require VERIFY1276_EXPECT_SHA prefix-match for leftover-complete;
never copy Coolify HEAD into GIT_SHA; ARG/ENV after COPY --from=builder;
ok-only tests remove_var both keys; handler reads env per request.
IID-only live probe is bake presence; leftover-complete requires
VERIFY1276_EXPECT_SHA tip-match plus operator checkbox. Leave watch
paths off until leftover closed. Confirm include-source-commit arg
name at leftover; hex GIT_SHA remains the fallback. Published ADR
wins over issue-body matching-the-baked-commit AC.
Leftover IID gate requires tip-match; bake presence stays REQUIRE_LIVE-only.
Map issue AC instead of a blanket override. Mark attest docs as target after
slice 1. Coolify restore is the production rollback path.
Sibling leftover IID is unreachable-fail; leftover-complete adds
EXPECT_SHA and fails before curl. Coolify rollback inspects the
app DATABASE_URL and is three-way including documented down.sql.
sqlx revert files do not DELETE _sqlx_migrations. Production migrate
rejects applied versions missing from the binary. Three-way 2(c) turns
auto-deploy off, applies that down.sql, deletes that ledger row, then
restores. Unchanged vs ahead compares version/success/installed_on to
the prior Coolify deploy SHA latest migration.
2(c) only when restoring the prior image and a paired down.sql exists
for versions newer than the Coolify baseline. Keep 2(b) when the hotfix
still ships N. Dirty repair deletes the failed row; never UPDATE success.
2(c) requires a paired down.sql for every successful ledger version
newer than the prior Coolify baseline. Dirty DELETE is a pre-step
that re-enters the three-way tree.
Dirty is a sequential any-success=false gate, not a sibling of
Unchanged/Ahead. Stop/scale-to-zero is required before dirty DELETE
and 2(c) downs; auto-deploy off is not a process stop.
Require auto-deploy off then Coolify Stop then snapshot then DELETE then idx_reclass on every compressed surface. Drop the pre-Coolify Rollback binary table. After dirty reclass to 2(b), start only the hotfix image.
Dirty DELETE then reclass can be 2(a) restore, 2(b) hotfix, or 2(c) downs.
Compressed surfaces and the docs checker now pin that qualifier instead of always 2(b).
feat(indexer): emit optional git_sha on GET /health
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ce1d7b116d
Parse baked GIT_SHA then SOURCE_COMMIT per request (hex 7-40). Empty
GIT_SHA falls through. Runtime Dockerfile ARG/ENV after COPY --from=builder.
Split colliding USDT backfill sqlx version so API tests can migrate.
Coolify auto-deploy leftover stays operator.
Author
Owner

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
Author
Owner

cl8y-agent-control: queued design_author job 9c81f840-821e-4d8e-88a3-ffae7d174c12 (not executed; no Hetzner VM).

cl8y-agent-control: queued `design_author` job `9c81f840-821e-4d8e-88a3-ffae7d174c12` (not executed; no Hetzner VM).
Author
Owner

drain skip: default autoland requires tip ACCEPT (#77)

drain skip: default autoland requires tip ACCEPT (#77)
fix(indexer): keep first-applied USDT sqlx version
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
005dfedaf8
Leave 20260916120000 as the USDT backfill checksum and bump protocol_fee to 20260916120001 so production migrate does not mismatch.
Merge origin/main into issue/1276
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
7b0f29d024
Keep ADR 0005 protocol-fee hops from main and ADR 0006 health git SHA.
sqlx versions stay 20260916120000 USDT and 20260916120001 hops.
Merge origin/main into issue/1276
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
759c6b30b8
Include renovate.json from #1283 so the PR is not behind protected main.
PlasticDigits deleted branch issue/1276 2026-09-21 03:49:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1282
No description provided.