Multi-tab Electric: a deleted row returns after a peer reset and deploys

Ouverte
#2,281 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
38/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
sqlite, typescript
Domaine
databases, testing

Piste de recherche

Start with packages/browser-db-sqlite-persistence/tests/multi-tab-electric-oracle.test.ts and replay the supplied seed and path using the command in the issue. Trace how the peer reset, deploys, and reserved commit replay affect durable rows and both tabs; record the history in docs/contributing/oracle-coverage.md. Done means the replay passes after the fix, fails on the parent, and a hostile mutant fails.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Summary

The multi-tab Electric oracle found a history where a deleted row returns. After every tab catches up, durable storage and both tabs still contain row 1. The model expects only row 2.

The failure reproduces on origin/main at 4c39add29 and on the head of #2262 (f276b4ad4). The oracle and the behavior it checks came in with #2265. #2262 does not cause it.

Law

A row that the server deletes stays deleted in durable storage and in every tab after all tabs catch up. A peer reset and a later deploy do not bring back a deleted row.

Counterexample

Oracle: packages/browser-db-sqlite-persistence/tests/multi-tab-electric-oracle.test.ts, test keeps reserved commits lawful across generated multi-tab histories (random or replayed), property browser.multi-tab-reserved-history.

{ seed: -1115798760, path: "1:4:3:3:3:3:3:3:3:3:3", endOnFailure: true }
Counterexample: [{"tabCount":2,"steps":[
  {"kind":"server change","key":1,"pick":0},
  {"kind":"advance","tab":1,"pick":0},
  {"kind":"server change","key":1,"pick":0},
  {"kind":"advance","tab":0,"pick":0},
  {"kind":"peer reset"},
  {"kind":"server change","key":1,"pick":0},
  {"kind":"deploy"},
  {"kind":"deploy"},
  {"kind":"server change","key":1,"pick":0},
  {"kind":"server change","key":1,"pick":0}]}]
Shrunk 10 time(s)

Observation after every tab caught up:

actual   {"durableRows":[{"id":1,"label":"one"},{"id":2,"label":"two"}],
          "tabs":[{"tab":"A","status":"ready","rows":[{"id":1,...},{"id":2,...}],"sourceError":true},
                  {"tab":"B","status":"ready","rows":[{"id":1,...},{"id":2,...}],"sourceError":true}]}
expected {"durableRows":[{"id":2,"label":"two"}],
          "tabs":[{"tab":"A","status":"ready","rows":[{"id":2,...}],"sourceError":true},
                  {"tab":"B","status":"ready","rows":[{"id":2,...}],"sourceError":true}]}

The CI job that found it: Test (sqlite-adapters) on #2262, run 40723478437.

Replay

Run this in packages/browser-db-sqlite-persistence:

TANSTACK_DB_ORACLE_PROPERTY=browser.multi-tab-reserved-history \
TANSTACK_DB_ORACLE_SEED=-1115798760 \
TANSTACK_DB_ORACLE_PATH="1:4:3:3:3:3:3:3:3:3:3" \
npx vitest --run tests/multi-tab-electric-oracle.test.ts -t "generated multi-tab"

Related

  • #2267 is a different symptom: a lagging resumed tab goes into error. This issue is a deleted row that returns.
  • The fixed-seed campaign and the pinned storm histories pass. Only the random campaign reached this history.

Next steps

  • Diagnose which step reintroduces row 1: the peer reset, the deploys, or the reserved-commit replay.
  • Record the trace in docs/contributing/oracle-coverage.md under the multi-tab Electric owner until a fix lands.
  • Fix oracle-first: keep this history as a replay, show RED on the parent, GREEN after the fix, and a hostile mutant that fails.
Langage dominant
TypeScript
Étoiles
4k
Forks
286
Merge moyen
1 j 8 h
PR mergées (30 j)
105

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TanStack/db

Toutes les issues de TanStack/db

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.