feat(webview): checkpointRestoreLatestFile message type and handler (B3b v2-15a, epic #1375) - #59
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 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
B3b v2-15a (epic Zoo-Code-Org#1375): the
checkpointRestoreLatestFilewebview→extension message — the per-file restore-latest contract and handler. Stacked onfeat/fws-v2-14-change-card-l5(baseb1110b454). 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):CheckpointRollbackResultgainskind?: "rollback" | "restore-latest"(per-file results route to the control that requested them) andnoOp?: boolean(a restore-latest that found no recorded write), plus a doc rewrite of thecheckpointRollbackResultextension→webview message;checkpointRestoreLatestFileadded to theWebviewMessageunion withcheckpointRestoreLatestFilePayloadSchema({ cardTs: z.number(), filePath: z.string() }).src/core/webview/webviewMessageHandler.ts(+44): thecheckpointRestoreLatestFilecase —safeParsethe payload, resolve the current task, lazilyimport("../checkpoints/rollback")and callrestoreLatestFile(task, filePath), then post acheckpointRollbackResultwithkind: "restore-latest", thenoOpflag, and a conditionalerror. With no active task it postssuccess: falseanderror: "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 newdescribe("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
restoreLatestFileservice already exists locally since v2-12 (PR #55), so this PR adds only the message contract, handler, and tests.webviewMessageHandler.tsandwebviewMessageHandler.rollback.spec.tsbyte-identical to upstream v2-15 (7a1d4e61b4c1).vscode-extension-host.ts: exactly one 1-line delta vs upstream — the documented v2-9 divergence: local keepschangeCardDetail?: ChangeCardDetailoptional (upstream made it required). Upstream v2-15'skind/noOpadditions 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-types11/11viteston the rollback spec: 11/11 (4 new tests)srcpackage--prune-suppressions --max-warnings=0and thepackages/typesbase invocation), prettier clean