Skip to content

Tracking B3a: per-step change cards and per-file/per-step rollback #1401

Open

Description

@easonLiangWorldedtech

Tracking issue for the B3a PR (branch feat/change-cards-rollback-b3a; PR to be opened after review).

Part of the file-write safety series — plan: easonLiangWorldedtech/Zoo-Code#33, epic: #1375. Item: B3a — Per-step change cards + per-file/per-step rollback (extension host). Stacks on the B1 per-write checkpoint PR (#1397) and the B2 change journal PR (#1398); the webview UI for the cards ships separately as B3b.

Scope

  • Change card payload per assistant step (the currentStreamingDidCheckpoint span): summary (filesChanged/added/removed) + per-file entries; the unified diff per file is included only when the new changeCardDetail setting is "full" (default "summary"). The card rides the existing checkpoint_saved say as an additive optional field — no new say/webview types.
  • Per-file rollback: content-only restore of one file from a checkpoint via the shadow git blobs (git show <hash>:<path> + S3 safeWriteText); created-after → delete; never truncates the checkpoint list, never rewinds messages, never cancels the task.
  • Per-step rollback: uses the B2 journal as the step index to restore every file the step touched, one by one.
  • Two new additive webview message cases (checkpointRestoreFile / checkpointRestoreStep) with zod payloads and the existing error-surface pattern; i18n error keys in every locale.
  • changeCardDetail persisted setting, full round trip (packages/types, ClineProvider ×2, SettingsView cachedState payload, i18n label).

Acceptance

  • One card per step (multiple writes aggregate); auto-approved writes get the same card
  • File/step rollback restores the step's own content, touches no other file, and leaves conversation state + task lifecycle untouched (proven by test)
  • changeCardDetail round-trips stored/garbage/unset correctly ("summary" default)
  • CI green (ubuntu unit-test gate), 100% codecov patch coverage

Status

  • PR: to be opened (after B1+B2 review/ship)

Activity

  1. easonLiangWorldedtech commented on Nov 16, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Addendum from lane n20-2237 leg 147 (2026-11-16), for tracking issue #1401 and pull #1411 - compressed 2026-11-27 to one screen under the comment economy. Part 1 of 6. Was 5806 cp; created and last-updated 2026-11-16T17:31:13Z; body digest at supersession 2fc91351826f3604; verbatim original lane-locally at .dsh/workflow/20261122-1551/evidence/relocated/1401-issue-6923957041-v0.md (file digest 0aa119da). Every number in this series is a print from lane s3-1395 leg 502 (tmp-b1-1404/u502-heads, -plan, -piece-rows, -gate-rows, -cover-13-final), not re-priced; the addendum was draft-only.

  2. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Back-pointer for PR #1411 (unit B3a of the checkpoint / change-card series): the PR body was compressed on 2026-11-27 from 44,575 cp to 1,189 cp so a maintainer can read it in one screen. Nothing was lost - the round-by-round record moved to 8 comments on the PR (parts 1-8 of 8, starting at #1411 (comment)), and the verbatim pre-compression body is kept lane-locally at .dsh/workflow/20261122-1551/evidence/relocated/1411-pr-body-v0.md (file digest 2f676491; body digest at supersession 5ac1ba7c35ff719c, head fe6ac4a, updated_before_rewrite 2026-11-26T23:04:17Z).

    The tracking-issue pointer the body used to carry is restored as a comment on the PR (#1411 (comment) is the last record part; the pointer comment is posted in the same batch as this back-pointer). This tracking issue own content was not changed by the compression.

  3. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Tracking issue #1401 addendum, part 2 of 6 (compressed 2026-11-27).

    Footing: git log -1 --format=%P and git merge-base both print 5e32bad for dc1fc69, b730d4a, 0e78660 and 677d558 - parent, fork point and merge base are one commit, so pricing from it measures that head's own change alone. It reproduces CI's printed 468, 778, 675 and 1,065 extension changed executable lines (refusal row absent on the first, printed on the other three; CI verbatim: extension has 778 changed executable lines (limit 500)). The local ref named main is d76dffa, an ancestor of the fork point - pricing from it drags commits in (1,138 for #1410, 1,425 for #1412). Prices are changed executable lines per package bucket; mutation-diff is advisory under ruleset 15494382 Protect Main (required: check-translations, platform-unit-test ubuntu and windows, compile, knip, e2e-mock).

  4. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Tracking issue #1401 addendum, part 3 of 6 (compressed 2026-11-27).

    #1411 splits into four whole-file pieces, no file cut in half, ordered as the caps force - 476 then 199 extension lines, 43 webview, 36 types: piece 1 06013938f is 476 over 119 ranges (changeJournal.ts 192, ApplyPatchTool.ts 166, checkpoints/index.ts 118); piece 2 afe15e833 is 199 over 66 (WriteToFileTool.ts 37, changeCard.ts 28, ApplyDiffTool.ts 26, EditFileTool.ts 23, EditTool.ts 23, SearchReplaceTool.ts 23, Task.ts 22, ShadowCheckpointService.ts 11, ClineProvider.ts 6); piece 3 6dd02b9c6 is 43 over 6 in webview (CheckpointSettings.tsx 35, SettingsView.tsx 6, ExtensionStateContext.tsx 2); piece 4 49fa87972 is 36 over 7 in types (message.ts 21, global-settings.ts 15). No refusal row prints on any of the four; the whole head as one piece prints 675. Sub-10-line entries are listed in the verbatim copy.

  5. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Tracking issue #1401 addendum, part 4 of 6 (compressed 2026-11-27).

    Control counts: piece 1 carries 8 names whose declarations land in a later-merging piece (largest in that run's extension pieces) - EditTool, SearchReplaceTool, Task, buildChangeCardPayload, changeCardDetailSchema, changeCardFileSchema; piece 2 carries 5, piece 3 3, piece 4 0. Wording slip in the source print, corrected here: it calls piece 1's 8 the highest of the run while the #1412 rows print 18 - 18 is larger, so #1412-1 is the weaker piece. Each piece commit still owes a refresh onto the current base branch before it can open as a pull; 0 pushes have happened, so nothing here is on a remote.

  6. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Tracking issue #1401 addendum, part 5 of 6 (compressed 2026-11-27).

    Shared method - authoritative copy for all three addenda. Instrument: strip comments from a piece's added lines, take every identifier, keep those whose declaring file (a top-level export, scanned in the head content of every bucketed changed file) lies in a piece merging later; on the whole head the same scan prints 0 for all four pulls - the calibration row that shows the instrument works - so a piece is mergeable in the printed order and not on its own. Declarations-first (declarations, storage, writers, UI) is the order that bisects; that grouping is unpriced, 0 captures spent on it.

  7. easonLiangWorldedtech commented on Nov 27, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Tracking issue #1401 addendum, part 6 of 6 (compressed 2026-11-27).

    Two instrument facts. (1) On a file that does not parse, eslint --prune-suppressions deletes the manifest key instead of proving the count - at c1a7d1677 the key core/webview/ClineProvider.ts vanished from src/eslint-suppressions.json while three controls (608adfd58, 65c0b1f8a, 11a02d1) print exit 0 with count 7 before and after - so a gate run must read the count before and after and restore that file. (2) c1a7d1677 is red under both instruments (check-types exit 2, ClineProvider.ts(166,2) TS1128 plus a cascade; eslint exit 1, parsing error 166:1): a declaration-closure rung that does not compile is not a reviewability win.

    Arithmetic: ruleset 15494382 requires 1 approving review plus code-owner review per pull, no bypass, and this campaign holds 0 human approvals anywhere (#2236, #2235 and #2227 review lists print 0 APPROVED and 0 human CHANGES_REQUESTED). So 13 pieces means 13 approvals plus 13 CODEOWNER reviews against a base of 0, and 13 fresh pulls means 13 bot review rounds on a bot that already writes 0-byte COMMENTED rows . Both readings belong in the plan and the issue should carry the choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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