Repository navigation
test(e2e): port view-state suite with reload and rehydration coverage (vps2 F6) - #1565
Open
easonLiangWorldedtech wants to merge 345 commits into
Open
easonLiangWorldedtech wants to merge 345 commits into
easonLiangWorldedtech wants to merge 345 commits into
Conversation
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.
The automated end-to-end harness had no suite for per-view state: a webview reload or a rehydration could hand one view another view's state, and nothing automated would have noticed.
It is unit F6 of the view-state series, stacked on the unit whose tip is the base commit of this pull request; the chain is tracked on #1991.
Related GitHub Issue
Closes: #1564 (the harness gap: no view-state isolation suite, reload and rehydration untested end to end).
Refs: #1991 (chain tracking) and #1375 (epic). Neither is a closing reference: the maintainer closes them when the series lands.
Description
What this unit does.
apps/vscode-e2egains a view-state suite: a debug-mode fixture entry, fixture wiring that registers the view-state plans, model-agnostic predicates over per-task markers, and plans that reload a webview and rehydrate a second view and assert that neither inherits the other's state.src/extension/api.tsroutesstartNewTaskthrough a fresh-tab path instead of reusing the tracked panel, so an API-created tab never evicts the view that is already showing.src/activate/registerCommands.tsexports the fresh-tab panel creation that path uses.src/core/webview/ClineProvider.tscarries the reviewed production behaviour the suite exercises: the mutation-marker load-merge, per-view durable state, and the profile-deletion re-point with its compensation.Scope, measured, with no claim of a single scope. Measured over
base...head(dd30249147159dad2d410845527a14a8e55d1463toa27a614a0141f2e3843c46f431aa1f6ac049d1c0): 46 changed files, 31196 additions, 949 deletions. The commits between base and head number 325, measured withgit rev-list --count <base>..<head>run locally against those two commits; the pull-request commits field reads 325 as well at the time of writing, so the two agree. Calibers differ and both are named here so a reader is not misled: against the currentmaintip41cf71a72c45fefb69b6be785c4620669f41c1e9the same head differs in 216 files (31338insertions,17064deletions), becausemainhas moved well past this branch base. Thebase...headfigures above are the ones the out-of-scope assessment reads.By group:
src/core18,apps6,packages/types6,src/extension5,webview-ui/src5,src/activate2,.gitignore1,src/__tests__1,src/eslint-suppressions.json1,src/package.json1.Carried files. 11 of the 46 files are carried content this unit does not exercise:
src/package.json,packages/types/src/vscode.ts,packages/types/src/vscode-extension-host.ts,packages/types/src/global-settings.ts,src/core/config/importExport.ts,src/core/config/__tests__/importExport.spec.ts,webview-ui/src/utils/vscode.ts,webview-ui/src/utils/__tests__/vscode.spec.ts,webview-ui/src/i18n/__tests__/TranslationContext.locale-loading.spec.tsx,.gitignore,src/core/config/ContextProxy.ts. They are on this branch because it is stacked on the not-yet-merged units that introduced them, not because #1564 asked for them. A maintainer decision on whether each belongs to #1564 was requested and, as of 2026-12-01T10:48:08.296Z, no answer is recorded on this pull request or on #1564. If the answer is no, each one moves to the pull request that owns it. The two production files the out-of-scope review names for that decision aresrc/core/webview/ClineProvider.ts(profile save and compensation logic) andsrc/extension/api.ts.Each production file and the end-to-end plan that requires it. Line coordinates are omitted on purpose: this head has moved twice since the first mapping was measured, and a stale coordinate is worse than none.
src/core/webview/ClineProvider.ts-> the view-state plans that reload a webview and rehydrate a second view, and the mode-isolation plan; the provider specs for pruning, retention and profile mutation are its unit-layer counterpart.src/extension/api.ts-> the plans that start a task from the API and then read the state of the view that was already open.src/activate/registerCommands.ts-> the extension plan that asserts every contributed command is registered.src/core/config/ContextProxy.ts-> the reload plans, which readviewStatesthrough the singleton the suite is testing. Its profile-key migration is on the carried list above.src/core/tools/SwitchModeTool.ts,src/core/task/Task.ts,src/core/webview/webviewMessageHandler.tsandpackages/types/src/api.ts-> the mode and task plans that drive a mode switch or a task and then read per-view state; the type-level entry only needs the plans to compile.src/package.json-> the extension plan, because the enumerated command set it asserts comes from that manifest. It is also on the carried list: it carries commands this unit does not introduce.Test evidence, stated once. The suite ran against a real extension host on the author machine through the repository's mocked-model path:
pnpm --dir apps/vscode-e2e run test:ci:mock, which type-checks the suite and then runsnode ./out/runTest.js, launching a real extension host. The recorded summary lines are72 passing (8m)and5 failing; a second recording of the same run reads72 passing (9m)and5 failing, and the wrapper recordsE2E2 exit=1 elapsed_s=577 at 2026-12-01T14:38:28.6966715+08:00. The author's copy of the log isC:/work/Zoo-Code-fork/.tmp-1411-rebase/scratch/1565o-measL-e2e_testrun.log; that log does not record a branch head, so the head for the run comes from the implementing teammate's record and not from the log. All five failures - fourexecute_commandtimeouts and oneMcpError -32000: Connection closedin ause_mcp_toolsetup hook - also reproduce at the basedd30249147159dad2d410845527a14a8e55d1463, so they are not introduced here. In CI the arm namede2e-mockis e2e-mock completed/success@2026-12-01T09:51:24Z. No run against real model endpoints has been performed.Implementation approach, and the points a reviewer should weigh. The suite pins per-task markers rather than reading a model name, so a plan means the same thing when the configured model changes. Per-view state is asserted at two layers: the durable record keyed by view id, and the live buffer of the provider instance that owns it. Those layers are read directly rather than through the webview message pump, because the failure mode is a reload handing one view the other's record. The deletion path re-points a view that pinned a profile being deleted, keeps a per-writer claim so a rollback cannot overwrite a newer selection, and restores only the entries its own write moved. Two reviewer rows stay open on that mechanism: one asks that the prior claim travel with each re-point so a later failed deletion restores the earlier owner instead of recording itself; the other asks what happens to a view that closed before the re-point. The candidate for both is written and measured on the author machine and is not committed at this head, so this body does not claim it is here.
Trade-offs. Holding a deletion to a single writer token means a rollback cannot undo a selection the user made after the deletion started; that is the intended guard, and a row keeps a view on what it chose inside the compensation window. The other cost is size: the provider spec file is large because every construction site had to learn the per-view record, and the suite adds a real-host run to the queue.
Test Procedure
Commands a reviewer can run:
Gates measured on the head bytes by the implementing teammate: format check, root lint, root type check, source lint, source type check, Code QA, translations, knip, knip-production, knip policy, MCP integration, lifecycle model check, mutation channel, the misc suite and the core suite - each exits 0. Per-file lint with suppression pruning and
--max-warnings=0exits 0 for each ofsrc/activate/registerCommands.ts,src/core/webview/ClineProvider.ts,src/core/webview/__tests__/ClineProvider.sticky-mode.spec.tsandsrc/core/webview/webviewMessageHandler.ts; that reading was taken on candidate bytes on the author machine, andsrc/eslint-suppressions.jsonwas restored to its committed content after the pruning run. Two honesty notes: unguarded suite runs show a known intermittent class where a worker exits with a teardown error after every assertion has passed, and the format check warns about a gitignored generated icon map this unit does not touch. Environment: Windows, the unit layer plus the mocked-model end-to-end path locally and in CI.Pre-Submission Checklist
src/eslint-suppressions.json: no suppression count increased.Visual Snapshots
Not applicable. The suite drives the real webview but asserts state transitions and persisted values, not rendering.
Videos (interaction / animation only)
Not applicable.
Documentation Updates
No user-facing documentation change: no setting was added and no message type changed shape. The commands a reviewer needs are listed above.
Additional Notes
Get in Touch
Reviewer and maintainer questions are welcome as comments on this pull request or on #1991. This account has no Discord handle to list here, so the contact line says so instead of inventing one.