Repository navigation
Commit a639813
committed
fix(webview): drop the unloadable dispose write and gate the mode mapping rollback
Review threads 2 and 3 on #1550.
Thread 2. A provider disposed while a pre-registration change is still held used to flush it
under its own session-local id. loadViewState refuses to attribute a temporary-id entry to any
view (ClineProvider.ts:1144), so nothing can read that record back, while the write stamped
updatedAt and prunePersistedViewStates (1044) sorts newest-first and slices
MAX_PERSISTED_VIEW_STATES (326): the unloadable entry outranks loadable ones at eviction. The
condition for removing it was measured: nothing at launch drops temporary-id entries -
nextViewId is declared at 325 and consumed at 587 and nothing else recognises the shape, so
setViewStateId and loadViewState only decline to read such an entry, clearPersistedViewState
deletes its own id, and the tombstone drain touches bookkeeping only. Teardown now drops the
held change (1671) and the forceUnregisteredWrite option goes with the only caller that used
it. The method comment above savePersistedViewState already named this exact cost as the reason
pre-registration writes are held back; the dispose path was putting the same kind of entry into
the same map.
Tests: the one that asserted the flush lands is replaced by one asserting the held change is
dropped and nothing reaches storage; the one whose subject was a teardown flush that fails is
deleted, because that failure no longer exists. Control: against the previous ClineProvider the
replacement test fails with "expected { 'sidebar-293': { ...(2) } } to deeply equal {}" - the
unloadable entry landing - and the suite otherwise stays green at 472 of 474.
Thread 3. The profile-activation compensation restored the mode mapping whenever the mode had
been captured, and the sibling snapshot (3424) is awaited before the mapping write is issued, so
a failure there replayed a restore for a write that never started and cleared the current mode's
mapping on an upsert that never reached it. The rollback is now gated on and replayed from a
record created at the moment the mapping write is issued (3435, gate at 3508), so it names the
mode the write targeted and only runs if that write ran. The captured pairing itself was not the
defect: the previous activationMode had a single assignment, and both the write and the restore
read the same value.
Tests: the pre-issue case fails on the previous code, where setModeConfig was called once when
it should not have been called at all. Two more pin the captured pairing across a mid-window
change - the mode set to another mode after the capture, and the shared mode cleared after it -
which pass unchanged today; their control is a rollback that reads the live mode instead of the
record, and it reddens them together with the existing activation-rollback test. The rollback was
already tested (ClineProvider.spec.ts:6623 asserts the mapping returns to its prior id, and 6948
does the same again); what was untested was a failure before the write is issued and a mode
change inside the window.
The sibling-snapshot step named here shares its helper family with sharedStoreCarriesProfileRecord,
which gate-threads landed on vps2-f2a at 2b7a41d and merged into vps2-f2c at e8b2ac0. This
branch does not carry that predicate and this commit does not add a third version of it.
Lanes: ClineProvider.spec.ts 474 passed (baseline at 375e255 was 472), webviewMessageHandler
174 passed, sticky-profile 25, sticky-mode 29. eslint --max-warnings=0 exits 0 on both files and
eslint-suppressions.json is unchanged at 3298 total; tsc -p tsconfig.json --noEmit exits 0.1 parent 09a0313 commit a639813
2 files changed
Lines changed: 171 additions & 82 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
796 | 796 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
| 797 | + | |
801 | 798 | | |
802 | 799 | | |
803 | 800 | | |
804 | 801 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
810 | 808 | | |
811 | 809 | | |
812 | 810 | | |
| |||
1665 | 1663 | | |
1666 | 1664 | | |
1667 | 1665 | | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
1672 | | - | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
1686 | | - | |
1687 | | - | |
1688 | | - | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
1689 | 1672 | | |
1690 | 1673 | | |
1691 | 1674 | | |
| |||
3416 | 3399 | | |
3417 | 3400 | | |
3418 | 3401 | | |
3419 | | - | |
3420 | | - | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
3421 | 3407 | | |
3422 | 3408 | | |
3423 | 3409 | | |
3424 | | - | |
3425 | 3410 | | |
3426 | 3411 | | |
3427 | 3412 | | |
| |||
3438 | 3423 | | |
3439 | 3424 | | |
3440 | 3425 | | |
| 3426 | + | |
3441 | 3427 | | |
3442 | 3428 | | |
3443 | 3429 | | |
3444 | 3430 | | |
3445 | 3431 | | |
3446 | 3432 | | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
3447 | 3436 | | |
3448 | 3437 | | |
3449 | 3438 | | |
| |||
3516 | 3505 | | |
3517 | 3506 | | |
3518 | 3507 | | |
3519 | | - | |
| 3508 | + | |
3520 | 3509 | | |
3521 | | - | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
3522 | 3514 | | |
3523 | 3515 | | |
3524 | | - | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
3525 | 3519 | | |
3526 | 3520 | | |
3527 | 3521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4835 | 4835 | | |
4836 | 4836 | | |
4837 | 4837 | | |
4838 | | - | |
| 4838 | + | |
4839 | 4839 | | |
4840 | 4840 | | |
4841 | 4841 | | |
| |||
4846 | 4846 | | |
4847 | 4847 | | |
4848 | 4848 | | |
4849 | | - | |
4850 | | - | |
4851 | | - | |
4852 | | - | |
4853 | | - | |
4854 | | - | |
4855 | | - | |
4856 | | - | |
4857 | | - | |
4858 | | - | |
4859 | | - | |
4860 | | - | |
4861 | | - | |
4862 | | - | |
4863 | | - | |
4864 | | - | |
4865 | | - | |
4866 | | - | |
4867 | | - | |
4868 | | - | |
4869 | | - | |
4870 | | - | |
4871 | | - | |
4872 | | - | |
4873 | | - | |
4874 | | - | |
4875 | | - | |
4876 | | - | |
4877 | | - | |
4878 | | - | |
4879 | | - | |
4880 | 4849 | | |
4881 | 4850 | | |
4882 | 4851 | | |
4883 | 4852 | | |
4884 | 4853 | | |
4885 | 4854 | | |
4886 | | - | |
4887 | | - | |
4888 | | - | |
4889 | | - | |
4890 | | - | |
4891 | | - | |
4892 | | - | |
4893 | | - | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
| 4859 | + | |
4894 | 4860 | | |
4895 | | - | |
4896 | | - | |
| 4861 | + | |
| 4862 | + | |
4897 | 4863 | | |
4898 | 4864 | | |
4899 | 4865 | | |
| |||
6650 | 6616 | | |
6651 | 6617 | | |
6652 | 6618 | | |
| 6619 | + | |
| 6620 | + | |
| 6621 | + | |
| 6622 | + | |
| 6623 | + | |
| 6624 | + | |
| 6625 | + | |
| 6626 | + | |
| 6627 | + | |
| 6628 | + | |
| 6629 | + | |
| 6630 | + | |
| 6631 | + | |
| 6632 | + | |
| 6633 | + | |
| 6634 | + | |
| 6635 | + | |
| 6636 | + | |
| 6637 | + | |
| 6638 | + | |
| 6639 | + | |
| 6640 | + | |
| 6641 | + | |
| 6642 | + | |
| 6643 | + | |
| 6644 | + | |
| 6645 | + | |
| 6646 | + | |
| 6647 | + | |
| 6648 | + | |
| 6649 | + | |
| 6650 | + | |
| 6651 | + | |
| 6652 | + | |
| 6653 | + | |
| 6654 | + | |
| 6655 | + | |
| 6656 | + | |
| 6657 | + | |
| 6658 | + | |
| 6659 | + | |
| 6660 | + | |
| 6661 | + | |
| 6662 | + | |
| 6663 | + | |
| 6664 | + | |
| 6665 | + | |
| 6666 | + | |
| 6667 | + | |
| 6668 | + | |
| 6669 | + | |
| 6670 | + | |
| 6671 | + | |
| 6672 | + | |
| 6673 | + | |
| 6674 | + | |
| 6675 | + | |
| 6676 | + | |
| 6677 | + | |
| 6678 | + | |
| 6679 | + | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + | |
| 6683 | + | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
| 6694 | + | |
| 6695 | + | |
| 6696 | + | |
| 6697 | + | |
| 6698 | + | |
| 6699 | + | |
| 6700 | + | |
| 6701 | + | |
| 6702 | + | |
| 6703 | + | |
| 6704 | + | |
| 6705 | + | |
| 6706 | + | |
| 6707 | + | |
| 6708 | + | |
| 6709 | + | |
| 6710 | + | |
| 6711 | + | |
| 6712 | + | |
| 6713 | + | |
| 6714 | + | |
| 6715 | + | |
| 6716 | + | |
| 6717 | + | |
| 6718 | + | |
| 6719 | + | |
| 6720 | + | |
| 6721 | + | |
| 6722 | + | |
| 6723 | + | |
| 6724 | + | |
| 6725 | + | |
| 6726 | + | |
| 6727 | + | |
| 6728 | + | |
| 6729 | + | |
| 6730 | + | |
| 6731 | + | |
| 6732 | + | |
| 6733 | + | |
| 6734 | + | |
| 6735 | + | |
| 6736 | + | |
| 6737 | + | |
| 6738 | + | |
| 6739 | + | |
| 6740 | + | |
| 6741 | + | |
| 6742 | + | |
| 6743 | + | |
| 6744 | + | |
| 6745 | + | |
| 6746 | + | |
| 6747 | + | |
6653 | 6748 | | |
6654 | 6749 | | |
6655 | 6750 | | |
| |||
0 commit comments