Repository navigation
Commit 4bf26f1
committed
test(webview): prove the shared-profile rollback from cold state, where there is nothing to restore
CodeRabbit's review of head 0a0e043 (review 5855663461, submitted 2026-11-11T08:07:51Z) posted
one actionable row, 4535433710 at
src/core/webview/__tests__/ClineProvider.persistedViewState.spec.ts:445, asking for a cold-state case:
stored profile unset, first per-view write fails, assert setValues rejects, the shared profile stays
unset, and no per-view entry is created. The test already at that line seeds a stored profile
(currentApiConfigName is seeded to "test-config" in beforeEach) and asserts the rollback returns to
it, so it proves the restore but not the shape where the previous value does not exist. That is this
repository's own rule - include the unset case when a default could hide the omission - so it is
fixed here rather than argued.
The key is unset through provider.contextProxy.setValue rather than by poking the storage double, so
the proxy cache and storage agree the key is unset before the call starts, and the unset state is
asserted before the failing call instead of assumed. Three outcomes are then asserted: rejection, the
shared key still unset, and no entry under this view's id in the durable map, with the tombstone set
still empty because nothing was ever cleared from storage.
It passes against the shipped code, so no production change is claimed: the rollback path restores an
undefined previous value instead of leaving the shared store ahead of the durable record. What this
commit does not cover is still the neighbouring case named in the previous commit message - a shared
value written by someone else after this view took its snapshot.
Legs: focused run pnpm --dir src exec vitest run --config vitest.core.config.ts
core/webview/__tests__/ClineProvider.persistedViewState.spec.ts -> 14 passed (14). eslint
--prune-suppressions --max-warnings=0 on this file exits 0 and adds no entry to
src/eslint-suppressions.json. tsc --noEmit for src exits 0. prettier --check . from the repository
root is clean and --write on this file reported it unchanged: CI's compile leg runs pnpm format:check,
so a root-directory prettier check is a pre-push leg for a commit that touches a file, which this one
is. The core lane was not re-run for a single added test on top of the 199-file run recorded at
0a0e043; this commit touches only this spec.
Still 6 of 500 for packages/types and 491 of 500 for src with 0 advisories above merge base
53cb5b5, re-measured rather than assumed: packageForPath excludes
*.spec.ts, so a test file costs nothing against the cap, and ClineProvider.ts is untouched here.1 parent 0a0e043 commit 4bf26f1
1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
456 | 477 | | |
0 commit comments