Skip to content

perf: name origin's default branch once per claim operation - #1099

Merged
REPPL merged 2 commits into
mainfrom
fix/loop-tests-faster
Oct 18, 2026
Merged

REPPL merged 2 commits into
mainfrom
fix/loop-tests-faster

Conversation

@REPPL

@REPPL REPPL commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

What this changes

A claim operation names origin's default branch fewer times. Each lookup is two git processes (symbolic-ref of origin/HEAD, then rev-parse --verify), and a drain makes reservations and views on every move.

Operation Before After
A reservation (no other reservation on origin) 3 lookups 2: one before its fetch, one after
A view 2 lookups 1
  • Reservation: judge resolves the name once, after the reservation's fetch, and hands it to defaultRecords. It used to resolve it twice, once for the default branch's records and once to ask whether there was a default branch.
  • View: viewOf resolves it once and reads the generated files under that name through a new unexported generatedFilesAt. The exported GeneratedFiles keeps its form.

Scope of the name. It is passed down explicitly and lives for one operation; there is no package variable. It is never carried across a fetch, because git 2.48 and later can create or move origin/HEAD on a fetch (remote.<name>.followRemoteHEAD). Every operation resolves it afresh, so a default branch that changes is seen at the next one. A side effect: the records and the "no default branch" message in judge now come from one reading, where two readings could disagree if another process fetched between them.

Measured on one drain test in internal/core/implement/loop: 1,107 git processes before, 1,019 after.

This is the first of two claim changes for the loop package's subprocess-bound tests. The second reads a view's reservation tips in one batch and follows as its own pull request.

Evidence

  • Call-count tests (internal/core/claim/calls_test.go) pin a reservation at 2 lookups and a view at 1. A reviewer reverted a copy to the old code, and both tests failed (3 and 2).
  • The claim, peers, loop and CLI suites pass.
  • make preflight passed on this commit (receipt minted).
  • Opus and Sonnet reviewers on a frozen copy: both LAND. Their wording note on the test comment is applied in the second commit.

Refs: iss-2610180545134593

Assisted-by: Claude:claude-opus-5-5

REPPL added 2 commits October 18, 2026 12:55
A reservation named origin's default branch three times, two git processes
each: once for its fetch and twice in judge, once for the default branch's
records and once to ask whether there was one. A view named it twice: for
those records and for the generated files. A drain makes both on every
move, and in one drain test these lookups were about a tenth of its 1,107
git processes.

judge now resolves the name once, after the act's fetch, and hands it to
defaultRecords; a view resolves it once and reads the generated files under
it through generatedFilesAt, the exported GeneratedFiles keeping its form.
The name is never carried across a fetch, which can create or move
origin/HEAD, and every operation resolves it afresh, so a default branch
that changes is seen at the next one. Tests pin a reservation at two
lookups, one each side of its fetch, and a view at one; the drain test
falls to 1,019 git processes.

Refs: iss-2610180545134593

Assisted-by: Claude:claude-opus-5-5
Review notes: the reservation test said a reservation names the default
branch twice, no more, but that holds where origin holds no other
reservation; with others there, the crowding check's view names it once
more after the same fetch. It also gave the old count as five, where the
case it measures made three. The comment and the failure text now say
both.

Refs: iss-2610180545134593

Assisted-by: Claude:claude-opus-5-5
@REPPL
REPPL enabled auto-merge October 18, 2026 14:20
@REPPL
REPPL added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 37404a8 Oct 18, 2026
14 checks passed
@REPPL
REPPL deleted the fix/loop-tests-faster branch October 18, 2026 15:35
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.

1 participant