Skip to content

enhancement(checkpoints): change-card rollback now restores pre-step state; add per-file restore-latest (B3c/B3b, epic #1375) #1435

Description

@easonLiangWorldedtech

Observed during the change-card UI/UX review of the file-write-safety series (epic #1375) while verifying the B3c rollback flow against the acceptance criteria.

What was wrong

The change-card rollback button restored a file to the checkpoint the card was keyed by - i.e. the step's own post-write checkpoint. For the most recent step that is a no-op: the card would say "Rolled back" while the file kept exactly the content the agent just wrote. That contradicts the epic acceptance criteria ("the user can always see and undo what the agent did"; "roll back per step or per file") and the card's own confirm copy ("Restores the previous content").

There was also no forward direction: once a user (or a later step) moved past a step's content, the UI offered no way to bring a file back to its most recent recorded version.

What changed

  1. Rollback now means "undo this step's write" (pre-step semantics). The restore target is resolved from the B2 change journal: the file's immediately preceding journal entry's checkpoint (the state it had before the step). For a first-ever change of the file, the task-start baseline is used - undoing a created file deletes it again, undoing a deleted file restores it.
  2. Per-file "Restore latest version". A new forward-direction control on every change-card file row restores the file to its most recent recorded write checkpoint. A task that never wrote the file is a clean no-op (still reported as success).
  3. UI polish from the same review. The per-file rollback confirmation now shows the same warning text as the step confirmation, the copy now says what actually happens, and the 18 locales were updated.

Affected PRs

Context

  • Epic: [EPIC] File Write Safety Prevent Concurrent Write Races Data Corruption #1375 (file-write-safety series).
  • Rollback still does not move the shadow-git HEAD or truncate the checkpoint list; it only writes file content from an existing commit.
  • Result correlation: per-file results carry kind "rollback" (absent, the legacy shape) or "restore-latest" so the two controls never cross-talk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions