Skip to content

fix: find the build's commit instead of demanding it be HEAD - #51

Merged
cshuttle merged 1 commit into
mainfrom
fix/release-guard-ancestor-commits
Aug 4, 2026
Merged

fix: find the build's commit instead of demanding it be HEAD#51
cshuttle merged 1 commit into
mainfrom
fix/release-guard-ancestor-commits

Conversation

@cshuttle

@cshuttle cshuttle commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Found on first contact with a real repo, exactly where I expected the workflow to be wrong.

The bug

The guard demanded the promoted digest be tagged with the ref HEAD sha. But build workflows carry paths filters, so a docs- or CI-only commit moves the branch without producing an image. From that moment the repo is unreleasable until someone touches a build input — which is absurd, and Topology triggers it immediately: adding its release workflow is itself such a commit.

The fix

Walk back from the ref and find the most recent commit whose per-commit tag carries this digest. This keeps everything the old check bought — the image provably came from this branch, not a stale build or another branch — and answers a question the first version never asked: which commit is this image?

The git tag is then created on that commit rather than HEAD, so a version names code that is actually in it. Usually identical; when they differ, this is the honest one. The tag message and job log both record how many commits the ref moved on afterwards.

Also guards the multi-image case: images released together must resolve to the same build commit, or the release fails rather than quietly shipping a mismatched pair.

Cost

One crane ls per image up front, then membership is a local grep -Fxq. Topology already has 65 tags, so the naive alternative is a registry round trip per commit per tag form.

Verified against the live registry

scenario A — ref HEAD is the built commit:
  origin/main -> built from 177655b, 0 behind
scenario B — ref HEAD is a CI-only commit on top (previously a hard failure):
  feat/release-workflow -> built from 177655b, 1 behind

New verify-depth input (default 50) bounds the search; it needs to cover the gap between HEAD and the last commit that changed a build input.

The guard required the promoted digest to be tagged with the ref's HEAD sha.
Build workflows carry paths filters, so any docs- or CI-only commit moves the
branch without producing an image — and from then on the repo could not be
released at all until someone happened to touch a build input. Topology hit this
immediately: adding its release workflow is itself such a commit.

Walk back from the ref instead and find the most recent commit whose per-commit
tag carries this digest. That still proves the image came from this branch's
history rather than a stale or foreign build, and it answers a question the old
version never asked: WHICH commit is this image? The tag is then created on that
commit, so a version names the code that is actually in it.

One `crane ls` up front, then membership is a local grep — Topology already has
65 tags, and the alternative is a registry round trip per commit per tag form.

Verified against the live registry both ways: HEAD-is-the-build resolves at 0
behind, and a CI-only commit on top resolves to the build 1 behind (the case
that previously failed outright).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cshuttle
cshuttle merged commit e18db22 into main Aug 4, 2026
6 checks passed
@cshuttle
cshuttle deleted the fix/release-guard-ancestor-commits branch August 4, 2026 13:18
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