Repository navigation
refactor(perf): build every wt-perf fixture branch through one primitive - #3584
Merged
Merged
Conversation
Three generators each grew their own way of creating a fixture branch: `add_history_spread_branches` pointed a ref at an old commit, `add_diverged_backdrop` hand-rolled ~45 lines of index plumbing, and `create_mixed_repo_at` used `checkout -b` plus a return-to-main for two of its four states. They are the same operation. A branch's state is entirely the pair (fork point, own-commit count): zero commits at an old fork is "behind" and at the tip is "identical"; a positive count from the tip is "ahead" and from anywhere else is two-sided "diverged". `add_branch_with_commits` takes that pair, and the mixed fixture's rotation collapses to a six-line table. The checkout path is what actually mattered. `git checkout` of an old fork point on rust-lang/rust rewrites the whole tree, minutes per branch, which is why `add_diverged_backdrop` grew plumbing in the first place. Routing the mixed fixture through it removes the last checkout from fixture construction, so the main worktree is never touched and the fixture is no longer structurally barred from a rust-scale repo. Fixture build time is unchanged at both `mixed-8-8` and `mixed-24-120`. Add the guards that were missing before the refactor, so the shapes the benchmarks measure are pinned by something other than a wall-clock number: - the `full` fixture's documented `index % 4` rotation of branch and worktree states, asserted via `merge-base --is-ancestor` exit codes and porcelain status - the same fixture's zero-dimension contract (`mixed-W-0` / `mixed-0-B`), which holds only because `0..0` never enters the loop that divides by `branches` - `add_diverged_backdrop`'s own wiring: every member unintegrated, fork depths fanning across history, worktrees dirty only via untracked scratch, and populations that don't follow each other Each guard was mutation-tested rather than trusted for being green. Writing them turned up a docstring overclaim: `add_diverged_backdrop` says the default branch has advanced past every fork, but the history spread's newest sample is the tip itself, so index 0 of each population is strictly ahead. It is true in the only caller, where `add_squash_merged` advances the default branch on the next line. Correct the docstring rather than the sampling, which would change every prune benchmark's workload.
The test module had grown two ways to read `git status --porcelain`: a raw-stdout closure, and a `capture_git` call. They are not equivalent — `capture_git` trims, and porcelain's leading column is what separates ` M` (unstaged) from `M ` (staged). The trimming variant passed only because every line it happened to see began with `??`. Keep the correct one, as a module-level helper both callers share. Also correct `add_history_spread_branches`'s docstring, which claims the branches are "behind-only". The spread samples newest-first, so `feature-000` sits exactly on the tip — the same overclaim already fixed on `add_diverged_backdrop`, and the shape the GH #461 rust-repo bench builds.
worktrunk-bot
approved these changes
Jul 25, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
Jul 25, 2026
Cuts v0.69.2, and fixes the Windows code-signing path it depends on. ## The signing fix v0.69.1 shipped an unsigned `wt.exe` under a green run and a **Completed** SignPath signing request. `archive: false` (#3566) had already made the GitHub artifact name `worktrunk-x86_64-pc-windows-msvc.zip`, and SignPath names its download after the artifact — so with `output-artifact-directory: target/distrib` the signed zip landed at `worktrunk-x86_64-pc-windows-msvc.zip.zip`, beside the untouched unsigned build. The checksum step and the release upload both kept reading the original. Confirmed by parsing the published asset's PE certificate table: `size=0`. The download now goes to a scratch directory and whatever single file lands there replaces the built zip, so SignPath's naming isn't load-bearing. ## Verification, because this failure is invisible Signing is `continue-on-error` by design (self-signed test certificate pending SignPath's OSS review), so nothing in the logs distinguishes "signed" from "silently unsigned" — which is how it slipped through twice, two different ways. `.github/verify-windows-signature.py` reads the zip's PE certificate tables directly, and runs at two points with distinct jobs: - **before the overwrite** — an unsigned release is tolerable while the certificate is a test one; a corrupt one never is, so the replacement has to verify before it can clobber a good build. - **after** — reports what the release actually ships, which is the question the logs never answered. ## Rehearsed before landing The signing path only runs on a tag, so each question about it used to cost a release. This chain was instead run on a Windows runner against the already-published v0.69.1 zip (identical bytes, no build): ``` saved to …\target\signpath\worktrunk-x86_64-pc-windows-msvc.zip.zip git-wt.exe: certificate table 8480 bytes wt.exe: certificate table 8472 bytes → mv → target/distrib/worktrunk-x86_64-pc-windows-msvc.zip target/distrib/worktrunk-x86_64-pc-windows-msvc.zip: all 2 executables signed worktrunk-x86_64-pc-windows-msvc.zip: OK (checksum matches) ``` That also settled the open question behind #3556: SignPath returns the signed zip itself, not a wrapper, so `skip-decompress: true` is correct — the extract mode does explode it into loose files. ## Release contents `wt remove`'s fsmonitor sweep (#3581), the troubleshooting doc trim, and this fix. The two refactors in range (#3582, #3584) are behavior-preserving and omitted per convention. Local gate green (4547 passed). Changelog entries verified against the diffs by subagent; two claims corrected (the doc entry's rationale, and an overclaim attributing v0.69.0's unsigned binary to this bug rather than the separate upload failure #3566 fixed). Data-loss surface reviewed across the cumulative diff. > _This was written by Claude Code on behalf of max_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3548, which consolidated the
wt-perfprune fixtures but left the branch builders diverged.The refactor
Three generators had each grown their own way to create a fixture branch.
add_history_spread_branchespointed a ref at an old commit,add_diverged_backdrophand-rolled ~45 lines of index plumbing, andcreate_mixed_repo_atusedcheckout -bplus a return-to-main for two of its four states.They are the same operation. A branch's state is entirely the pair (fork point, own-commit count): zero commits at an old fork is "behind" and at the tip is "identical"; a positive count from the tip is "ahead" and from anywhere else is two-sided "diverged".
add_branch_with_commitstakes that pair, and the mixed fixture's four-state rotation collapses to a table:The checkout path is what actually mattered.
git checkoutof an old fork point on rust-lang/rust rewrites the whole tree (minutes per branch), which is whyadd_diverged_backdropgrew plumbing in the first place. Routing the mixed fixture through the same primitive removes the last checkout from fixture construction, so the main worktree is never touched and the fixture is no longer structurally barred from a rust-scale repo.The win is structural. Fixture build time is unchanged:
mixed-8-8runs 3.25/3.28/3.71s after against 3.33/3.55/3.91s before, andmixed-24-12014.9/15.7s against 15.5/23.5s. That is parity within noise, and the before-side spread swamps the difference.The guards
These generators had nothing pinning their output. The benchmarks measure one wall-clock number, so a generator change that collapsed (say) "diverged" into "ahead" would keep every bench green while silently measuring a different repo. Three tests now assert the shapes directly, via
merge-base --is-ancestorexit codes and porcelain status:fullfixture's documentedindex % 4rotation of branch and worktree statesmixed-W-0/mixed-0-B), which holds only because0..0never enters the loop that divides bybranchesadd_diverged_backdrop's own wiring: every member unintegrated, fork depths fanning across history, worktrees dirty only via untracked scratch, and populations that don't follow each otherEach was mutation-tested rather than trusted for being green. A clamped divisor gives
left: 1, right: 0, and a fork spread collapsed onto the tip givesfork depths must fan out across history: [0, 0, 0, 0].One thing to look at
Writing the guards turned up a docstring overclaim in two places.
history_spread_shassamples newest-first, so index 0 is the default branch's own tip. That makesadd_diverged_backdrop's "the default branch has advanced past every fork" andadd_history_spread_branches's "behind-only" both false as written. The first is true in its only caller, whereadd_squash_mergedadvances the default branch on the very next line.I corrected the docstrings rather than the sampling, and pinned the behavior with
assert_eq!(depths[0], 0, "the newest sample is main's own tip"). Changing the sampling would shift the workload of every prune andlistbenchmark that uses the spread, moving Criterion's historical series with no rename to signal it, in exchange for one branch out of 24 to 120 gaining fork depth. Happy to flip it if you'd rather; it is documented and asserted either way.Verification
hook pre-mergegreen (4542 tests), andcargo bench --bench list fullruns end to end against the rebuilt fixture. Shape verified at benchmark scale rather than only at the test'sN = 8: a realmixed-24-120holds the rotation throughbr-0118. The refactor is content-identical for the backdrop (same blob content, filenames, commit messages, plumbing sequence) and structurally identical for the mixed fixture (same fork points and commit counts, since0..=(i%3)and1 + i%3agree).