Repository navigation
biome: thin LTO under the detbuild shim instead of fat LTO - #1740
Conversation
Upstream's .cargo/config.toml sets [profile.release] lto = true, which runs the whole crate graph's final optimisation on one core (~32/25 min on the build-bot). Override it to thin LTO, add v0 mangling, fetch crates first, and run the now-offline build under packages/detbuild, the codex recipe (#1713). build.sh echoes the binary's sha256 so two builds can be compared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 48 minutes for your next included review. View limit details
|
|
Build-bot |
There was a problem hiding this comment.
Scope matches the title. The two files change only the LTO mode, the mangling flag, the fetch and build split, and one log line. The CVE-2026-111943 lock patch, its checks and BIOME_VERSION are unchanged.
Clobber none. git log -- packages/biome shows only version bumps before this commit, and the diff reverts none of them.
Correctness the preload follows the Preloading detbuild rules in AGENTS.md. detbuild is in build_deps. The preload is a one-command prefix. The preloaded cargo has --frozen, and cargo fetch --locked runs first without the preload. The shape is the same as packages/codex/build.sh:98-106. One finding: the claim that no build script downloads is a manual check for 2.6.9, and nothing checks it again on a version bump.
Not checked. I did not read the upstream source, because the sandbox denied the network fetch. So these claims are not verified: upstream sets lto = true in .cargo/config.toml, upstream leaves codegen-units at the default, and no build script that biome_cli reaches downloads. I did not run detbuild_preload_guard.py, because it needs a catalog dump. The reproducibility evidence in the PR body is for arm64 only. An amd64 double build needs a build, and I did not do it. The agent.version field is unknown because the sandbox denied claude --version.
| # All network access happens here, with real entropy: crates are fetched (and | ||
| # checked against Cargo.lock) before the shim below is loaded, so no TLS session | ||
| # runs with the shim's fixed bytes. No build script biome_cli reaches downloads | ||
| # anything (checked for 2.6.9), so the build below needs no network. |
There was a problem hiding this comment.
low · The comment says no build script downloads, and that someone checked it for 2.6.9. Nothing in the script checks it again. Biome version bumps are routine commits (Update biome to 2.6.9 (#1699) and five before it), and a bump does not repeat a manual check. --frozen stops cargo fetches only. A build.rs that downloads in a later release will make its TLS session with the shim's fixed bytes, and the build will still pass. packages/codex/build.sh:80-83 fails closed on its one known downloader (v8). Add a check that fails the build, for example a grep of Cargo.lock for known downloader crates, or remove the version-specific claim and state what a bump must check. This is the only package of the six shim users that states a per-version manual check.
What
Upstream biome's
.cargo/config.tomlsets[profile.release] lto = true(fat LTO). Fat LTO runs the final optimisation of the whole crate graph on one core. This PR:CARGO_PROFILE_RELEASE_LTO=thin(codegen units stay at cargo's default);-C symbol-mangling-version=v0, which codex, nushell and zola also use for reproducibility;cargo fetch --lockedfirst, then the offlinecargo build --frozenunderpackages/detbuild(LD_PRELOAD=/usr/lib/minimal/libdetbuild.so), as codex does (codex: drop codegen-units=1 (reproducible via the entropy shim), strip, link system sqlite/zstd/oniguruma/bzip2, skip the rusty_v8 fetch #1713);The CVE-2026-111943 lock patch and its checks,
BIOME_VERSION, and--remap-path-prefixare unchanged.Why
biome takes about 32 min (one arch) and 25 min (the other) on the build-bot. Most of that is the serial fat-LTO link.
Build time
Build-bot numbers come from res-server's
wall_s/cpu_lower_bound_sjournal fields. The baseline is main's builds from the last 2 days; this PR's are from run e4e1ce24.Reproducibility evidence
I ran two clean local
--rebuilds, each in a freshly activated session (arm64):d55f45796bc0daa22c2c2e3a2dfe0bf5a837f43353606679bd3b4ea28ce5b66a, 193,544,520 Bd55f45796bc0daa22c2c2e3a2dfe0bf5a837f43353606679bd3b4ea28ce5b66a, 193,544,520 BThe two binaries are byte-identical.
The artifact is about 30% larger, which is the usual cost of thin LTO compared with fat LTO.
Runtime trade-off
Fat LTO usually gives a binary a few percent faster than thin LTO. For a linter/formatter CLI, that is worth less than a build several times faster, so this PR accepts it, as #1713 did for codex.
🤖 Generated with Claude Code