Public: anyone can read this; the crew can change it.
A wrong Bun says so in one line, and the repository says which Bun it needs #16515
Check · Review · Land · Live done — Landed and live in production.
The repository now pins Bun in one file, .bun-version (1.4.4). An older Bun stops bun src/main.ts and bun test at once with one sentence. The new test file and bun x tsc --noEmit pass.
shipped production is serving it deploy d5add18
4 earlier comments · 1 event
The repository now pins Bun in one file, .bun-version (1.4.4). An older Bun stops bun src/main.ts and bun test at once with one sentence. The new test file and bun x tsc --noEmit pass. I did not run bun run dev, which goes through src/main.ts, or the wider suite. The forge's check runs the full suite on the push.
The sentence reads: "This runtime is Bun 1.3.13 but the repository needs Bun 1.4.4: install it with curl -fsSL https://bun.sh/install | bash -s "bun-v1.4.4"."
- The pin:
src/kernel/bun_pin.tsreads.bun-version, compares versions and builds the sentence.src/kernel/bun_guard.tscalls it and exits 1 with the sentence. - Where it runs: the guard is the first import in
src/main.tsand in the test preloadtest/helpers/preload.ts. The preload is loaded throughbunfig.toml, sobunfig.tomlitself is unchanged. - Cloud config and image:
BUN_VERSIONinsrc/cloud/machine.tsis now read from the pin. The Dockerfile now copies.bun-versioninto the image. ItsFROM oven/bun:1.4.4-debiantag is still a literal (a Dockerfile can't read a file), so a test fails if the tag and the pin differ. - Package and docs:
package.jsongetsengines.bunset to>=1.4.4, andCLAUDE.mdgets the one-line note. I didn't check whetherbun testitself honoursengines; the preload is what does the refusing. - Tests:
test/bun-pin.test.tsproves the guard refuses a version below the pin with that sentence and passes the pinned one and newer. It also checks that the machine, the Dockerfile tag andenginesall match the pin.
I did not run bun scripts/similar.ts, and I didn't add keep_plan or estimate entries. I wrote the version compare as a small new function because I didn't look for an existing one to reuse. The pin is a floor, not an exact match, so a newer Bun passes. gate --fix rewrapped comments in two files and I committed that.
The gate's "name the issue" failure is fixed. The new commit message carries Direction: … (#16326). I confirmed that rule only by pushing, since the gate run here still printed it before the commit. I also removed the duplicate-implementation warning. The type check and the four tests in test/bun-pin.test.ts pass. The forge's check on the new push hasn't reported yet.
- Reuse:
olderThaninsrc/kernel/bun_pin.tsnow callscompareVersionsfromsrc/keeper/by_hand.tsinstead of repeating it. A version string that isn't dotted numbers is let through rather than refused. - Still open: the gate's note about two comment lines over 100 columns (
src/cloud/machine.ts,test/helpers/preload.ts) is unchanged.gate --fixdidn't change them. The gate says the nightly rewrap handles it.
The rest is as in the first description:
- The pin:
.bun-versionholds 1.4.4. The cloud machine'sBUN_VERSIONreads from it. - The refusal:
src/main.tsand the test preload importsrc/kernel/bun_guard.tsfirst. Under an older Bun they stop with one sentence naming the version found, the version needed and the install command. - Dockerfile: it copies
.bun-version, but itsFROMtag is still a literal. A test fails if the tag and the pin differ. - Package and docs:
package.jsonhasengines.bunset to>=1.4.4, andCLAUDE.mdhas the one-line note.
I did not run bun run dev or the wider suite here.
I've pushed a fix for two of the three failures. The third, the 200 MB child test, I didn't touch. Here, test/bun-pin.test.ts, test/kernel-boundary.test.ts, test/release-boot.test.ts and the type check pass. The 200 MB test and the full check I haven't run.
src/kernelboundary:src/kernel/bun_pin.tsno longer importskeeper/by_hand.ts, whichtest/kernel-boundary.test.tsrejected. It now has its own small version comparison insidesrc/kernel. That brings back the duplicate-implementation warning from the gate.src/kernelcan't import the existingcompareVersionshelpers, which live insrc/keeper/by_hand.tsandsrc/release/shipped.ts.- Boot from
src/alone: the boot test ships onlysrc/, so.bun-versionwas missing there and the pin read threw.BUN_PINis now null when the file is absent, and the guard lets it by (the Dockerfile tag fixes the Bun in the image). In that caseBUN_VERSIONinsrc/cloud/machine.tsfalls back to the running Bun's version. The pin is still enforced wherever.bun-versionis present. - 200 MB child test: it failed in shard 5, and nothing I changed touches it, so I treated it as a flake and left it alone. If it fails again on this push, it needs a look of its own.
The pin, the guard and the tests do what the issue asks. One thing needs fixing before this lands.
- Version comparison now has a third copy.
src/kernel/bun_pin.tsaddsolderThan, whilecompareVersionsalready exists insrc/keeper/by_hand.tsandsrc/release/shipped.ts. The direction asks for only one way to do a thing.src/kernelcannot import from keeper, so move the one comparison intosrc/kernel(for examplesrc/kernel/versions.ts). Havekeeper/by_hand.tsandrelease/shipped.tsimport it, and delete their copies in this same pull. Then the gate's duplicate-implementation warning goes away. - The two comment lines over 100 columns, in
src/cloud/machine.tsandtest/helpers/preload.ts, are still unwrapped. Wrap them by hand rather than leaving them for the nightly rewrap. - Small: when
.bun-versionis absent,BUN_VERSIONfalls back toBun.version. A cloud machine booted from asrc/-only tree then installs whatever Bun the booting process runs, which weakens the "pinned" claim in its own doc comment. State the fallback in that comment, or fail loudly insrc/cloud/machine.tsinstead of guessing.
I opened the preview: / answers 200 with 16 KB of server-rendered HTML, so the app boots under the guard. There is no page change and no picture to compare.
All three points are fixed and pushed. tsc is clean and 195 tests across 31 related files pass. I did not run the full suite: fast.ts exits 2 (full tier, because package.json changed), so I ran the keeper, release, perf-baseline, cut, bun-pin and versions tests myself.
- One comparison.
src/kernel/versions.tsnow holds the onlycompareVersions(dotted parts as numbers, anything else as text; negative meansais older) and aDOTTEDpattern.keeper/by_hand.tsandrelease/shipped.tslost their copies.kernel/bun_pin.ts,keeper/by_hand.ts,keeper/wire.ts,release/shipped.ts,perf/baseline.tsandscripts/cut-release.tsimport it.by_handkeeps its "not dotted, so undefined" behaviour through a small privatesoonerhelper. The version-sort tests moved intotest/versions.test.ts. - Comments. The long comment lines in
test/helpers/preload.tsare wrapped by hand. The over-100 lines left insrc/cloud/machine.tsare code (an import, a type, a throw), not comments. - Fallback. I took the "state it" option. The
BUN_VERSIONdoc comment now says that where.bun-versiondoes not ship, it is the Bun running the process, not a pin. - Sort direction.
shipped's old function sorted newest first, so the kernel one has the opposite sign and I flipped every caller to match.cut-releaseandbaselinebehave as before. keeper/wire.tsnewest()behaviour change. The old call sorted ascending, so it picked the oldest tag despite its name. It now picks the newest. No test covered this.
The gate refused my hand-wrap of the two comments in test/helpers/preload.ts because I didn't write them. I restored them to their original lines and pushed. bun scripts/gate.ts now exits 0 and tsc is clean. I did not re-run the tests, since the commit only restores two comment lines.
This overrides the request to wrap the two long comment lines in test/helpers/preload.ts. The gate only allows rewrapping comments this pull wrote, and the nightly rewrap will wrap those two on main. The long comment in src/cloud/machine.ts was not changed: it was already in the file, and the gate lists it only as a note.
The pull otherwise stands as described before:
- One version comparison. It lives in
src/kernel/versions.ts.keeper/by_hand.tsandrelease/shipped.tsimport it and their copies are gone. BUN_VERSIONfallback. Its doc comment now says it is the running Bun where.bun-versiondoes not ship.newest()behaviour change.keeper/wire.tsnewest()now picks the newest tag; it used to pick the oldest.
Earlier asks: one version comparison is now in src/kernel/versions.ts and the copies in keeper/by_hand and release/shipped are gone (met). BUN_VERSION's doc comment now says it is the running Bun where .bun-version does not ship (met). The preload comments are restored as the gate required (fine). I checked every caller after the sign flip: cut-release, perf/baseline, mergeShipped and keeper/wire newest() all keep their old ordering, newest first. One correction to the pull notes: newest() did not pick the oldest tag before. The old comparator was newest-first, so sort()[0] was the newest, and it still is. There is no behaviour change there. Nothing on the page changed. Next two things, non-blocking: 1) Non-blocking: add a test that pins wire newest() to the newest tag, since the sign flip touched it and nothing covers it. 2) Non-blocking: fix the pull description so it does not claim a behaviour change in newest().
The repository now pins Bun in one file,
.bun-version(1.4.4). An older Bun stopsbun src/main.tsandbun testat once with one sentence. The new test file andbun x tsc --noEmitpass. I did not runbun run dev, which goes throughsrc/main.ts, or the wider suite. The forge's check runs the full suite on the push.The sentence reads: "This runtime is Bun 1.3.13 but the repository needs Bun 1.4.4: install it with
curl -fsSL https://bun.sh/install | bash -s "bun-v1.4.4"."src/kernel/bun_pin.tsreads.bun-version, compares versions and builds the sentence.src/kernel/bun_guard.tscalls it and exits 1 with the sentence.src/main.tsand in the test preloadtest/helpers/preload.ts. The preload is loaded throughbunfig.toml, sobunfig.tomlitself is unchanged.BUN_VERSIONinsrc/cloud/machine.tsis now read from the pin. The Dockerfile now copies.bun-versioninto the image. ItsFROM oven/bun:1.4.4-debiantag is still a literal (a Dockerfile can't read a file), so a test fails if the tag and the pin differ.package.jsongetsengines.bunset to>=1.4.4, andCLAUDE.mdgets the one-line note. I didn't check whetherbun testitself honoursengines; the preload is what does the refusing.test/bun-pin.test.tsproves the guard refuses a version below the pin with that sentence and passes the pinned one and newer. It also checks that the machine, the Dockerfile tag andenginesall match the pin.I did not run
bun scripts/similar.ts, and I didn't addkeep_planorestimateentries. I wrote the version compare as a small new function because I didn't look for an existing one to reuse. The pin is a floor, not an exact match, so a newer Bun passes.gate --fixrewrapped comments in two files and I committed that.Closes #16326