Verify cross-task dirty buffer safety after a refused rollback

Offen
#2,436 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
43/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
desktop, testing-qa

Rechercherichtung

Start with src/core/Task.ts, src/core/tools/WriteToFileTool.ts, and src/integrations/editor/DiffViewProvider.ts, then trace task disposal and document opening. Add a two task test that records the dirty buffer and persisted contents before and after task B opens the shared path, and checks whether unapproved streamed content was saved. If the test confirms the risk, cover protection, recovery, and cleanup; otherwise document why the real document lifecycle prevents it.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Summary

Investigate whether a later task can save unapproved streamed content after a prior task's rollback fails and the prior task is disposed.

The earlier review found that a rollback failure could leave a dirty document open, and that a later DiffViewProvider.open() could save a dirty document. This cross-task risk predates PR #1930; it has not been verified with a two-task test. PR #1930 does not contain the disposal release discussed below.

The requester identifies the later stacked unit, PR #2435, as the relevant place to assess the disposal drop. At commit 4baf005673f482d9d911de87ff0890644765193a, src/core/task/Task.ts calls writeToFileTool.releaseTaskRollbackFailure(this) during disposal, and src/core/tools/WriteToFileTool.ts defines the release. src/integrations/editor/DiffViewProvider.ts manages the editor buffer and its opening and rollback behavior.

Required work

  • Add a test with two distinct tasks that share a document. Make task A's rollback fail or be refused, keep the document dirty, and dispose task A. Then have task B open the same path.
  • Check whether task B saves the unapproved streamed content before approval. Use a document double or extension-host coverage that preserves the dirty state across task disposal.
  • If the test confirms the risk, add protection at the appropriate cross-task boundary and a regression test. Do not retain a disposed task solely to keep a per-task marker alive. Keep protection until safe recovery or an explicit user decision makes it unnecessary.

Acceptance criteria

  • The test records the buffer and persisted contents before and after task B opens the path, and distinguishes unapproved streamed content from the original content.
  • The test demonstrates that task B cannot silently persist unapproved content before approval, or documents why the scenario cannot occur with the real document lifecycle.
  • If a fix is required, tests cover recovery and cleanup of its protection without retaining disposed task state.

Context

Vorherrschende Sprache
TypeScript
Sterne
2k
Forks
301
Ø Merge
3 T. 14 Std.
Gemergte PRs (30 T.)
103

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Zoo-Code-Org/Zoo-Code

Alle Issues in Zoo-Code-Org/Zoo-Code

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.