loadViewState commits nothing when the selection moves during the reapplied lookup and back
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- frontend
Direzione di ricerca
Start in src/core/webview/ClineProvider.ts at loadViewState, reading the snapshot at lines 1162-1165 alongside the live re-read and discard at lines 1196-1205. Follow the five-step sequence in the issue and compare it with the discard semantics documented on PR #1560. The outcome is a maintainer decision on whether a superseded re-resolve should fall back to the persisted record or continue to commit nothing, not an implementation for a first-time contributor.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Filed as a design question with a named outcome. The current behaviour is defensible and this issue is not a claim that it is wrong.
Where
src/core/webview/ClineProvider.ts, loadViewState, on head 57b766b2f4977b6988b263efd81963680b050b9b:
- the selection the re-resolve is keyed to is snapshotted at lines 1162 to 1165 (
selectionBeforeReapply:currentApiConfigNameandapiConfigurationonly), - the reapplied profile name is derived at lines 1166 to 1172, which requires the name to have moved inside the load window and the settings object reference not to have moved,
- the reapplied lookup and its supersession re-read live at lines 1174 to 1212: the comparison is at 1196 to 1201, the discard log at 1202 to 1204, and the
returnat 1205 leavesmergedStateunassigned, so the load commits nothing.
The sequence the question is about
- A view has a persisted record naming profile P with the settings resolved for P.
- While the lookup of P is awaited the user switches the view to profile N, so the merge carries N.
- The name moved and the settings reference did not, so the load re-resolves N and snapshots the selection it resolved for.
- While that lookup is awaited the user switches the view back to P.
- The re-read at 1196 sees a selection that differs from the snapshot, logs the discard at 1202 and returns at 1205.
So the profile the view ends on is the one whose settings were already resolved successfully at the first lookup, and the load nevertheless commits nothing. The buffer keeps the user's own newest writes and the persisted record is untouched, so nothing is corrupted: in particular the view is never left naming one profile while holding another profile's settings, which is the pairing the whole guard exists to prevent.
The alternative reading
Because the view ended on P, a load could fall back to the record it started from and commit P with the settings it resolved for P, rather than abandoning the commit. That is a different discard policy: a superseded re-resolve means fall back to the persisted record, not commit nothing at all. Both policies keep the name and the settings paired. They differ in whether a load that was interrupted mid-flight still applies the state it loaded before the interruption.
Why this is a policy choice and not a defect
The current behaviour never mispairs a name with settings resolved for a different profile, never writes a value the user did not choose, and never loses a persisted record. The alternative never leaves a view on its previous in-memory state when a valid persisted record for the profile it ended on was resolved during the same load. Choosing between them is a call about what a discard should mean for this load path, and it belongs to a maintainer rather than to a fix. It is deliberately not being changed on the head above: the discard semantics for this path are the subject of published contract answers on PR #1560, and changing them here would reopen that discussion.
Provenance
Found while sweeping for the class behind review thread 4609689999 on PR #1560 - a comparison that decides ownership or precedence against the wrong snapshot - which was fixed in 57b766b2f4977b6988b263efd81963680b050b9b by comparing the mode against the reading its carried value was derived from. The sweep found that the two neighbouring reapplies for currentApiConfigName and apiConfiguration are not instances of that class, because they compare against the same post-load reading their writes are derived from and the only asynchronous window after them is guarded by the re-read quoted above. What the sweep did find is this asymmetry in that guard, which is why it is filed rather than fixed. Related to issue 2488 step 2 (a record-level write revision): both questions are about which write a comparison is entitled to judge as superseded.
- Lingua principale
- TypeScript
- Stelle
- 2k
- Fork
- 301
- Merge medio
- 3g 14h
- PR unite (30g)
- 103
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Zoo-Code-Org/Zoo-Code
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Zoo-Code-Org/Zoo-Code#2515 ·
I maintainer di solito rispondono entro 3 giorni
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on WindowsForse già presa @easonLiangWorldedtech l’ha presa 15 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
I maintainer di solito rispondono entro 3 giorni
-
[BUG] search_files hides matching text on long linesForse già presa @DananjayaNadun l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Zoo-Code-Org/Zoo-Code
Issue simili
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 modelAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
tashfeenahmed/freellmapi#2169 ·
I maintainer di solito rispondono entro 1 giorno
-
via-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on recordAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
vercel-labs/ui#1563 ·
I maintainer di solito rispondono entro 1 giorno