Verify cross-task dirty buffer safety after a refused rollback

Aberta
#2,436 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 3 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
43/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
desktop, testing-qa

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
2k
Forks
301
Merge médio
3d 14h
PRs com merge (30d)
103

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de Zoo-Code-Org/Zoo-Code

Todas as issues de Zoo-Code-Org/Zoo-Code

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.