os-sdlc: workspace teardown deletes uncommitted/untracked worktree deliverables #263
Labels
No labels
P0
P1
P2
P3
bug
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
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#263
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?
Teardown railguard: refuse destructive teardown on unsaved work [ticket]
Slice
os-sdlc-workspace teardownrefuses to destroy a worktree/branch holding unsaved work — dirty/untracked files outside.sdlc/, or commits unmerged into the main checkout's current branch — unless--forceis passed; the refusal enumerates the at-risk paths/commits.Acceptance criteria
.sdlc/, whenteardown <n>runs without--force, then it exits nonzero, destroys nothing (worktree, branch, and files intact), and lists each at-risk path.teardown <n>runs without--force, then it exits nonzero, destroys nothing, and lists the unmerged commits..sdlc/and a fully merged branch, whenteardown <n>runs, then teardown proceeds exactly as today (archive, worktree remove, branch delete).teardown <n> --forceruns, then teardown proceeds with today's behavior and takes no snapshot..sdlc/, whenteardown <n>runs without--force, then teardown is not blocked (the ADR-0054 archiver owns that content).Non-goals
--force— discarded as speculative hardening; a real force-then-regret incident reopens it.os-sdlc-workspace mergesubcommand (code-owned merge-back) — captured separately as #266.--force).Notes for implementer
TeardownPreflightinplugins/os-sdlc/lib/os_sdlc/, mirroringWorkspacePreflight(setup's guard); wire intoWorkspace#tear_down(workspace.rb:63–67) ahead of archive/remove/delete.git status --porcelainin the worktree filtered to paths outside.sdlc/; unmerged commits viarev-list <main-checkout-current-branch>..sdlc/<n>..sdlc/tickets/only), ADR-0075 (sequencing stays in SKILL.md — this guard is an invariant, not sequencing; do not build a stepper), ADR-0076 (Workspace-only isolation), ADR-0090 (Zeitwerk autoload — no manual requires).skills/implement/SKILL.mdstep 15 with one line noting teardown may refuse and why (prose narrates, CLI enforces).Refine notes
Refined to ticket tier after a grilling session with the maintainer. Decisions made (all resolved in-session — no decision children needed):
os-sdlc-workspace mergesubcommand (code-owned merge-back, closing the remaining freeform tail of implement steps 13–15) is captured separately as #266..sdlc/and unmerged branch commits (the #256 incident was the dirty case; the unmerged case is the same loss one commit later).--force: plain informed override, no snapshot — snapshot judged speculative hardening; a real force-then-regret incident reopens it.worktree add -bfrom current HEAD, worktree.rb:10) and recording one is out of slice.Verified in code:
Workspace#tear_down(workspace.rb:63–67) has no preflight counterpart to setup'sWorkspacePreflight— teardown is unconditionally destructive.Governing ADRs: ADR-0054, ADR-0075, ADR-0076, ADR-0090 (linked in body).
Resolution
Done: TeardownPreflight railguard implemented via os-sdlc pipeline: teardown refuses on dirty/untracked files outside .sdlc/ or unmerged commits, fails closed on git errors; --force routes to tear_down_without_check. All five ACs test-covered.
Evidence: Merged to main in
9e29717(commitc992e27, 7 files, +327/-29); green-assert 609 runs 0 failures, rubocop and ac-lint clean; opus reviewer APPROVE after one REQUEST-CHANGES round (fail-open unmerged check fixed to fail closed); railguard passed on its own teardown of worktree sdlc-263.Follow-ups: #268 (WorkspaceHostSetup refactor); #266 pre-exists for the merge subcommand