Public: anyone can read this; the crew can change it.
Release reused an image built from an older commit: v0.7.646 shipped without the fix it was cut for #17028
Check · Review · Land · Live done — Landed and live in production.
This pull fixes only the labelling half of #16349. The reuse check lives in tick.sh, which isn't in this repository, so I couldn't change or test it. Until the host script is changed, the tick can still reuse a stale forge: image.
-
Reviews
Changes requested — before the latest pushThe label is correct and small, but the issue is not fixed. The title is that a release reused an image built from an older commit. After this pull the tick still reuses a stale
forge:<version>: nothing in this repository reads the label. Someone can't use this now to get a correct release.Changes needed, all in one round:
- Put the reuse decision where the repo owns and tests it. Add a small module (for example
src/release/reuse.ts: plain data in,reuseorrebuildout, with an unlabelled image counting as stale) that compares the image'sforge.commitwith the commit being cut. Have the release path call it. A host script can then shell out to it instead of carrying its own logic. Or, if the reuse check really can only live intick.sh, say so on the issue and keep it open. Don't let this pull close it. - Add the test the issue asked for: an image tagged with another commit's label is rebuilt, an unlabelled image is rebuilt, and a matching label is reused. The new test in
test/release-gate.test.tsonly matches Dockerfile and workflow text. It would still pass if the tick shipped the stale image, so it does not guard the bug. - In
docs/features/nightly-release.md, the paragraph is a requirement placed on an outside script rather than a how-to. Rewrite it to say what the release does once item 1 lands. Also drop the issue number and the sentence about not finding what pre-built 0.7.646. That belongs on the issue, not in the feature doc.
The Dockerfile change is fine as is.
Changes requested — before the latest pushThe bookkeeping fixes since my last review are fine. The unreached entry, spawn-sites and spawn-pipes lines are accurate. The docs live in docs/features, not the README. One blocker remains in the guard itself.
reuseDecisionvalidates the commit being cut against SHA, but not the label.want.startsWith(have)therefore accepts a label like0,aor00, which is a prefix of about every commit. A truncated or garbage label would then reuse a stale image, which is the failure this pull exists to stop. Fix: requireSHA.test(have)too, so a label shorter than 7 hex characters or with non-hex characters is a rebuild withwhyset to 'the forge.commit label is not a commit id'. Add a test thatreuseDecision("0", CUT)andreuseDecision("zzzzzzz", CUT)both rebuild.
Non-blocking: the tick on the host still has to call
bun src/release/reuse.ts. Keep #16349 open until it does, as torque said.ApprovedMy earlier ask is met: a forge.commit label that is not 7 to 64 hex characters is now a rebuild, no longer a prefix of nearly any commit.
test/release-reuse.test.tscovers0,a,00, a 6-character prefix, non-hex and a bad character, and it would fail without the check. The bookkeeping in unreached, spawn-sites and spawn-pipes is in place. The image name reaches docker as one validated argv entry with no shell. There is no web page here, so there is no door change, and the how-to is in docs/features/ rather than the README.Two things I would do next:
- Wire
bun src/release/reuse.ts <image> <commit>into the host tick, which lives outside this repo, and keep #16349 open until that is done. - Re-wrap the header comment in reuse.ts. Non-blocking: one line there breaks mid-sentence.
- Put the reuse decision where the repo owns and tests it. Add a small module (for example
-
Checks
shipped production is serving it deploy 2b7a2cb
-
History
- Rewrap the reuse check's header comment (#16349) 59f9404
- Direction: a forge.commit label that is not a commit id is a rebuild, not a prefix of every commit (#16349) 4d50baa
- Direction: list the reuse check as an entry point and a pipe-reading spawn (#16349) 7e5dc79
- Direction: the release decides reuse from the image's forge.commit label, in a tested module (#16349) f673f29
- Direction: label every image with the commit it was built from, so a stale tag is not reused (#16349) 7df0df1
- Moving a forge to another machine is copy, start, flip the router — and a test kills a machine (#16989) 95fb1bc
- Every panel says what it counts: a one-line description, and visitors can leave out the app's own people (#16960) 4763996
- Sentinel: queue:check is past its budget: 13 checks wait for 8 slots, 7 busy; the oldest since 06:21; the longest running is #16844 at 46 min (limit 60). (#17005) 76338bc
- A forge on a migrated, empty data directory is ready in under 1.5 s, so the real rolls leave the SLOW list (#17009) 5ca0c22
- Automate a review finding as a lint or test: Duplicate import from views_store.ts; merge into one. (#17004) 6b46197
- /api/v1/search answers kind=pulls (and kind=issues meaning issues only), so a narrowed search returns N of the kind asked for (#17001) ffcf74c
- The 3D view's grid keeps the old theme's colour after a theme switch (#17000) 005552a
- Check slots per repository: each app gets a guaranteed share, the forge borrows what's idle (#16946) 099c6cc
- Observability 3b: the /boards index is live by streaming, like a board (#16848) ba6c159
- One keymap (b): pulls, the review page and a repository's tabs take their keys from the map; a moved key says where it went for two weeks (#16992) 3518284
- Surface the flow report in the terminal Flow dialog and the MCP flow tool (#16999) ade4088
- A check step behind Landlock stacked under its cell says so too, on the forge and on a runner (#16996) 0bd9528
- Sentinel: memory-growth was degraded 25 minutes today: The forge's own memory is 5382 MiB, over twice its first-hour 2272 MiB and past the 2176 MiB more its database caches m… (#16985) 9e6d1ed
- The forge measures each new forge's seconds from first ask to first built change, and /admin/limits shows the median per plan (#16829) 695dd1c
- The People-screen verify test passes in any order: carol is made up front, and listPeople is checked against the real state (#16998) dc1306c
3 earlier comments
This pull fixes only the labelling half of #16349. The reuse check lives in tick.sh, which isn't in this repository, so I couldn't change or test it. Until the host script is changed, the tick can still reuse a stale forge:<version> image.
What changed
- The
Dockerfilenow addsLABEL forge.commit=$COMMIT, using the existingCOMMITbuild argument. Every image it builds carries the commit it was built from. That includes the.forgejo/workflows/release.ymlbuild, which already passesCOMMIT. test/release-gate.test.tshas a new test. It checks that theDockerfilecarries the label and that the release build passes the commit. That test andtscpass. I didn't run the rest of the suite; the forge runs it on push.docs/features/nightly-release.mdnow says what the host script must do. It should reuseforge:<version>only whendocker image inspect -f '{{index .Config.Labels "forge.commit"}}'equals the commit it is cutting. Otherwise it rebuilds with--build-arg COMMIT=<sha>, and an unlabelled image counts as stale.
What I did not do
- I did not write the issue's test, "a tick whose tag exists with another commit's label rebuilds". It needs
tick.sh, so it can only be written where that script lives. - I did not find what built
0.7.646at 21:44:02, ahead of the tick. Nothing in this repository shows a pre-build on merge. If it was a separatedocker buildon the host, it must pass--build-arg COMMIT=<sha>.
How to try it
Build the image and run docker inspect -f '{{index .Config.Labels "forge.commit"}}' on it. It should print the commit you passed.
This pull gives the release a tested reuse decision, but the tick still has to call it, and that call is outside this repo. It is not wired to anything yet. tick.sh lives on the host and still reuses any image with the version's tag. Until the host script runs bun src/release/reuse.ts <image> <commit>, a release can still reuse a stale image. So this pull should not close #16349. A person should keep the issue open until the host script calls the check.
I ran the new reuse tests, test/release-gate.test.ts, test/unused-exports.test.ts and the type check, and they pass. The forge runs the full check on push.
What changed
- Labelling: every image the
Dockerfilebuilds carriesforge.commit=<sha>, taken from the existingCOMMITbuild argument. - Reuse decision: a new module,
src/release/reuse.ts, reuses an image only when itsforge.commitlabel matches the commit being cut. A different commit's label, a missing label, or no image all mean rebuild. An abbreviated sha on either side matches by prefix, and a commit that isn't a sha is never reused. - Command line:
bun src/release/reuse.ts <image> <commit>reads the label withdocker image inspect, passing the image name as a single argument with no shell. It printsreuse(exit 0) orrebuild: <why>(exit 1), and exits 2 on a bad argument. If docker is missing it printsrebuild: …. - Tests:
test/release-reuse.test.tscovers an image from another commit, an unlabelled image, and a matching label (full, abbreviated and mixed case). It also covers the command line's rebuild and bad-argument exits. This replaces the text-matching test I had added totest/release-gate.test.ts. - Docs:
docs/features/nightly-release.mdnow describes what the release does, with no issue number and no incident narrative.
What I did not do
- I did not find what built
0.7.646at 21:44:02. Nothing in this repo shows a pre-build on merge. If a separatedocker buildon the host does it, it must pass--build-arg COMMIT=<sha>.
I fixed the three failing tests and pushed. The three tests (test/unreached.test.ts, test/spawn-sites.test.ts, test/spawn-pipes.test.ts) and test/release-reuse.test.ts pass locally. The type check is clean. I didn't run the whole suite.
src/release/reuse.ts is a command run by the release tick, so nothing in the app imports it. The failures were bookkeeping, and I made three small edits:
scripts/unreached.ts: addedsrc/release/reuse.tstoENTRIES, alongsidesrc/release/boot.ts, with a comment saying the tick runs it.test/spawn-sites.test.ts: listed the file with its one spawn,docker image inspectwith the image name as a single validated argument.test/spawn-pipes.test.ts: listed its piped stdout as read to the end before the exit is awaited.
The check's other concern is unchanged. Nothing in this repo calls the reuse check yet, because tick.sh lives on the host. #16349 should stay open until the host script runs bun src/release/reuse.ts <image> <commit> before reusing an image.
Before this change, a release reused an existing image whenever the version tag already existed. It could ship an image built from an older tree: v0.7.646 went out without the fix it was cut for. Now every image carries a forge.commit label with the commit it was built from. src/release/reuse.ts (reuseDecision, run as bun src/release/reuse.ts <image> <commit>) reuses an image only when that label matches the commit being cut. Otherwise it prints rebuild: <why> and exits 1.
This push fixes the review blocker. The label is now checked against the same commit-id pattern as the commit being cut: 7 to 64 hex characters. Before, a label like 0, a or 00 matched almost any commit by prefix, so a short or garbage label would have reused a stale image. Now any such label means a rebuild, with why set to "the forge.commit label is not a commit id". test/release-reuse.test.ts covers 0, a, 00, a 6-character prefix, zzzzzzz and a label with a non-hex character. The comment at the top of reuse.ts and docs/features/nightly-release.md now include this rule.
Not done here: the release tick on the host does not call bun src/release/reuse.ts yet. #16349 should stay open until it does.
Checks run: the gate (32 rules satisfied) and bun x tsc --noEmit both pass. bun scripts/fast.ts exited 2: the branch changes scripts/unreached.ts, so it could not name the tests to run. I picked 27 test files instead, including the reuse, unreached, unused-exports, spawn-sites, spawn-pipes and spawn-argv tests, and all 282 tests passed.
To try it: bun test test/release-reuse.test.ts, or bun src/release/reuse.ts forge:<tag> <commit> on a host with docker.
🤖 Generated with Claude Code
This pull fixes only the labelling half of #16349. The reuse check lives in
tick.sh, which isn't in this repository, so I couldn't change or test it. Until the host script is changed, the tick can still reuse a staleforge:<version>image.What changed
Dockerfilenow addsLABEL forge.commit=$COMMIT, using the existingCOMMITbuild argument. Every image it builds carries the commit it was built from. That includes the.forgejo/workflows/release.ymlbuild, which already passesCOMMIT.test/release-gate.test.tshas a new test. It checks that theDockerfilecarries the label and that the release build passes the commit. That test andtscpass. I didn't run the rest of the suite; the forge runs it on push.docs/features/nightly-release.mdnow says what the host script must do. It should reuseforge:<version>only whendocker image inspect -f '{{index .Config.Labels "forge.commit"}}'equals the commit it is cutting. Otherwise it rebuilds with--build-arg COMMIT=<sha>, and an unlabelled image counts as stale.What I did not do
tick.sh, so it can only be written where that script lives.0.7.646at 21:44:02, ahead of the tick. Nothing in this repository shows a pre-build on merge. If it was a separatedocker buildon the host, it must pass--build-arg COMMIT=<sha>.How to try it Build the image and run
docker inspect -f '{{index .Config.Labels "forge.commit"}}'on it. It should print the commit you passed.Closes #16349