Skip to content

test(webview): ClineProvider parallelMode suite with viewStates pruning edges - #1921

Open
easonLiangWorldedtech wants to merge 275 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2-f2c
Open

easonLiangWorldedtech wants to merge 275 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2-f2c

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What this PR is

F2c of the parallel-mode/view-state series: the test unit. It carries the
ClineProvider.parallelMode.spec.ts suite plus the unit-owned fixes the tests
proved out (independent API tab creation, the MCP hub _disposed guard, the
own-property checks in the view-state re-key, the reset-path durable-clear
isolation, the SkillsManager disposal guard).

Replayed onto the landed F2a head 68f4cf790 (109 non-merge commits from the
old 122-commit chain; the 13 Merge upstream/main commits of that chain are
flattened and their merged content is carried in the net diff). range-diff
between the old chain and the replay: 65 commit rows, 15 identical, 50 adapted,
0 dropped, 0 added. Pushed head a15ce7e72 (73 commits on 68f4cf790).

Landed owns the provider machinery, so the competing shapes came out

F2a/#1919 owns the provider-profile view-state and deletion machinery, so this
unit no longer carries a second design beside it. Rejected in fold (recorded in
the sweep log as competing designs, not as omissions):

  • a static, cross-instance providerProfileMutationQueue (landed owns an
    instance queue),
  • an abortable, queued deletion deleteProviderProfile(profile, signal) with
    innerCompensationRan (landed's deletion path is unqueued and not abortable),
  • a store-read rollback in ContextProxy.updateGlobalState plus a
    writePersistedViewStates helper (landed already implements generation-guarded
    rollback; the helper had no caller).

Also reverted: the draft's temporaryViewStateId field (landed keys the
temporary identity off viewId + wroteUnderTemporaryViewStateId),
modeMutationGeneration / cancelledModeSwitchSnapshot, the duplicated
repointPersistedViewStates copy, the unused includeSelf parameter on the
sibling refresh, and the pinned-profile-with-overlay ordering — that last one
contradicts a landed contract test (should keep the persisted profile name and log when the profile lookup fails), which pins the name even when the lookup
rejects.

Tests follow the settled tree

The unit's tests assert what the settled tree does, not what the draft used to
do. Dropped together with the designs they covered:

  • ClineProvider.spec.ts: the deletion-abort test (stops writing durable state once the deletion's abort signal fires) and the three writePersistedViewStates
    rollback tests.

  • ClineProvider.parallelMode.spec.ts (7 tests, contracts the settled tree does
    not implement):

    • reloads the pinned profile for a view pinned to a different profile
    • refreshes a sibling overlay when the profile is saved without activation
    • refreshes the acting view's own overlay when it saves the pinned profile without activating
    • rolls back every durable write when the per-view pin write fails during an activating upsert
    • restores the profile list and the manager's current profile when an activation is rejected
    • leaves every sibling task on the deleted profile when another sibling's re-pin is rejected
    • surfaces an explicit inconsistent-state error when the compensation itself fails
  • ClineProvider.sticky-mode.spec.ts: the 18 draft-only tests in that file are
    not carried. test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921 is the test unit for this surface, but every one of those 18
    asserts behaviour the draft-side implementation supplied (abort-compensated mode
    switches, temporaryViewStateId authorship tracking, compensating a durable mode
    write after an in-flight abort). The landed unit does not implement them, so the
    coverage is an inherited gap that lives at the implementation-owning unit
    (test(webview): F2a - profile-mutation state semantics and the mode-rollback guard #1919)
    — this PR does not remove coverage that test(webview): F2a - profile-mutation state semantics and the mode-rollback guard #1919 shipped; test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921 does not
    ship tests for behaviour its base does not have.

the 18 draft-only sticky-mode tests (title list)
  • restores the view's own mode pin when a task listener throws after the durable write
  • restores the view mode pin even when the shared-mode rollback write fails
  • compensates the durable mode write and emits nothing when the signal aborts while the write is in flight
  • bails out before any task write when the mutation signal is already aborted
  • rolls back the landed history write and leaves no partial mode state when the signal aborts in flight
  • compensates the durable mode write when the signal aborts after it lands
  • rolls the durable mode write back when a post-write profile lookup rejects
  • restores the shared mode and the acting view's pin separately when the switch is cancelled
  • compensates the durable mode write when the abort lands while the profile lookups are in flight
  • compensates when the abort lands between the durable write and the profile lookups
  • compensates when the abort lands while the activation profile is being read
  • reports an inconsistent state when the cancelled mode switch cannot restore the previous mode
  • does not compensate over a mode that a newer mutation committed
  • keeps the cancellation result when the abort rollback write itself fails
  • preserves fields persisted during the pending window when rolling back the mode
  • proceeds normally when no mutation signal is provided
  • should handle errors during mode switch gracefully
  • rolls the task-history write back when the durable mode write fails

ClineProvider.spec.ts, ClineProvider.sticky-profile.spec.ts and
webviewMessageHandler.spec.ts are back to the landed blobs: every difference
there was either a merge-generated duplicate or a draft assertion about behaviour
the settled tree does not have.

Suppressions

src/eslint-suppressions.json is byte-identical to the landed base blob
29e6919eff14a4eed0b0d7c7b0166097584099db, so restricted to touched files the
delta is zero increases and zero decreases; nothing was suppressed to make
the gate pass. (03b403a8f7 is the pre-rebase draft figure and history only —
the comparison base for the never-increase rule is the new base blob.)

Gates on the settled tree (all against 68f4cf790)

Check Result
pnpm --dir src exec tsc --noEmit --incremental false exit 0, 0 errors
pnpm --dir src exec eslint --max-warnings=0 --no-warn-ignored (every touched src file) exit 0
pnpm --dir webview-ui exec eslint --max-warnings=0 --no-warn-ignored (touched file) exit 0
pnpm --dir packages/types exec eslint --max-warnings=0 --no-warn-ignored (touched file) exit 0
prettier --check on every touched file exit 0, all files match Prettier style
pnpm --dir src exec vitest run core/webview activate --no-file-parallelism --test-timeout=30000 40 files, 1215 tests passed, 0 failed, exit 0
pnpm --dir packages/types exec vitest run src/__tests__/global-settings.test.ts --no-file-parallelism --test-timeout=30000 19/19 passed, exit 0
pnpm --dir webview-ui exec vitest run src/utils/__tests__/vscode.spec.ts --no-file-parallelism --test-timeout=30000 18/18 passed, exit 0
root pnpm run check-types (tsc -p tsconfig.json --noEmit && turbo check-types) exit 0, 11/11 package tasks successful
src/eslint-suppressions.json vs the landed base blob 29e6919e byte-identical: 0 increases, 0 decreases restricted to touched files

Unit delta against the new base: 11 files, +1535/-25 (the pre-rebase draft head 56fadab5f was 17 files, +14,675/-605; the difference is content the landed F2a unit already owns, plus tests for behaviour the settled tree does not implement).

Campaign notes

  • lint-staged did not run for rebase-created commits. git does not run
    pre-commit/prepare-commit-msg for commits created by rebase --continue,
    so the equivalents (eslint --max-warnings=0 --no-warn-ignored on every touched
    file, prettier --write then --check, plus root check-types) were run
    explicitly against the settled tree.
  • .husky/_/pre-push was missing in this worktree. husky regenerates .husky/_
    with its own stub set, and pre-push was not in it while core.hooksPath points
    there — a push from this worktree would have silently skipped root check-types.
    The 39-byte stub was recreated and verified before pushing.
  • Junction pre-flight: src/node_modules is a real directory mirroring the sibling
    worktree's install with @roo-code/types junctioned into this worktree's own
    packages/types (verified with fs.realpathSync and ts.resolveModuleName under
    moduleResolution: Bundler); apps/cli and apps/vscode-e2e node_modules were
    missing and junctioned too, because root check-types runs @roo-code/cli#check-types.
  • Main read: upstream/main first looked like a single squashed commit because the shared
    object store was shallow; after git fetch --depth=400 upstream main the merge-base of
    this unit's base 68f4cf790 and main is 3ee042d91, and main × 68f4cf790 merges clean
    (tree 4081fdbbb), so this PR keeps its base on main with merge order declared in the
    tracking issue instead of being re-derived. Main has since moved to 6bbc7a091 (feat(tools): add dependency-free BM25 ranker #1207).
  • feat(api): abort-signal wiring for lm-studio and qwen-code (round 2) #1309 (abort-signal wiring for lm-studio and qwen-code) is now in main. Checked for
    duplicated content before re-implementing anything: main's ClineProvider.ts carries
    providerProfileMutationQueue and deleteProviderProfile( but none of
    deleteProviderProfileUnlocked, innerCompensationRan, temporaryViewStateId,
    wroteUnderTemporaryViewStateId or writePersistedViewStates, and main's
    registerCommands.ts has none of openClineInNewTabForApi, apiTabPanelCreation,
    createTabPanelUnlocked or the getInstanceForView(tabPanel) recheck, so this unit's
    content is not duplicated by feat(api): abort-signal wiring for lm-studio and qwen-code (round 2) #1309 (its abort work sits in the API-client layer).
  • No .changeset/ files and no CHANGELOG edits (AGENTS.md).

Review-driven fixes on this head

Round 1 - 33f56ca7b: telemetry rebinding (rt4461685303)

rt4461685303 (src/activate/registerCommands.ts:507, Minor · Functional Correctness ·
Quick win) asked to rebind telemetry to the raced tab provider before disposing the new one.
Fixed in 33f56ca7b: TelemetryService.instance.setProvider(racedProvider) now runs before
await tabProvider.dispose(). ClineProvider's constructor had already rebound telemetry to
the provider this call throws away, and BaseTelemetryClient keeps only a WeakRef to
whatever was bound last, so an event captured while that provider is being disposed read its
properties off the instance being thrown away rather than off the tab that was returned.

Pinned by a regression test in src/activate/__tests__/registerCommands.spec.ts that drives
the same raced scenario and captures a Tab Shown event from inside the constructed
provider's teardown — the only window in which the binding can still point at the instance
being disposed — and again after the call returned, asserting both carry the surviving tab's
properties; the mocked @roo-code/telemetry in that spec now mirrors
BaseTelemetryClient.getEventProperties. Control: moving the dispose back ahead of the
rebind reddens that test (the event comes back with taskId: "disposed-tab" instead of
"surviving-tab"), and restoring it gives byte-identical content - git hash-object
d71ff83c0d070bcd2bef754a7c629656faf87d8f, sha256
92004d5fd90834929200126ebe1d384bfe95409e1e77520fec6dc7e7849aa90a.

Gates for 33f56ca7b (all against 68f4cf790): src tsc --noEmit --incremental false
exit 0; hook-form eslint --max-warnings=0 --no-warn-ignored exit 0 in src, webview-ui
and packages/types; prettier --check exit 0; vitest run core/webview activate --no-file-parallelism --test-timeout=30000 = 40 files, 1215 tests, 0 failed; packages/types
19/19; webview-ui 18/18; root check-types 11/11 tasks. src/eslint-suppressions.json is
byte-identical to the landed blob 29e6919e (grand total 3301 unchanged; 0 increases and 0
decreases restricted to touched files - ClineProvider.ts stays at 7
@typescript-eslint/no-explicit-any, SkillsManager.spec.ts at 2, every other touched file
unlisted). Replied in-thread (4475425600); the thread is resolved.

Round 2 - a15ce7e72: the four threads from review 5778294951, and the red required lane

Review 5778294951 (CHANGES_REQUESTED on b0cb66e1b) left four live threads; all four take,
and all four are fixed in one commit with a control each.

  • src/__tests__/extension.spec.ts asserted openClineInNewTab while
    ClineProviderFactory.createInNewTab() has called openClineInNewTabForApi since this
    unit's rename, so the mock never exposed the export production reads. That was not a
    vacuous assertion but a red required lane: platform-unit-test (ubuntu-latest), group
    test:coverage:misc, 1 failed | 2040 passed | 24 skipped on
    extension.ts > injects a factory instance with this activation's dependencies without reading the sidebar tracker, the same case already red at b0cb66e1b (1 failed | 2039
    passed), which is why test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921 went from 7/7 to a red required lane before this push. Control
    with only the assertion retargeted and the mock left alone: 23/24, failing on
    No "openClineInNewTabForApi" export is defined on the "../activate/registerCommands"
    mock; mock and references retargeted together so the test drives the export production
    calls: 24/24. The full src suite joins the per-round gate set from here on.
  • settingsButtonClicked, historyButtonClicked and marketplaceButtonClicked posted
    without checking isViewLaunched. All three are also on the command palette, and
    postMessageToWebview returns without sending while the view is unset, so a palette
    invocation did nothing and wrote no log. All three now await waitForSidebarView -
    plusButtonClicked's existing sequence (focus the pane, await whenViewResolved()) lifted
    to module scope, which plusButtonClicked itself now calls rather than a fourth shape. One
    test per handler: view unresolved, command invoked, nothing posted and nothing logged before
    the gate releases, actions delivered in order after it, plus the
    [<prefix>] postMessageToWebview failed: entry so a failed post cannot stay silent either.
    Control: dropping the await from the three handlers reddens exactly those three tests (67/70
    with the settled tree at 70/70).
  • SkillsManager.spec.ts asserted createWatcher call history after the finally block's
    mockReset() had cleared it. The assertions now run inside the try, before the reset, and
    the test also asserts the observable - watchers is empty - alongside the undisposed filter.
    Control: with initialization creating (and disposing) a watcher by hand the fixed test
    reddens at 94/95 (expected [ { ...(4) } ] to have a length of +0 but got 1) while the
    pre-fix body stayed green at 95/95.
  • registerCommands.spec.ts leaked its per-test stubs because this file's beforeEach uses
    vi.clearAllMocks(), which clears call history but leaves implementations installed. The
    MdmService.getInstance stub is now mockReturnValueOnce, and each ContextProxy gate
    returns once per creation it has to serve (two where the test starts an ordinary and a forced
    creation, one where only one creation reaches the proxy). Control: a probe asserting that the
    next tab creation sees the automocked default again fails with the persistent stub
    (expected { name: 'mock-mdm' } to be undefined, 70/71) and passes with the one-shot stub
    (71/71). Their two corrections hold: the :1113 assertion is not caused by that stub, and the
    ContextProxy gates are isolation hygiene rather than evidence for an order-dependent
    result.

Gates for a15ce7e72 (all against 68f4cf790): src tsc --noEmit --incremental false exit
0; full src vitest run 12556/12644, the 51 local failures confined to specs byte-identical
to the landed base (built dist assets, pwsh/bash shells, swift tree-sitter, symlinked rule
dirs - CI reports those groups green); vitest run core/webview activate = 40 files, 1218
tests, 0 failed; packages/types 19/19; webview-ui 18/18; hook-form eslint --max-warnings=0 --no-warn-ignored exit 0 over the 10 touched src files and both package
lanes; eslint --prune-suppressions leaves src/eslint-suppressions.json byte-identical to
the landed blob 29e6919e - grand total 3301 before and after, 0 increases and 0 decreases
restricted to touched files (ClineProvider.ts 7 @typescript-eslint/no-explicit-any,
SkillsManager.spec.ts 2, every other touched file unlisted); prettier --check exit 0; root
check-types 11/11 tasks with zoo-code:check-types executed on this tree (cache bypass, force executing 4ae11f004a4acab5, Cached: 0 cached, 11 total) rather than read from cache.

Two stale line: null rows from review 5760938067 were answered once and resolved: the
empty-group observation is carried at src/activate/registerCommands.ts:503-505 with the raced
branch now at :514-527 (behaviour unchanged, path untouched by this round), and the
rename/selection observation is superseded by the activation-with-rollback shape at
src/core/webview/webviewMessageHandler.ts:2703-2727 in content this unit inherits
byte-identically from 68f4cf790. All six threads are resolved with in-thread replies. The two
reds on the pushed head are not this unit's: webview-visual records the same
WelcomeViewProvider.visual.tsx high-contrast-light contrast failure (contrast.ts:198) that
main's own merge-queue run recorded at 6bbc7a0 (job 126965861148), on vps2-f2a at c2206c5
and on fws/u8-diffview at e36a779, and mutation-diff fails the aggregate size gate (2138
changed executable lines against a 500 limit) exactly as it did at b0cb66e1b (2132).

Round-4 rows closed at 5cbdcf1

5cbdcf17e (parent 48198939b, branch vps2-f2c) closes the ten open round-4 CodeRabbit
rows (root comments 4475848261-4475848350): eight files, +747/-53, no .changeset, no CHANGELOG
edit, src/eslint-suppressions.json byte-identical to HEAD. Every row is answered in-thread and
resolved; no review was requested and no @coderabbitai mention was added.

The Major row (sibling re-pin ordering): the surviving profile task-handler rebuild is deferred
until every sibling re-pin has resolved, a sibling whose re-pin rejected has its pin and overlay
restored and is left out of the rebuild, and the rollback is split per surface so a failed pin
restore no longer hides a failed task restore (restoreFailures feeds the thrown aggregate).
New test: does not rebuild the healthy sibling's task handler when another sibling's re-pin fails (ClineProvider.spec.ts:7393).

The deletion now runs inside the write group it was written around: public
deleteProviderProfile hands the whole body to enqueueProviderProfileMutation
(ClineProvider.ts:3583-3591) over the unchanged private deleteProviderProfileUnlocked, taking
the queue to five call sites (2815 mode switch, 3290 saveProviderProfile, 3320
updateProfileModel, 3590 deletion, 4136 activation). Re-entrancy was counted rather than
assumed: inside the deletion body and the re-pin helper there are 0 occurrences of each of
activateProviderProfile, handleModeSwitch, saveProviderProfile, renameProviderProfile,
updateProfileModel, persistProviderProfile, deleteProviderProfile and
enqueueProviderProfileMutation, so the deletion never takes the queue twice.
lets an activation that starts mid-deletion run after the deletion settles
(ClineProvider.spec.ts:5748) parks the deletion in deleteConfig, starts an activation,
releases it, and asserts the resulting selection, pin, persisted list and cleared view overlay;
with the wrapper replaced by a direct deleteProviderProfileUnlocked call it fails
expected 'keeper-profile' to be 'other-profile'. The concurrent-upsert test now orders
save:new-profile after save:doomed-profile - the deletion own restore write, filtered by
profile name - and reddens expected 0 to be greater than 1 under the same unqueued control.

Mode switch: updateTaskHistory lands the mode before the TaskModeSwitched emit, the second
catch restores in write order (history entry mode, task["_taskMode"],
setValue("mode", ...)), and the announcement moved out of the persistence try so a listener
failure cannot undo a mode the switch kept. Two new tests (ClineProvider.sticky-mode.spec.ts:566
listener-throw history mode, :626 pin survives a profile-tail failure) accompany the
strengthened existing test, whose updateTaskHistory double now applies the write instead of
swallowing it. The two toBeUndefined pin assertions in the emit-throw test are stated for what
they are: no pin write happens on that path, so they cannot fail. Measured rather than argued -
swapping the persist/buffer order gives Tests 31 passed (31), while skipping the mode in the
durable write, or in the view-local buffer, gives Tests 4 failed | 27 passed (31) each, which
is what the new pin test reddens against.

deleteApiConfiguration falls back to the UI-facing listApiConfigMeta entry when the stored
record is already gone (webviewMessageHandler.ts:2814-2819), so a stale selector entry goes
through the idempotent prune instead of being undeletable from the UI. A second test pins the
other side of the fallback: a name in neither list stays a no-op - no deleteProviderProfile
call, no manager write, and only the existing errors.delete_api_config toast, which was kept
rather than silenced because a click naming a profile that is in neither store means the webview
state is already stale. The reset/owner-token row is recorded as a thread whose premise our merge
invalidated rather than a fix: main per-key owner tokens replaced the generation map and
previousCachedValue restore the row describes, and ContextProxy.spec.ts:161 now pins the
mechanism that is actually on the head.

Merge integrity check over every spec file that differs from the merged main commit
e943530c8: 15 files carry main-side test titles, 839 distinct titles, 832 survive verbatim. The
seven that do not are each accounted for. Main
creates diagnostics from all provider instances without requiring a visible provider was dropped
by our own merge resolution and is re-adopted at registerCommands.spec.ts:258 (control-checked:
replacing providers: ClineProvider.getAllInstances() with providers: [] turns it red). Four
others in the same file are the click-origin rework renaming an existing case rather than losing
it: ... when no sidebar panel is active is carried as ... when no sidebar panel is tracked and
... on the visible provider as ... on the registered sidebar provider, while the two
no-visible-provider cases are carried by getVisibleProviderOrLog logging and returning undefined
plus the tab-instance no-ops for settingsButtonClickedInTab and
focusInput ... without a live tab instance - the visible-instance lookup those tests asserted
about no longer exists in the handlers. timed-out mutations abort before writing state and advance the queue describes abort-on-timeout semantics that 200365600 replaced with
run-to-completion, carried by timed-out activations run to completion and hold the queue,
holds the next profile mutation until a timed-out model update settles, finishes activation after the caller timed out instead of leaving a saved but ... and an activation that times out while queued behind another never starts. Main generic
should handle errors during mode switch gracefully was specialised by 68f4cf790 into the
listener-throw, profile-tail and save-failure cases above.

Gates on this head: tsc -p tsconfig.json --noEmit exit 0; plain eslint --max-warnings=0 --no-warn-ignored exit 0 on every touched file; prettier --check . exit 0; the full src suite
reports Test Files 2 failed | 566 passed | 3 skipped (571) and Tests 45 failed | 12805 passed | 37 skipped (12887), where all 45 are environmental here: 40 in
__tests__/dist_assets.spec.ts, which asserts built dist/*.wasm assets exist and this worktree
has no dist/, and 5 in services/rules/__tests__/rules.spec.ts symlink cases failing
EPERM: operation not permitted, symlink ... under this Windows sandbox - the same 40 + 5 as at
48198939b. CI on the pushed head: 44 check runs success, 1 skipped, 9 still running, and
mutation-diff red exactly as it was on 48198939b (run 127045035952 here,
127015126885 there, same aggregate-size gate; its log surfaces only
Process completed with exit code 1. as an annotation, so no line count is quoted from it here).

Round-5 rows closed at 5163cd3

5163cd3e9 (parent 5cbdcf17e, branch vps2-f2c) closes three of the four rows in the newest
CodeRabbit pass (root comments 4476213569, 4476213576, 4476213623): 22 files, +94/-33, no
.changeset, no CHANGELOG edit, src/eslint-suppressions.json byte-identical. Each row is answered
in-thread and resolved; no review was requested and no @coderabbitai mention was added.

The deletion-activation warning took its text from the error class, so it was the one notification in
webviewMessageHandler that a non-English user saw in English. It now reads
t("common:warnings.profile_deleted_activation_failed", { name: error.replacementProfileName })
(webviewMessageHandler.ts:2852-2856), and the key is present in all 18
src/i18n/locales/*/common.json warnings blocks with the profile name interpolated. Each locale got a
translation rather than English pasted into every file, and ja wraps the name in the corner brackets
its own bundle already uses. The error class keeps its own message for the log line above, where the
cause text belongs. The bundle wording deliberately differs from the class sentence: an assertion that
expected that sentence verbatim would also have passed for a handler that never asked i18n. Reverting the
handler to error.message measures Tests 1 failed | 186 passed (187); at this head
webviewMessageHandler.spec.ts is Tests 187 passed (187) and locale-bundles.spec.ts - which already pinned
the error key this unit adds - is Tests 18 passed (18), with the added warning key pinned alongside it.

The rename rollback's ordering assertion compared an index into deleteConfig.mock.calls with an index
into saveConfig.mock.calls: deleteOldCall is 0 and restoreOldCall is 1 in every run of this flow whatever
the real order is, so 1 > 0 could not report the regression its own comment names. It now compares the
two mocks' shared invocation clock, with both indices asserted to exist first. Measured: moving the
rollback's saveConfig(oldName, previousRecord) ahead of the rename's deleteConfig(oldName) - the ordering
being claimed - fails with expected 716 to be greater than 717 at that assertion; at the landed order the
suite is Tests 187 passed (187).

The overlapping-write cases in ContextProxy.globalStateRestore.spec.ts ran the same scenario twice: the
fixture rejected both writes at once, so both rejection handlers ran in creation order and the
B settles first case never exercised B-before-A. The memento double now parks each update until the case
rejects it, and expect(pending.map((p) => p.value)).toEqual(["a", "b"]) pins which parked write is which before
either rejects. The split was measured on the design this guard replaced (each rejection restoring the
cache value that write found, as the generation map did): there A rejects first fails
expected 'a' to be 'X' while B rejects first stays green, so a guard that broke only for the B-before-A
interleaving can no longer pass both. At this head both cases pass - Tests 5 passed (5) - because the
older write leaves the cache alone and the owner reads the value back from the store.

The fourth row (4476213612, a failed sibling state post aborting resetState) is measured and
deliberately not fixed here. The sibling loop at ClineProvider.ts:6177 awaits
instance.postStateToWebview() with no guard, so the reset does stop there: a test that parks a sibling's
post on a rejection and then asserts that resetState() resolves and that resetAllConfigs,
resetCustomModes and removeClineFromStack all ran measures Tests 1 failed | 497 skipped (498) with
promise rejected "Error: webview is gone" instead of resolving on this head, and Tests 1 passed with a
nine-line guard mirroring the one broadcastResetToAllInstances already uses. That is a behaviour change in
the reset path #1562 and #1565 inherit, so it is held for review rather than landed unilaterally, and
the thread is left open.

Gates on this head: tsc -p tsconfig.json --noEmit exit 0; plain eslint --max-warnings=0 --no-warn-ignored
exit 0 on every touched file; prettier --check exit 0 across the touched sources and all 18 locale
bundles; ContextProxy.globalStateRestore.spec.ts 5 passed, webviewMessageHandler.spec.ts 187 passed,
locale-bundles.spec.ts 18 passed. Full src suite on this head: Test Files 2 failed | 566 passed | 3 skipped (571) and Tests 45 failed | 12805 passed | 37 skipped (12887) - the same 40 dist_assets.spec.ts
cases (no dist/ built locally) and 5 rules.spec.ts EPERM ... symlink cases as the previous head, both
outside this diff. CI at the pushed commit: 25 check runs, 15 success, 6 in progress, 3 queued, and
mutation-diff red on the aggregate-size gate it has been red on since b0cb66e1b (run 127051480319). No
.changeset, no CHANGELOG edit, no review request, no @coderabbitai mention.

Round 6 (gate-threads)

Two commits since 5163cd3e9.

a691f24c9 (test-only) answers the last two open rows. Both were the same weak spot - the expected text was built with t(...), so nothing pinned what the handler handed to i18n, and nothing pinned what the bundle handed back. The delete-api-config test now asserts expect(t).toHaveBeenCalledWith("common:warnings.profile_deleted_activation_failed", { name: "keeper-profile" }) before it asserts the warning message; pointing the handler at the deleted profile instead of error.replacementProfileName reddens exactly that test (1 failed | 186 skipped (187)). The locale bundle spec now requires each warning this unit adds to be a nonempty string containing {{name}}; dropping the placeholder from the en bundle reddens en defines every key this unit adds (1 failed | 17 passed (18)), and as shipped all 18 bundles carry it (read bundle by bundle). Row 4476213612 (the unguarded sibling postStateToWebview in resetState) was fixed on the parent as 42b4b6f9a and arrives with the merge below. All CodeRabbit rows on this PR are now answered and resolved.

ec26cc118 rebuilds the parent merge from the finished parent head: git merge --no-ff vps2-f2a from base 1c1ac88b71, bringing the parent's eight commits, including 2b7a41d58, a fix that exists only on the parent. That fix closes a measured hole: every guard by which deleteProviderProfile decides what the shared provider-settings store owes the selection keys off something re-pointing at the survivor, while all views share one ContextProxy, so a sibling can move the shared selection onto a survivor and carry the name alone - the store then goes on carrying the deleted profile's settings under the survivor's name, which is what every view without an overlay of its own serves. Its regression test fires the sibling's selection-only write from inside the deletion's first durable write, and reverting only the production hunks reddens exactly that test.

Residual the merge adds to this branch: 4 files, +260/-1 (ClineProvider.ts +67, ClineProvider.spec.ts +138, webviewMessageHandler.spec.ts +51, webviewMessageHandler.ts +4). src/activate/__tests__/registerCommands.spec.ts, src/core/config/__tests__/ContextProxy.globalStateRestore.spec.ts and src/eslint-suppressions.json are byte-identical to 5163cd3e9 - the ports on the parent rows that this branch already carried deduped byte-for-byte.

Gates on the merged tree: tsc --noEmit 0 errors; eslint --max-warnings=0 --no-warn-ignored clean on every touched file; prettier --check clean. Focused specs 807 passed across six files (ClineProvider 499, webviewMessageHandler 188, activate/registerCommands 71, ContextProxy.globalStateRestore 5, ClineProvider.sticky-profile 26, locale-bundles 18). Full suite: Tests 45 failed | 12808 passed | 37 skipped (12890) in 92.73s against 45 failed | 12805 passed | 37 skipped (12887) on 5163cd3e9 before the merge - one test added, no new failure. The 45 are the pre-existing environmental classes: 40 in __tests__/dist_assets.spec.ts (no built dist/ in the worktree) and 5 in services/rules/__tests__/rules.spec.ts (Windows symlinks).


Round 6 addendum (gate-threads)

The merge in the section above was built from 2b7a41d58. The parent head then moved: row 4477073508 on the parent (tab-panel survivor tracking) was verified valid and landed there as bc729fcc9, so the local merge was discarded and rebuilt fresh from the finished parent head - git merge --no-commit --no-ff vps2-f2a from base 1c1ac88b71 - giving merge commit e8b2ac051 (parents a691f24c9, bc729fcc9).

Measured on the rebuilt merged tree: tsc 0 errors, eslint --max-warnings=0 --no-warn-ignored clean, prettier --check clean, focused specs 880 passed across ten files, full suite Tests 45 failed | 12814 passed | 37 skipped (12896) in 104.63s against 45 failed | 12805 passed | 37 skipped (12887) on 5163cd3e9 - nine tests added, no new failure; all 45 are the environmental classes (40 dist_assets, 5 rules symlinks). Dedupe re-verified by blob identity: eslint-suppressions.json is 69b08043de on every ref and in the merged tree, ContextProxy.globalStateRestore.spec.ts is da408dcfc5 on all four (byte-for-byte dedupe), and registerCommands.spec.ts gained exactly the parent's 229 new tab-panel test lines and nothing else against a691f24c9, so the port this branch already carried was not duplicated. The merged ClineProvider.spec.ts is byte-identical to the parent's (e4b09a205e).

Correction to the section above: the merge commit there is e8b2ac051, not ec26cc118 - the earlier artifact was thrown away rather than amended, exactly as the stack rules require when the parent head moves.

Round 7 addendum (head be39ce4)

This head is a fresh merge of the finished parent (vps2-f2a at 4719931e4); the previous merge commit e8b2ac051 was discarded rather than amended, and the resolution was taken from that merge's resolved text so content already ported from the parent was not duplicated (verified per file by blob hash: git rev-parse ":<file>" against git rev-parse <rev>:<file>). The tree differs from the discarded merge by exactly the parent head's delta - 5 files, +249/-45 against the parent's +248/-46, per-file counts matching; the single-line difference is a prettier re-wrap in the merged copy of registerCommands.spec.ts.

Two review rows were answered here. registerCommands.ts:477 is satisfied by the parent fix carried in this merge. registerCommands.ts:413 is answered rather than fixed: on the parent the factory still calls openClineInNewTab with forceNew: true, so the branch is the production path there; on this head the unit moved that caller to openClineInNewTabForApi, which makes the wrapper's option unreachable from production - but createTabPanelUnlocked still consumes the flag from the API entry point, and three of this unit's own cases (gives each overlapping forced call its own provider and the two slot-occupancy cases around a forced call arriving mid-flight) drive it through the wrapper and are the only coverage of the rule that a forced call must not evict an ordinary in-flight creation. Removing it is a rewrite of this unit's own commits, not something to smuggle through a merge rebuild, so the row is left open for the stack owner.

Gates on this head: tsc clean, eslint clean with src/eslint-suppressions.json unchanged, prettier --check clean, hooks (lint-staged, pre-push check-types) ran on both pushes. Focused: registerCommands.spec.ts 78, ClineProvider.spec.ts 500, ClineProvider.sticky-profile.spec.ts 26. Full suite 45 failed | 12816 passed | 37 skipped - 40 __tests__/dist_assets.spec.ts (no built dist) + 5 services/rules/__tests__/rules.spec.ts (Windows symlinks), same environmental classes as the base; src/core/task/Task.spec.ts is a known inter-run flake and did not fail in this run.

Related issues

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 has-conflicts PR has merge conflicts with the base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants