[BUG] Realtime confirms a block or variable edit before it is stored, so a failed write loses it

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

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript

Direção de pesquisa

Start with apps/realtime/src/handlers/subblocks.ts and variables.ts, tracing how a flush handles pending edits, confirmations, failures, and actor IDs. Reproduce the overlap with two tabs and a failed write, then check that each edit settles only after its own write and collaborators see the stored value with the correct audit actor.

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

Descrição

Describe the bug
When an edit to a subblock or variable field arrives while the previous edit of that field is being written, it joins that write's operation list. The earlier write confirms it before its value is stored. If its own write then fails, the client has already dropped the operation and ignores the failure, so the edit is lost while the UI still shows it. In the same overlap the first editor can be left showing a stale value, a later edit can be dropped without an answer, and the variable audit log can name the wrong user.

To Reproduce

  1. Open the same workflow in two tabs or as two users on the same realtime pod.
  2. Edit the same field in both, with B's edit arriving while A's write is in progress (a slow database widens the window).
  3. Make B's write fail, for example by locking the block.
  4. B sees the edit as saved, but it is not stored.

Expected behavior
Each edit is confirmed or failed only after its own write settles, every collaborator ends with the stored value, no edit is silently dropped, and the audit actor is the user who made the change.

Additional context
apps/realtime/src/handlers/subblocks.ts and variables.ts: a flush reads pending.latest when it starts but reads opToSocket and actorId at the end, and deletes the map entry after a newer edit may be using it.

Linguagem predominante
TypeScript
Estrelas
29.8k
Forks
3.9k
Merge médio
1h 43min
PRs com merge (30d)
937

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

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 simstudioai/sim

Todas as issues de simstudioai/sim

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.