Check that the os-doc-hygiene reset --hard rollback cannot lose user work #1609
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#1609
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-doc-hygiene/skills/clean/SKILL.md(lines 443, 603-604, 697-698) rolls back withgit reset --hard $BASELINEafter a WIP checkpoint commit. If a path exists where the user's uncommitted work was not in the checkpoint, the work stays only in the reflog.cc-plugins/client-management/skills/migrate-client/workflows/migrate-project.mdrolls back the same way with a tag. This is row G-114 and open item Q-2 indocs/os-git/call-site-checklist.md. It does not depend onos-git.Reproduce
n/a: investigation. Build a scratch repository with uncommitted work, run the checkpoint and rollback steps as the skill text says, and see which user changes survive.
Approach
Trace each rollback path in the skill text. List every state in which
reset --harddiscards a change that no commit holds. Then give one of two results: the skill text needs a guard (for example, a clean-tree check before the checkpoint, or a restore of only the touched paths), or the paths are safe, with the evidence. Design Q2 recommends not offeringreset --hardin v1 ofos-gitand restoring only touched paths (restore --source=<checkpoint> -- <paths>) when the plugin is ported. This ticket decides what to do with the current skill text.Required work: none beyond the acceptance criteria.
Acceptance criteria
migrate-project.mdtag rollback, when the ticket closes, then it records the result for that file as well.- [x]with the outcome indocs/os-git/call-site-checklist.md.Non-goals
Moving the rollback into
os-git. ACheckpointobject is deferred (design section 3.2).Origin
Work started by the #1610 orchestrator, session 5b14a4ef-91b2-45c0-a729-baa17682a39a. Branch: ticket-1609.
Findings for #1609 (commit
5807c183on branch ticket-1609). Scratch repos: /tmp/claude-1000/-home-jared-dev-cc-os/5b14a4ef-91b2-45c0-a729-baa17682a39a/scratchpad/rollback-1609clean/SKILL.md, old text: UNSAFE on a dirty tree. Checkpoint =
add -A+ commit, thenBASELINE=HEAD~1, thenreset --hard $BASELINE.Clean-tree path (BASELINE=HEAD): mid-run tracked edits are lost, nowhere; mid-run untracked and ignored files survive.
Fix (SKILL.md): BASELINE is the checkpoint commit. Added
touched.pathsandrollback_to_baseline(restore --source=BASELINE for touched paths; remove paths created by the skill). All fourreset --hardsites now call it.add -Astays in the checkpoint (Q1 rider not part of this guard).Replay of the new text: tracked, staged, untracked, ignored, and mid-run edits to untouched files all survive; touched docs revert; the created archive file is removed. Limit: a user edit made mid-run to a path the skill also touched is overwritten.
cc-plugins migrate-project.md (not edited): Phase 0 says STOP on a dirty tree (an instruction only; no check).
git tagat HEAD, thenreset --hard tag. Replay: clean start loses the migration commit (reflog), mid-run tracked edits (nowhere), and staged new files; unstaged untracked and ignored files survive. A dirty start loses tracked edits to the tag state. Unsafe in the same class.Follow-ups: file a cc-plugins ticket for migrate-project.md; add a test for the rollback function.
Resolution
Done: Traced the clean/SKILL.md rollback and the migrate-project.md tag rollback by replay. clean/SKILL.md was unsafe; it now restores only touched paths from the checkpoint. G-114 and Q-2 marked.
Evidence:
5807c183. Scratch replay of the new text: tracked, staged, untracked, ignored, and mid-run edits to untouched files survive; touched docs revert; created archive removed. Findings comment on this ticket. Known limit: a mid-run user edit to a path the skill also touched is overwritten.Follow-ups: migrate-project.md finding sent to #1600 (row G-120). Rollback-function test dropped: the bash lives in SKILL.md text, and Q2 moves rollback into Ruby at the os-doc-hygiene port.