os: memoize base_branch so finish runs git symbolic-ref once #719
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#719
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blocked-by: #717
Problem
FinishCommand#base_branch(plugins/os/lib/worktree/finish_command.rb:59-61) runsgit symbolic-ref --short HEADon every call, andrun(line 21-33) calls it up to 3 times in one finish: once viabase_moved?(line 63-64), once viabase_moved_notice(line 70) when the base has moved, and once viaverify_ancestry!/the finalputs(line 31, 88). It is not memoized.Approach
Required work:
base_branchinFinishCommandwith@base_branch ||= @git.read('symbolic-ref', '--short', 'HEAD').strip(the@gitcollaborator from #717).Acceptance criteria
FakeGitdouble, thensymbolic-ref --short HEADwas recorded exactly once in the double's call log.Owner sketch
Retired tests
none
Non-goals
Any change to what
base_branchresolves to, or to the finish flow's control order.Origin
Session: 89876543-c418-46b0-b994-dd6dc6887802
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/89876543-c418-46b0-b994-dd6dc6887802.jsonl
Trigger: review of #634/#707/#708 (commits
8ef12ae8,e2817ffe, ADR-0218)Improvised this session: none
Chain: env:/thread-local in lib ← ADR-0218 item 1 chose spawn-env-hash + Thread.current ← DESIGN (docs/adr/ADR-0218…, contradicts ADR-0213 and ADR-0207)
Root candidate: #716 (the superseding ADR)
Resolution
Done: base_branch memoized with @base_branch ||= in FinishCommand (shipped inside #717
aa3475d2); acceptance test added asserting symbolic-ref --short HEAD recorded once through FakeGitEvidence: main
8156d792; test proven red (Expected 1, Actual 3) with memoization removed, then green; os suite 27 runs 0 failures. Not run through the pipeline: the production change already existed after #717, which is the #724 shapeFollow-ups: none