Skip to content

B3c — per-file and per-step rollback service (file-write-safety series #1375) #1409

Open

Description

@easonLiangWorldedtech

Part of the file-write-safety series (#1375).

B3c — per-file and per-step rollback service (extension host).

Planned scope:

  • rollbackFile(checkpointId, filePath) — restore a single file from a checkpoint via the shadow-git restore path (ShadowCheckpointService.restoreFile: single-file git checkout -- ; delete the file when it did not exist at the checkpoint).
  • rollbackStep(stepCheckpointIds, files?) — restore every file a step touched, resolving the step's files from the B2 change journal (changes.jsonl); with a step checkpoint id, files absent from that checkpoint's journal entries fail explicitly.
  • Webview UI (the rollback buttons) ships separately in B3b (tracking Tracking B3b: change cards webview UI and rollback buttons #1402).

This PR exists because the combined B3a scope (cards + setting + rollback) exceeded the series' 1000-line diff cap, so the rollback service split out as a stacked sub-PR (cards + setting ship first as B3a, tracking #1401).

PR: #1410

Activity

  1. easonLiangWorldedtech commented on Nov 16, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Addendum from lane n20-2237, leg 147, 2026-11-16, for tracking issue 1409 and its pull #1410.
    Draft only, nothing here posted, and every number is a print lane s3-1395 made in its leg 502
    from.tmp-b1-1404/u502-heads.json, u502-plan.json, u502-piece-rows.txt, u502-gate-rows.txt and
    u502-cover-13-final.txt, which I read at 0 doors and did not re-price.
    Footing, in the first line because it is the difference between a number a maintainer can
    reproduce and one they cannot: git log -1 --format=%P and git merge-base both print
    5e32bad for each of dc1fc69,
    b730d4a, 0e78660 and
    677d558, so parent, fork point and merge base are one commit
    and pricing from it measures that head's own change alone. That footing reproduces what CI
    printed: 468, 778, 675 and 1065 extension changed executable lines, with the refusal row
    absent on the first and printed on the other three under both classifier blobs, verbatim
    extension has 778 changed executable lines (limit 500). Split the PR or obtain a
    maintainer-reviewed narrow exclusion. The local ref named main is
    d76dffa, an ancestor of the fork point, and pricing from it
    drags other commits in, to 1,138 for 1410 and 1,425 for 1412. Prices are changed executable
    lines per package bucket and mutation-diff is advisory under ruleset 15494382 Protect Main,
    which names only check-translations, platform-unit-test ubuntu-latest and windows-latest,
    compile, knip and e2e-mock.

    #1410 splits into four whole-file pieces: 468 then 310 extension lines, with 43 webview and 36
    types. Piece 1, 1e99ab6b8a4db91acac91cdfa39a4ff5dfee6cff, is 468 over 115 ranges,
    changeJournal.ts 192, ApplyPatchTool.ts 160 and checkpoints/index.ts 116. Piece 2,
    240a2d2bc61231066afeb3a3732f2c72028497f7, is 310 over 123, rollback.ts 113,
    ShadowCheckpointService.ts 81, WriteToFileTool.ts 37, changeCard.ts 28, EditFileTool.ts 23,
    Task.ts 22 and ClineProvider.ts 6. Piece 3, 17c8296e34457f64005f75d1b3371c9c0853d3e9, is 43
    over 6 in webview, CheckpointSettings.tsx 35, SettingsView.tsx 6, ExtensionStateContext.tsx 2.
    Piece 4, 455266dc37effd491dc9d8143c2a468a17c4603c, is 36 over 7 in types, message.ts 21 and
    global-settings.ts 15. No refusal row prints on any piece and the whole head as one piece
    prints 778. The largest single-file price in the extension bucket is 192 at
    src/core/checkpoints/changeJournal.ts, so no carve is forced and the census prints 0 of 43
    files touched by more than one commit.

    Control counts: piece 1 carries 2 names, Task and buildChangeCardPayload, whose declarations
    land in a later piece; piece 2 carries 6, all declared in packages/types; piece 3 carries 3;
    piece 4 carries 0. The types piece is the one that closes the others and it is printed last,
    which is the right order for the caps and the wrong one for a reader who bisects.
    The control instrument, so the piece rows can be read. 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 that merges later. Run on
    the whole head the same scan prints 0 for all four pulls, which is the calibration row that
    shows the instrument works. So a piece is mergeable in the printed order and not on its own.
    The declarations close every head as printed, which is the wrong order for a reader who
    bisects: declarations, storage, writers, then UI is the order that bisects, and that flipped
    grouping is unpriced, 0 captures spent on it. Each piece commit also still owes the refresh
    onto the current base branch before it can open as a pull request, and 0 pushes have happened,
    so nothing here is on a remote.
    Two instrument facts. On a file that does not parse, eslint --prune-suppressions deletes the
    manifest key instead of proving the count: src/eslint-suppressions.json went from 30,788 B with
    key core/webview/ClineProvider.ts holding count 7 to 33,054 B with that key absent at
    c1a7d167756300f26a99e8f2f0ee7ab06adeab51, so a gate run must read the count before and after
    and restore with git checkout HEAD -- src/eslint-suppressions.json; the controls
    608adfd58fc2b847d57a8284dbf607f15fa52b95 and 65c0b1f8af5ecfdf085481a1193cf24ed61cabfc and
    11a02d1 print exit 0 with count 7 before and 7 after, and the
    30,788 to 33,163 byte change there is prune rewriting key order and not a count change. And
    c1a7d1677563 is red under both instruments, check-types exit 2 with
    ClineProvider.ts(166,2): error TS1128: Declaration or statement expected. plus a cascade and
    eslint exit 1 with a parsing error at 166:1, so a declaration-closure rung that does not
    compile is not a reviewability win. Note also that the src package's check-types script is
    plain tsc --noEmit, so a --dir src run prints no Tasks:, Cached: or Time: row at all.
    The arithmetic in front of you rather than smoothed. Ruleset 15494382 requires
    required_approving_review_count 1 and require_code_owner_review true per pull with
    current_user_can_bypass never, and this campaign holds 0 human approvals anywhere: complete
    review lists on #2236, #2235 and #2227 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, 21 of 22 on
    #2443. 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