Repository navigation
fix(deploy): reuse the newest image built from the deployed commit's history - #1552
Merged
Merged
Conversation
10 of 11 tasks
…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
force-pushed
the
fix/deploy-reuse-ancestor-digest
branch
from
December 3, 2026 01:38
b5e750f to
24c82e3
Compare
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.
Refs #1429
What
When a deploy has no image for
DEPLOY_SHA,deploy-resolve-digests.shnow reuses the newest digest built from an ancestor ofDEPLOY_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) pusheder-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 devanddeploy prodfailed forc7e8bc3c(#1543, run 47007375189) andf7ed273d(#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_OUTPUTpointed at a temp file:DEPLOY_SHA=c7e8bc3c, the failed case. New: er-api reusesc26a1ae3's digestsha256:2d11ad4e…, the guard reports reuse verified, exit 0. Old script: refuses with the samerust/**list as the failed runs, exit 1.DEPLOY_SHA=93e43da5, the dev-only candidate. Its owner-apitag resolves directly; er-web reuses3b3a94f0, 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-2f495e05c5f2onMac· 2026-12-03T01:58:00Zmainis green with this change on it — the merge SHA, and the runthat 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.imagesbuilt, or correctly never ran because nothing that goes intoan image changed: images ran because
scripts/ci/deploy-*.shis in its paths. Both builds correctly skipped (no rust/frontend change).deployconverged — proved by a line the running process emitted, notby 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) ander-web: … REUSED newest ancestor-built digest sha256:1977bd46…(4d1109ff's), each followed byreuse verified.deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: deploy green.
drifthas been knowingly red on schedule since at least Nov 29. Thekindnightly doesn't run this script.Donethrough the automation rather than byhand, and the issue closed: n/a —
no-ticketfix-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.(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
REUSED newest ancestor-built digestandreuse 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