Skip to content

fix(deploy): reuse the newest image built from the deployed commit's history - #1552

Merged
athvin merged 1 commit into
mainfrom
fix/deploy-reuse-ancestor-digest
Dec 3, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/deploy-reuse-ancestor-digest

Conversation

@athvin

@athvin athvin commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Refs #1429

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

When a deploy has no image for DEPLOY_SHA, deploy-resolve-digests.sh now reuses the newest digest built from an ancestor of DEPLOY_SHA, not simply the newest in ECR. If no ancestor qualifies, it falls back to the newest with a warning, and the existing staleness guard still decides.

Why

My dev-only release of #1518 (through #1545's environment: dev) pushed er-api:93e43da5, a commit not on main, and that became the newest er-api image. The next two frontend-only merges reused it, and the staleness guard refused: deploy dev and deploy prod failed for c7e8bc3c (#1543, run 47007375189) and f7ed273d (#1549, run 47009130317). An image built outside the deployed commit's history is never what main is running. no-ticket: this is the fix-forward of #1545's dev-only path.

Proof

Replayed read-only against the real ECR repos and git history, with GITHUB_OUTPUT pointed at a temp file:

  • DEPLOY_SHA=c7e8bc3c, the failed case. New: er-api reuses c26a1ae3's digest sha256:2d11ad4e…, the guard reports reuse verified, exit 0. Old script: refuses with the same rust/** list as the failed runs, exit 1.
  • DEPLOY_SHA=93e43da5, the dev-only candidate. Its own er-api tag resolves directly; er-web reuses 3b3a94f0, verified, exit 0.

Risk & rollback

Behaviour changes only on the reuse path: the same or an older digest than before, always from the deployed history, and still checked by the guard. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:cf299f4a-bafd-4f62-a459-2f495e05c5f2 on Mac · 2026-12-03T01:58:00Z

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not: 37aeaa25: deploy 47013950828 success, devcontainer 47013912955 success, infra 47013912991 success, images 47013912954 success, frontend 47013913022 success, rust 47013913015 success.
  • images built, or correctly never ran because nothing that goes into
    an image changed: images ran because scripts/ci/deploy-*.sh is in its paths. Both builds correctly skipped (no rust/frontend change).
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: deploy 47013950828 succeeded on dev and prod. The changed component is this script, and its own log lines prove it ran: er-api: … REUSED newest ancestor-built digest sha256:1e55c99e… (f4c401d3's image) and er-web: … REUSED newest ancestor-built digest sha256:1977bd46… (4d1109ff's), each followed by reuse verified.
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: deploy green. drift has been knowingly red on schedule since at least Nov 29. The kind nightly doesn't run this script.
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: n/a — no-ticket fix-forward of ci(deploy): let a manual deploy target dev or prod alone #1545's dev-only path; Resolve latency: ~2.1 s p50 at 520k records because the corpus is materialised per request #1429 is already closed.
  • follow-ups are open for everything deferred here — numbers: none.
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: the script's own comment records the failure and the rule. Session memory records the dispatch-cancels-pending and candidate-poisons-reuse traps.

Specific to this change

  • The next deploy that reuses a digest logs REUSED newest ancestor-built digest and reuse verified. It did: this merge's own deploy, 47013950828, for both images (lines quoted above).
Context — plan, discoveries, measurements, files

Files

  • scripts/ci/deploy-resolve-digests.sh

🤖 Generated with Claude Code

@athvin athvin added the no-ticket deliberately not tied to a board ticket; exempts the pull request contract label Dec 3, 2026
…history

A dev-only release (#1545's `environment: dev`) pushes an er-api image
tagged with an unmerged commit. That image was then the newest in ECR,
so the next two frontend-only merges reused it for er-api, and the
staleness guard correctly refused because rust/** differs. Dev and prod
deploys failed for c7e8bc3 (run 47007375189) and f7ed273
(47009130317).

When a tree has no image for DEPLOY_SHA, take the newest tagged digest
whose tag is an ancestor of DEPLOY_SHA. If none qualifies, fall back to
the plain newest with a warning; the staleness guard still decides.

Replayed read-only against ECR: DEPLOY_SHA=c7e8bc3c now resolves er-api
to c26a1ae's digest and the guard verifies it (exit 0), where the old
script refused (exit 1). The candidate 93e43da still resolves its own
er-api tag directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin force-pushed the fix/deploy-reuse-ancestor-digest branch from b5e750f to 24c82e3 Compare December 3, 2026 01:38
@athvin
athvin merged commit 37aeaa2 into main Dec 3, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-ticket deliberately not tied to a board ticket; exempts the pull request contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants