Rollback replays prior settings into sibling overlays even when the record restore is skipped

未關閉
#2,494 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 3 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
28/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
backend

研究方向

Start in src/extension/api.ts at the setConfiguration compensation: record restore guarded by recordStillOurs (797/810/814), unconditional shared mode/pin restore (833-836), and unconditional sibling overlay replay using previousSettings ?? {} (849-853). Read that compensation path and issue #2488 step 2 before changing code; the minimal interim is to gate the overlay replay on recordStillOurs. Done means a skipped record restore no longer writes prior settings onto sibling overlays, covered by a test for the later-write-wins scenario.

由索引模型根據 Issue 內容生成。

描述

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 57b766b2f4977b6988b263efd81963680b050b9b. src/extension/api.ts is byte-identical between b75156dcd0, 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 7c7556b18b 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.

主要語言
TypeScript
星號
2k
分支
301
平均合併
3 天 14 小時
30 天內合併 PR
103

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Zoo-Code-Org/Zoo-Code 的其他 Issue

查看 Zoo-Code-Org/Zoo-Code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。