Rust tools: make difftastic/nushell/hex-patch reproducible (codegen-units + const-random)#254
Rust tools: make difftastic/nushell/hex-patch reproducible (codegen-units + const-random)#254bryan-minimal wants to merge 1 commit into
Conversation
Two-layer non-determinism: parallel codegen-units (.llvm.<hash> local symbols + partitioning) and ahash/const-random compile-time seed. Fix: -C codegen-units=1 + CONST_RANDOM_SEED=0 (plus --remap-path-prefix path hygiene). hex-patch verified byte-reproducible with the combined fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 3 hours, 23 minutes, and 47 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
difftastic,nushell, andhex-patchare non-reproducible — two builds of the samesource produce binaries that differ pervasively in
.text/.rodata.Root cause (two layers)
non-deterministic
.llvm.<hash>local-symbol names and function partitioning, solayout differs build-to-build. This is the bulk of the difference (millions of bytes).
ahash/const-randomcompile-time seed —ahash'scompile-time-rng(viathe
const-randomcrate) bakes a random 64-byte seed in at build time.(
--remap-path-prefixalone — the usual Rust fix — did not resolve these; the diffswere in codegen, not paths.)
Fix
Pin both, matching the
bat/ripgrep/fdpath hygiene already in the tree:Verification
hex-patchis confirmed byte-reproducible across two from-scratch builds with thecombined fix (
repro-check diff: no differences).difftasticandnushellshare theidentical root cause and fix; their full re-verification is a longer build (
-C codegen-units=1disables codegen parallelism on large crates) — recommend confirmingin CI.
Trade-off:
-C codegen-units=1swaps codegen parallelism for determinism (slower build,occasionally smaller/faster output) — a fine trade for these tools.
🤖 Generated with Claude Code