Skip to content

test(e2e): port view-state suite with reload and rehydration coverage (vps2 F6) - #1565

Open
easonLiangWorldedtech wants to merge 345 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2/f6-e2e-viewstate
Open

easonLiangWorldedtech wants to merge 345 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2/f6-e2e-viewstate

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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.

  1. apps/vscode-e2e gains 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.
  2. src/extension/api.ts routes startNewTask through a fresh-tab path instead of reusing the tracked panel, so an API-created tab never evicts the view that is already showing.
  3. src/activate/registerCommands.ts exports the fresh-tab panel creation that path uses.
  4. src/core/webview/ClineProvider.ts carries 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.
  5. The provider-level specs that came with that behaviour pin pruning, retention, profile mutation and multi-instance behaviour.

Scope, measured, with no claim of a single scope. Measured over base...head (dd30249147159dad2d410845527a14a8e55d1463 to a27a614a0141f2e3843c46f431aa1f6ac049d1c0): 46 changed files, 31196 additions, 949 deletions. The commits between base and head number 325, measured with git 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 current main tip 41cf71a72c45fefb69b6be785c4620669f41c1e9 the same head differs in 216 files (31338 insertions, 17064 deletions), because main has moved well past this branch base. The base...head figures above are the ones the out-of-scope assessment reads.

By group: src/core 18, apps 6, packages/types 6, src/extension 5, webview-ui/src 5, src/activate 2, .gitignore 1, src/__tests__ 1, src/eslint-suppressions.json 1, src/package.json 1.

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 are src/core/webview/ClineProvider.ts (profile save and compensation logic) and src/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 read viewStates through 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.ts and packages/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.
  • The 11 carried files above need no end-to-end plan from this unit. That is the argument for moving them, and it is why the scope item below is unchecked.

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 runs node ./out/runTest.js, launching a real extension host. The recorded summary lines are 72 passing (8m) and 5 failing; a second recording of the same run reads 72 passing (9m) and 5 failing, and the wrapper records E2E2 exit=1 elapsed_s=577 at 2026-12-01T14:38:28.6966715+08:00. The author's copy of the log is C:/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 - four execute_command timeouts and one McpError -32000: Connection closed in a use_mcp_tool setup hook - also reproduce at the base dd30249147159dad2d410845527a14a8e55d1463, so they are not introduced here. In CI the arm named e2e-mock is 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:

pnpm --dir apps/vscode-e2e check-types
pnpm --dir apps/vscode-e2e lint
pnpm --dir apps/vscode-e2e test:ci:mock   # mocked models, real extension host - what CI runs
pnpm --dir apps/vscode-e2e test:run       # real models, requires a desktop session

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=0 exits 0 for each of src/activate/registerCommands.ts, src/core/webview/ClineProvider.ts, src/core/webview/__tests__/ClineProvider.sticky-mode.spec.ts and src/core/webview/webviewMessageHandler.ts; that reading was taken on candidate bytes on the author machine, and src/eslint-suppressions.json was 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

  • Scope is one gate scope and matches the unit: 46 files, 11 of them carried, and the scope question above is unanswered.
  • No changeset or changelog change (AGENTS.md).
  • src/eslint-suppressions.json: no suppression count increased.
  • Tests at the lowest layer that would have caught the finding, with the end-to-end layer used only for the reload boundary.
  • Each new behaviour has a row that fails when the behaviour is removed, verified by mutation rather than by inspection.
  • Visual snapshot item considered: not applicable, the suite asserts state and not pixels.
  • Documentation impact answered below: no user-facing documentation change.

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

  • The tracking issue names a stack base that is not an ancestor of this head, so the base commit of this pull request is the one GitHub reports.
  • The review rows this unit answers are named in the commit messages on this branch.

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.

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

Labels

awaiting-author PR is waiting for the author to address requested changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] e2e harness has no view-state isolation suite; webview reload/rehydration untested end-to-end (vps2 F6; upstream #929)

2 participants