Move os:worktree and handoff git calls into os-git Worktree and Integration #1589
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#1589
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?
Problem
plugins/os/lib/worktree/*is the second-largest git wrapper (Worktree::Gitplus about ten policy classes).Handoff::Repositoryhas its own private git helper that returns""on every failure.plugins/os-sdlc/lib/os_sdlc/gate/unchanged_check/base_checkout.rbis a second owner ofworktree addandworktree remove. The worktree rules (refuse a dirty primary, fast-forward then merge commit, safebranch -d, conflict exit code) must live inos-gitobjects, behind one interface.Design:
docs/os-git/use-cases-and-domain.md(design) anddocs/os-git/call-site-checklist.md(call sites). Settled decisions are in design section 1 (docs/os-git/use-cases-and-domain.md): the gem lives inplugins/os-gitwith apath:source;git-contextandos:worktreemerge intoos-git; old wrappers go only after all references are updated; design order is use-cases, objects, interfaces;os-contextandos-vaultbecome Ruby; ticket tracking stays out ofos-git.Reproduce
n/a: structural move. The CLI contract (exit codes 0 to 6 and the output lines) is in
plugins/os/skills/worktree/SKILL.md, ADR-0151, and ADR-0253.Approach
Build
OsGit::Worktree,OsGit::Integration,OsGit::Worktree::Start,OsGit::Worktree::Finish, andOsGit::Worktree::Linksfrom design sections 3 and 4.3, on top of the core objects (#1588).Worktree::Linksholds the cc-os policy (.cc-os/configkeyworktree-symlinks,.sdlc/pipeline.db); the core never names cc-os paths.bin/worktreestays the Thor entry. It mapsIntegration#refusaland errors to exit codes. Keep the contract byte-for-byte: exit codes and output lines.Apply the ADR ruling on Q5 (#1585). If ADR-0240 is superseded, do not port the
worktree-before-removefeature. Keep exit code 6 as "primary checkout dirty".Replace the handoff git helper with
Repository,History, andChangeSet. Keep theHandoff::Worktreerecord value (it is a handoff type, not git). Replace the use ofWorktree.temporaryingate/unchanged_check/base_checkout.rbwithOsGit::Worktree.temporaryin the os-sdlc migration ticket (#1592), not here.Open worktree tickets may be fixed or made obsolete by this port: #849, #1154, #1297, #1306, #982. For each, comment whether the port fixed it. Do not widen the scope to fix them.
Rows to mark in
docs/os-git/call-site-checklist.md: G-001 to G-012 (A-01 and A-02), and the D-01 test rows G-121 to G-143 (replace setup withOsGit::Testing::ScratchRepo).Required work:
OsGit::WorktreeandOsGit::Worktree.temporary— check: presenttemporaryinplugins/os-git/lib/os_git/worktree.rbOsGit::Integrationwith refusal, merge, verify_merged!, bring_up, align — check: presentbring_upinplugins/os-git/lib/os_git/integration.rbOsGit::Worktree::Start,Finish,Links— check: presentLinksinplugins/os-git/lib/os_git/worktree/links.rbplugins/os-git/bin/worktreewith the exit-code contract — check: presentexitinplugins/os-git/bin/worktreeplugins/os/lib/handoff/repository.rbto callOsGit— check: absentOpen3inplugins/os/lib/handoff/repository.rbplugins/os/skills/worktree/SKILL.mdtoplugins/os-git/skills/worktree/SKILL.mdas the/os-git:worktreeskill (noun-first per ADR-0106). The old skill stays until #1605 updates the skills that name it — check: presentworktree startinplugins/os-git/skills/worktree/SKILL.mdpath:source at~/.claude/plugins/os-git; a plugin with no Gemfile requireslib/os_gitfrom that symlink (rulings row 39) — check: presentos_gitinplugins/os-git/os_git.gemspecplugins/os/bin/worktreedelegate to the new CLI, so the command on PATH runsOsGit::Worktree::StartandFinish; the classes inplugins/os/lib/worktree/stop being called and #1607 deletes them — check: presentos-gitinplugins/os/bin/worktreeOsGit::Testing::ScratchRepo(AC 8).Orchestrator work: mark rows G-001 to G-012 and G-121 to G-143 in the checklist (AC 9), and comment on #849, #1154, #1297, #1306, and #982 whether the port fixed each.
Acceptance criteria
worktree finishruns, then it merges, removes the worktree, deletes the branch with-d, and exits 0 with the same output lines as before.worktree finishruns, then it refuses and exits 6.worktree finishruns, then it exits 1 and lists the conflicted files.worktree finishruns, then it refuses with the same exit code as before.worktree startruns, then it refuses and exits 1 (ADR-0253).worktree startruns, then it fast-forwards when it can, and otherwise makes a merge commit, and never rebases.OsGit::Errorat the edge, and no helper returns""for a real failure. Outside a repository and for an unknown commit,available?andcommit_known?still answerfalse(git answered "nothing there"), andpickup_git_limits_testpasses.OsGit::Testing::ScratchRepoand pass.- [x]withReplaced byfilled in, indocs/os-git/call-site-checklist.md.worktreecommand on PATH, when it runs, then it starts no code inplugins/os/lib/worktree/, and every git call it makes goes throughOsGit; the search forOpen3,system(, and backticks inplugins/os-git/lib/os_git/worktreefinds no git call. The non-gitsystemcall inafter_merge.rb(plugin refresh) moves with the policy code.Owner sketch
Non-goals
Deleting
Worktree::Gitor any class inplugins/os/lib/worktree/(the retirement ticket #1607). Fixing #849, #1154, #1297, #1306, #982 beyond a comment.Blocking edges
Blocked by the core ticket (#1588) and the ADR ticket (#1585).
Origin
Work started by the #1610 orchestrator. Branch: ticket-1589. Load rule: gemspec in plugins/os-git; path source and plain require both use ~/.claude/plugins/os-git.
Implementation 244 ended implementation_failed at test-reviewer (verdict:error). The 11 os-git tests passed review and are red. The cause is the pipeline: it records test changes only under the target's test path, so the plugins/os/tests edits for AC 8 were invisible. Occurrence recorded on #1109. The work continues by the hand-finish path: programmer agent, both suites, lint, one design audit, then merge.
Resolution
Done: Worktree start and finish, Integration, and the handoff git calls moved into os-git. The worktree command on PATH delegates to plugins/os-git/bin/worktree. Old classes stay until #1607.
Evidence: main
93706787. os-git 212 runs, os 237 runs, 0 failures; rubocop clean; contract tests run the new edge. Hand-finished after run 244 failed at test-reviewer (root #1109). Design audit: no data-loss defect; side-by-side old and new CLI runs matched. Rulings 56 to 58 (the body says row 39; renumbered at merge). Checklist rows G-001 to G-012 and G-121 to G-143 checked.Follow-ups: #1613 timeout-kill state (ticket-skeptic: no matching ticket). Worktree.temporary NotClean note posted on #1592. #1154, #1297, #1306 remain open and are not fixed by the port (comments posted).