Skip to content

fix(hooks): make the warm build and the gate agree on their flags - #3627

Merged
max-sixty merged 3 commits into
mainfrom
test-binary-count
Jul 28, 2026
Merged

max-sixty merged 3 commits into
mainfrom
test-binary-count

Conversation

@max-sixty

@max-sixty max-sixty commented Jul 27, 2026 •

Copy link
Copy Markdown
Owner

The post-merge build step exists to warm the cache the pre-merge insta gate reuses. Its flags never matched that gate's, so it warmed nothing.

-build = "cargo test --no-run --all-targets --locked --all-features"
+build = "RUSTFLAGS='-D warnings' cargo test --no-run --locked --all-targets --all-features"

-insta = """… --features shell-integration-tests"""
+insta = """… --all-features"""

Cargo fingerprints RUSTFLAGS alongside the feature set, so the two lines produced disjoint artifacts:

Build integration hash
post-merge build: --all-features, no RUSTFLAGS f4f93b9e202ea20b
the gate: RUSTFLAGS='-D warnings' --features shell-integration-tests 742b05e128bc5d53

Measured: the gate used to recompile worktrunk from scratch (28.6s) right after the warm build had finished building the same crate. With matched flags it compiles nothing (0.16s).

They can agree at either feature set. --all-features is the one that's obvious to oversee, and it keeps every target building, so both lines use it.

The test set is unchanged at 4607 either way: the extra features gate a bench (real-repo-benches, which nextest never runs) and the git-wt binary, whose unit tests are test = false because git_wt.rs is include!("main.rs") and they'd be byte-identical duplicates of wt's.

Verification

wt hook post-merge --yes build produces the gate's exact artifact hashes, after which cargo nextest list --all-features compiles nothing. cargo nextest list reports 4607 tests under both feature sets. pre-commit run --files .config/wt.toml passes.

Context

This came out of asking why cargo test --no-run --all-targets --locked --all-features reports 17 test binaries, given we follow matklad's guidance that each tests/*.rs file relinks the library. We do follow it: one integration binary plus one documented exception (cancel_background, which latches process-wide state). The 17 was the widest build in the repo, not the test build.

This was written by Claude Code on behalf of Maximilian Roos

🤖 Generated with Claude Code

max-sixty and others added 2 commits July 26, 2026 20:47
The post-merge `build` step exists to warm the cache the pre-merge `insta`
gate reuses, but its flags never matched that gate's. Cargo fingerprints
RUSTFLAGS alongside the feature set, so building with `--all-features` and
no `-D warnings` produced a disjoint set of artifacts the gate then rebuilt
from scratch.

Matching the flags also drops nine targets nothing runs: seven criterion
benches, plus the `git-wt` and `mock-stub` unittest binaries that
`--all-targets` resurrects despite `test = false` on both. `git_wt.rs` is
`include!("main.rs")`, so its 58 MB of tests duplicated `wt`'s exactly. The
step now links 8 test binaries instead of 17, and the clippy step above
still type-checks the rest under `--all-targets --all-features`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Target selection isn't a fingerprint input, so `--all-targets` doesn't
compromise the match with the gate: the lib, `wt` and `integration` units get
the same hashes either way, and the gate still compiles nothing afterwards.
Keeping it builds the benches, so a merge still checks that everything links.

The `git-wt` duplicate stays gone regardless. Its target declares
`required-features = ["cli", "git-wt"]`, so dropping `--all-features` excludes
it on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title fix(hooks): match the post-merge warm build to the gate it warms fix(hooks): make the post-merge warm build match the gate it warms Jul 27, 2026
The warm build and the gate it warms have to agree on RUSTFLAGS and the feature
set, since cargo fingerprints both. They can agree at either feature set;
`--all-features` is the one that's obvious to oversee, and it keeps every target
building.

So the whole change is now adding RUSTFLAGS to the warm build and moving the
gate to `--all-features`. The test set is unchanged at 4607, since the extra
features gate a bench and a binary whose tests are `test = false`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title fix(hooks): make the post-merge warm build match the gate it warms fix(hooks): make the warm build and the gate agree on their flags Jul 28, 2026
@max-sixty
max-sixty marked this pull request as ready for review July 28, 2026 19:50
@max-sixty
max-sixty merged commit 67945d7 into main Jul 28, 2026
39 checks passed
@max-sixty
max-sixty deleted the test-binary-count branch July 28, 2026 19:54
@worktrunk-bot worktrunk-bot mentioned this pull request Jul 29, 2026
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