Skip to content

feat(webview): checkpointRestoreLatestFile message type and handler (B3b v2-15a, epic #1375) - #59

Open
easonLiangWorldedtech wants to merge 1 commit into
feat/fws-v2-14-change-card-l5from
feat/fws-v2-15-restore-latest-api
Open

easonLiangWorldedtech wants to merge 1 commit into
feat/fws-v2-14-change-card-l5from
feat/fws-v2-15-restore-latest-api

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

What

B3b v2-15a (epic Zoo-Code-Org#1375): the checkpointRestoreLatestFile webview→extension message — the per-file restore-latest contract and handler. Stacked on feat/fws-v2-14-change-card-l5 (base b1110b454). Split from the 492-line v2-15 source increment (7a1d4e61b4c1, upstream PR Zoo-Code-Org#1412) because it exceeds the 400-line soft budget; this PR is the API half (+167/−6, 173 shortstat lines).

  • packages/types/src/vscode-extension-host.ts (+27/−5): CheckpointRollbackResult gains kind?: "rollback" | "restore-latest" (per-file results route to the control that requested them) and noOp?: boolean (a restore-latest that found no recorded write), plus a doc rewrite of the checkpointRollbackResult extension→webview message; checkpointRestoreLatestFile added to the WebviewMessage union with checkpointRestoreLatestFilePayloadSchema ({ cardTs: z.number(), filePath: z.string() }).
  • src/core/webview/webviewMessageHandler.ts (+44): the checkpointRestoreLatestFile case — safeParse the payload, resolve the current task, lazily import("../checkpoints/rollback") and call restoreLatestFile(task, filePath), then post a checkpointRollbackResult with kind: "restore-latest", the noOp flag, and a conditional error. With no active task it posts success: false and error: "No active task to restore from." so the card can leave its pending state.
  • src/core/webview/__tests__/webviewMessageHandler.rollback.spec.ts (+96/−1): a new describe("checkpointRestoreLatestFile") block with 4 tests — success outcome, the no-op flag surfaces, the error outcome, and the correlated no-task failure.

Base-parity decisions

The restoreLatestFile service already exists locally since v2-12 (PR #55), so this PR adds only the message contract, handler, and tests.

  • webviewMessageHandler.ts and webviewMessageHandler.rollback.spec.ts byte-identical to upstream v2-15 (7a1d4e61b4c1).
  • vscode-extension-host.ts: exactly one 1-line delta vs upstream — the documented v2-9 divergence: local keeps changeCardDetail?: ChangeCardDetail optional (upstream made it required). Upstream v2-15's kind/noOp additions land on top of that line unchanged.

Stryker (local diff gate, base b1110b454)

43 changed-code lines → 23 valid mutants: 23 Killed, 0 Survived, 0 NoCoverage, 0 timeout (extension lane; head 5ec15d56f). First run green — no new directives.

Gates

  • pnpm check-types 11/11
  • vitest on the rollback spec: 11/11 (4 new tests)
  • eslint 0 (src package --prune-suppressions --max-warnings=0 and the packages/types base invocation), prettier clean
  • diff budget: 3 files, +167/−6 (173 shortstat lines) < 400 soft cap — API half of the v2-15 split (the UI half follows as a stacked PR at 397 lines)

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Required CI passed. Waiting for automated review of the latest commit.

If automated review does not start, a maintainer must restart it.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

This branch has not been deployed

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

Labels

awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants