8000 nushell: keep upstream thin LTO, drop codegen-units=1; use packages/detbuild by bryan-minimal · Pull Request #1742 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

nushell: keep upstream thin LTO, drop codegen-units=1; use packages/detbuild - #1742

Merged
bryan-minimal merged 1 commit into
mainfrom
nushell-build-speed
Nov 27, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
nushell-build-speed

Conversation

@bryan-minimal
@bryan-minimal bryan-minimal commented Nov 26, 2026 •
Copy link
Copy Markdown
Member

What

For reproducibility, nushell's recipe turned off upstream's thin LTO (CARGO_PROFILE_RELEASE_LTO=off) and forced codegen-units=1, both in RUSTFLAGS and in the profile (#254, #292). This PR:

symbol-mangling-version=v0, CONST_RANDOM_SEED=0, --remap-path-prefix, the security-floor check, and cargo fetch --locked before the shim are all unchanged.

Why

#292 added the getrandom shim in the same change as the LTO-off / cgu=1 overrides. As with codex (#878 to #1713, gominimal/inbox#253), the shim is the part that makes the build reproducible, and the overrides only make it slow.

Build time

before (main) this PR
build-bot arm64 wall / CPU 139–221 s / 890–930 s 74 s / 1227 s
build-bot amd64 wall / CPU 223–241 s / 1467–1537 s 102 s / 2038 s
build-bot artifact bytes ~83–84 MB 90 MB
local min box (6 CPU), two runs - 211 s, 197 s

Build-bot numbers come from res-server's wall_s / cpu_lower_bound_s journal fields. The baseline is main's builds from the last 2 days; this PR's are from run c20be6ea.

Reproducibility evidence

I ran two clean local --rebuilds, each in a freshly activated session (arm64):

  • run 1: fa7bd19dc3ec7b31ff64aff85a0c2bee21c97911c29630ff1ed6ffe9b0e83eca, 85,373,520 B
  • run 2: fa7bd19dc3ec7b31ff64aff85a0c2bee21c97911c29630ff1ed6ffe9b0e83eca, 85,373,520 B

The two binaries are byte-identical.

Runtime trade-off

This turns upstream's thin LTO back on, but codegen is now parallel (default units) instead of cgu=1. The artifact is about 8% larger (90 MB vs 83 MB), and the binary may be a few percent slower than with cgu=1. For a shell, that is acceptable.

🤖 Generated with Claude Code

…/detbuild

The recipe turned LTO off and forced codegen-units=1 (RUSTFLAGS and profile)
for reproducibility (#254, #292). #292 also added the getrandom shim, which as
with codex (#1713) is the part that matters (inbox#253). Keep upstream's
release profile, and replace the inline shim with packages/detbuild. build.sh
echoes the binary's sha256 so two builds can be compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai
coderabbitai Bot commented Nov 26, 2026 •
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 59 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f44b00d and 58a4bd1.

Files selected for processing: 2

  • packages/nushell/build.ncl
  • packages/nushell/build.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@bryan-minimal
Copy link
Copy Markdown
Member Author

Build-bot minimal build green (run c20be6ea): wall arm64 74 s (was 139–221 s), amd64 102 s (was 223–241 s). Local double build sha256 fa7bd19d…83eca both runs (85,373,520 B), byte-identical.

@bryan-minimal
bryan-minimal marked this pull request as ready for review November 26, 2026 22:07
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 26, 2026 22:07
@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope matches the title. Both files change only what the PR body states: the detbuild build dependency, the three removed overrides, the shim swap and the hash echo.

Clobber none. git log on packages/nushell shows that the fetch-before-shim order from #1326 and the security-floor check stay in place.

Correctness The preload follows the detbuild rules in AGENTS.md. It is a prefix on one command, cargo build has --frozen, cargo fetch --locked runs first without the preload, and detbuild is in build_deps. The shape is the same as packages/codex/build.sh:106. Two comments tell the his 8000 tory of the script, and one of them names only a part of what detbuild pins. Both are nits.

Not checked I did not build. The reproducibility evidence in the PR body is two local arm64 builds on one 6-CPU machine. The body shows no second amd64 build and no hash comparison between the build-bot and the local build. Thin LTO with the default codegen units is thus not proven reproducible on amd64 or across hosts with different CPU counts. I did not run .github/scripts/detbuild_preload_guard.py, because it needs the catalog dump. I did not read the upstream Cargo.toml to confirm lto = "thin", because the source archive is not in the checkout.

The inline zero-fill shim that this PR removes from nushell stays in packages/zola/build.sh:47 and packages/verus-latest/build.sh:153. That is outside this PR.

Comment thread packages/nushell/build.sh
# script used to turn LTO off and force codegen-units=1 (in RUSTFLAGS and the
# profile) for that (pkgs#254, #292; #292 also added the shim), and as with codex
# (pkgs#1713) the shim is the part that matters. Don't put them back for
# reproducibility; compare two builds' sha256 (echoed below) instead.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · These lines tell what the script did before this PR and cite four PR numbers. That history is in git log and the PR body. Keep the rule and its reason: upstream's thin LTO stays, the detbuild preload makes it reproducible, and do not add codegen-units=1 or LTO-off back. packages/codex/build.sh:8-11 states the same rule without the history. The same history wording is in the second comment at line 37.

Comment thread packages/nushell/build.sh
# shim this script used to compile): interposes getrandom/getentropy so build.rs /
# proc-macro / rustc-internal HashMaps iterate identically every build. Scoped to
# the cargo build only, and that build stays offline: `--frozen` refuses any
# network access. The produced binary is unaffected.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · The comment says the shim interposes getrandom/getentropy. libdetbuild.so also replaces arc4random, reads of /dev/urandom and /dev/random, and pins the uname release to 6.1.0-minimal (packages/detbuild/build.ncl:10-16). The old inline shim did only the two calls, so the sentence describes the removed code. The clause 'replacing the copy of the shim this script used to compile' is history and can go. packages/codex/build.sh:100-101 has the same text.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 4125c87 Nov 27, 2026
16 checks passed
@bryan-minimal
bryan-minimal deleted the nushell-build-speed branch November 27, 2026 17:26
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.

2 participants

0