You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rollback replays prior settings into sibling overlays even when the record restore is skipped #2494
Found while answering review thread 4609481469 on PR #1560, and verified in the file before agreeing to it.
Amendment, provenance and a sibling-site note only: one authored change applied in two writes, 06:34:35Z and 06:34:45Z, the second adding only the blank line between the lead-in sentence and its three bullets that the first collapsed. The claim, the three bullets and the interim option paragraph below are byte-for-byte unchanged.
The line numbers below were read on branch vps2/f3-mode-profile-writes at head 57b766b. src/extension/api.ts is byte-identical between b75156d, the head this issue was filed against, and that head - the diff for that file between the two is empty - so the anchors are valid for both. The same numbers in the sibling lane name unrelated code, which is why the head is named.
The setConfiguration compensation decides three things separately:
the profile record restore is conditional: api.ts line 797 runs it only while recordStillOurs holds, line 810 logs leaving the record alone when the store could not be re-read, and line 814 logs skipping the restore when the store no longer holds this call's write.
the shared mode and pin restore at lines 833 to 836 is unconditional.
the sibling overlay replay at lines 849 to 853 is unconditional and passes previousSettings ?? {}.
So when the record restore is skipped because a later write owns the record, the overlays pinned to that profile are still set to the prior settings while the record keeps the newer content that caused the skip. The overlays then describe a snapshot the record has moved past, and the next postStateToWebview or task creation on those views pairs a current name with superseded settings.
This is the same weakness as step 2 of issue #2488 seen from the overlay side: a comparison on values cannot tell this compensation's write from a later identical one, so it cannot tell whether the replay still owns the overlay it is writing. The durable close is the record-level write revision, not an extra comparison here.
Not changed on PR #1560: this head's production change is the mode-vs-settings supersession in loadViewState, and adding a second production change here would reopen the compare-and-set contract answers that PR has already published. A minimal interim option, if one is wanted before step 2, is to gate the overlay replay on recordStillOurs so a skipped restore does not overwrite sibling overlays with a stale snapshot.
Counterpart in the sibling branch, recorded here so a maintainer does not have to rediscover it: in wt-fix1562 at 7c7556b the same unconditional sibling replay sits at src/extension/api.ts lines 1011 to 1015, and its record restore is guarded differently - inside manager.runExclusiveAcrossInstances at 900, comparing the stored record against savedSettings at 907 to 909, with the rollback replay filtered to writtenKeys at 960 to 962 under the comment that begins at 955 - so the weakness is one class with two shapes, and the durable close is still step 2 of issue #2488. recordStillOurs does not occur in that file at that head; it occurs twice in this lane's file.
Activity