Repository navigation
Inspect Worktree ownership with fewer git processes to shorten macOS CI - #857
Merged
Merged
Conversation
macOS CI spends its time running the suite, and the Run tests are bound by spawning git, mostly for Worktree ownership inspection. One rev-parse now reads the checkout's top level, administrative and common directories and HEAD, so each inspection runs three fewer git processes with the same checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Spec review found that splitting the combined rev-parse output into four lines refused a checkout whose path holds a newline, which main inspected successfully. Git::checkout_location now owns that parsing and reads each value with its own process when the output is not four lines, trimming each value as Git::run did, so the checks are those of main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 20, 2026
Merged
Closed
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.
Summary
macOS shards spend ~33 s building and 990–1220 s running tests (main run 39337614995). Locally, Run tests are bound by spawning processes, and ~82% of the spawns are git commands from Worktree ownership inspection. That inspection runs at least twice around every ordinary Worktree operation, and spawning costs more on macOS.
The comparisons are unchanged. Each value is trimmed as
Git::runtrims.Evidence
Before:
spec_run a_ticket_needs_only_a_trusted_author_not_a_ready_label_of_its_ownran 5,415 programs (strace) in 19.6 s (12.3 s system time) on x86_64 Linux. One ordinaryWorktree::head()ran 32 git processes.After: 4,221 programs (22% fewer) in ~17.2 s. One
head()runs 23 git processes;an_ordinary_operation_inspects_ownership_in_few_git_processesfails at 32 and passes at 23.The Spec review found a regression in the first commit: a newline in the path. Before the fix,
a_checkout_path_with_a_newline_passes_ownership_inspectionfailed (test result: FAILED. 0 passed; 1 failed). It passes now.a_checkout_location_reads_a_linked_worktree_whatever_its_pathchecks paths with a newline and with a trailing space against the separate observations.Full suite:
cargo nextest rungives 2012 passed, 0 failed.cargo clippy --all-targets -- -D warningsandcargo fmt --checkare clean.macOS, test-step seconds per shard:
That is about 16% less macOS test time in total and about 9% off the slowest shard, from one run. Shard times vary by ±15% between runs.
Merge Danger
Door: two-way
A pure revert restores the four separate calls. Nothing is persisted.
Blast Radius: Worktree-ownership
Every Run's worktree inspection goes through
Git::checkout_location. A wrong parse would refuse the Run's worktree operations (fail closed); it cannot authorize a different checkout, because every value is still compared with the pinned identity.Unaddressed findings
Standards
ownership.rscomment left with the parsing. Thesrc/git.rsdoc comment, the test's doc comment anddocs/ci-performance.mdeach keep one sentence for their own reader.Spec
--git-common-dirshare is untouched): declined; filed as Decide whether Worktree ownership inspection may recheck the launch repository less often #858. Those calls are the launch-side repository rechecks (Directory::verify_repository,src/worktree/ownership.rs) before and after the Git observations, under ADR 0014's pinned-ownership model. Removing or caching them changes what inspection checks. That is a security design decision for the Day shift.Security review outcome
No unaddressed introduced findings.
Review coverage
The reviewers' reports cover commit b729ef0 and read every file it changed. The fixes in 2dcb944 came after the review. The changed file
src/git/execution_tests.rswas left unread by both axes. Standards also did not read the newCheckoutLocationhunk insrc/git.rsor the test appended tosrc/worktree/acquisition_tests.rs.Closes #846
🤖 Generated with Claude Code
Built with claude · claude-opus-5-5 · medium