Skip to content

feat(webview): change-card rollback message wiring + host types (B3b v2-12, epic #1375) - #55

Open
easonLiangWorldedtech wants to merge 1 commit into
feat/fws-v2-11-rollback-corefrom
feat/fws-v2-12-rollback-wiring
Open

feat(webview): change-card rollback message wiring + host types (B3b v2-12, epic #1375)#55
easonLiangWorldedtech wants to merge 1 commit into
feat/fws-v2-11-rollback-corefrom
feat/fws-v2-12-rollback-wiring

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

What this PR does

The webview ↔ extension-host wiring half of the change-card rollback feature (B3b, epic Zoo-Code-Org#1375), stacked on #54 (v2-11, the rollback core this PR calls):

  • src/core/webview/webviewMessageHandler.ts (+81): the checkpointRollbackFile and checkpointRollbackStep cases — each validates its payload against the zod schemas, lazily imports src/core/checkpoints/rollback (the rollback module pulls the checkpoint service and the editor integrations into the import graph; loading it only on demand keeps specs that mock vscode minimally from executing editor module-scope code at import time), calls rollbackFile(task, checkpointId, filePath) / rollbackStep(task, filePaths, checkpointId), and posts back a checkpointRollbackResult correlated by cardTs so the requesting card resolves its pending state. With no active task, the correlated failure is still posted (No active task to roll back from.) instead of leaving the card waiting on a result that will never arrive. Malformed payloads are ignored (schema safeParse).
  • packages/types/src/vscode-extension-host.ts (+53): the checkpointRollbackFile / checkpointRollbackStep webview messages + the checkpointRollbackFilePayloadSchema (cardTs, checkpointId, filePath) / checkpointRollbackStepPayloadSchema (cardTs, optional checkpointId, filePaths min 1) zod schemas and inferred types; the checkpointRollbackResult extension→webview message + the CheckpointRollbackResult interface (cardTs, optional filePath, success, optional error, optional per-file files outcomes).
  • src/core/webview/__tests__/webviewMessageHandler.rollback.spec.ts (new, 206 lines): provider-double tests for both cases — success and per-file failure correlation, the no-task correlated failure, and malformed-payload ignores — with ../../checkpoints/rollback and vscode mocked.

Deliberate deviation from the upstream B3b line: the types hunk flipping changeCardDetail from optional to required is NOT ported — this stack ships the setting as optional (changeCardDetail?: ChangeCardDetail // Optional: webview context default ships with the settings UI unit) with the settings UI unit (v2-9), so the optional form is kept.

Line count / split rationale

340 added lines across 3 files (git diff --shortstat vs the #54 head) — under the 400 soft design target. One atomic wiring seam (types + handler + its spec): splitting types off the handler would leave both halves non-compiling, and the mutation gate requires the killing tests for the handler's diff lines (the new rollback spec) to land in the same PR.

Provenance

  • The committed handler blob 876fec270 is byte-identical to 502f8ca98:src/core/webview/webviewMessageHandler.ts (canonical B3b line, L5 head; the +81 wiring hunk originates at B3b L1 e0751cb7e, local twin 4c16c0017).
  • The spec blob 74a341c26 is identical across the local L1/L5 and canonical L1/L5 commits.
  • Types = the B3b L1 net (+53) minus the changeCardDetail flip (see the deviation above).
  • API compatibility: 39afe1b15:src/core/checkpoints/rollback.ts = blob 508789c95 = feat(checkpoints): per-file/per-step rollback core: rollback.ts + changeJournal read-failure semantics (B3c v2-11, epic #1375) #54's rollback.ts — the rollbackFile / rollbackStep exports called here exist with matching signatures.
  • No locale keys added: the only new user-visible string (No active task to roll back from.) is the card-facing diagnostic identical to the upstream B3b handler; CI translation parity (check-translations) is untouched because no new en keys are introduced.

Not included here (later v2 PRs)

  • Change-cards UI core (ChangeCard component + spec + ChatRow + the 18-locale changeCard strings) — v2-13.
  • B3b L2/L3/L4/L5 fixes (open-in-editor, native button, typed checkbox, CP/CP.spec/SV.spec) — v2-14.
  • restoreLatestFile API + UI — v2-15.
  • B-line reviewer-comment fixes — v2-16.

Supersession note: #54's "Not included here" promised UI+wiring as v2-12, restore-latest/a11y as v2-13, CR fixes as v2-14, and i18n as v2-15. Re-scoped because the settings UI already landed in v2-9 and the CI translation-parity gate requires new locale keys to ride with the unit that introduces them (i18n is no longer a standalone unit). This PR is the wiring only.

Local gates

  • tsc --noEmit (via pnpm check-types): 11/11 tasks, incl. packages/types and src.
  • Vitest (packages/types): 28 files, 404 tests passed. Vitest (src/core/webview): 28 files, 490 tests passed (incl. the new rollback spec).
  • ESLint --prune-suppressions --max-warnings=0 on the touched src files + full pnpm lint via the pre-commit hook: clean; src/eslint-suppressions.json counts/content unchanged (content-equal verified, file restored).
  • Prettier: all 3 files content-clean under the repo config (tabs, width 120, no semis).
  • Stryker diff gate (base = feat(checkpoints): per-file/per-step rollback core: rollback.ts + changeJournal read-failure semantics (B3c v2-11, epic #1375) #54 head 3e75647dc, head aef395e05): 42 changed-code mutants in webviewMessageHandler.ts (79 changed lines), 42 Killed, 0 Survived, 0 NoCoverage, 0 timeout; the 12 webviewMessageHandler*.spec.ts files (11 siblings + the new rollback spec) ran as the test set.

@easonLiangWorldedtech easonLiangWorldedtech added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Sep 6, 2026
@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.

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