feat(webview): change-card rollback message wiring + host types (B3b v2-12, epic #1375) - #55
Open
easonLiangWorldedtech wants to merge 1 commit into
Conversation
Review statusThanks 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. |
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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): thecheckpointRollbackFileandcheckpointRollbackStepcases — each validates its payload against the zod schemas, lazily importssrc/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 mockvscodeminimally from executing editor module-scope code at import time), callsrollbackFile(task, checkpointId, filePath)/rollbackStep(task, filePaths, checkpointId), and posts back acheckpointRollbackResultcorrelated bycardTsso 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 (schemasafeParse).packages/types/src/vscode-extension-host.ts(+53): thecheckpointRollbackFile/checkpointRollbackStepwebview messages + thecheckpointRollbackFilePayloadSchema(cardTs,checkpointId,filePath) /checkpointRollbackStepPayloadSchema(cardTs, optionalcheckpointId,filePathsmin 1) zod schemas and inferred types; thecheckpointRollbackResultextension→webview message + theCheckpointRollbackResultinterface (cardTs, optionalfilePath,success, optionalerror, optional per-filefilesoutcomes).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/rollbackandvscodemocked.Deliberate deviation from the upstream B3b line: the types hunk flipping
changeCardDetailfrom 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 --shortstatvs 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
876fec270is byte-identical to502f8ca98:src/core/webview/webviewMessageHandler.ts(canonical B3b line, L5 head; the +81 wiring hunk originates at B3b L1e0751cb7e, local twin4c16c0017).74a341c26is identical across the local L1/L5 and canonical L1/L5 commits.changeCardDetailflip (see the deviation above).39afe1b15:src/core/checkpoints/rollback.ts= blob508789c95= feat(checkpoints): per-file/per-step rollback core: rollback.ts + changeJournal read-failure semantics (B3c v2-11, epic #1375) #54'srollback.ts— therollbackFile/rollbackStepexports called here exist with matching signatures.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 newenkeys are introduced.Not included here (later v2 PRs)
changeCardstrings) — v2-13.restoreLatestFileAPI + UI — v2-15.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(viapnpm check-types): 11/11 tasks, incl.packages/typesandsrc.packages/types): 28 files, 404 tests passed. Vitest (src/core/webview): 28 files, 490 tests passed (incl. the new rollback spec).--prune-suppressions --max-warnings=0on the touched src files + fullpnpm lintvia the pre-commit hook: clean;src/eslint-suppressions.jsoncounts/content unchanged (content-equal verified, file restored).3e75647dc, headaef395e05): 42 changed-code mutants inwebviewMessageHandler.ts(79 changed lines), 42 Killed, 0 Survived, 0 NoCoverage, 0 timeout; the 12webviewMessageHandler*.spec.tsfiles (11 siblings + the new rollback spec) ran as the test set.