SQLite persistence: peer row notice drops metadata for another row
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
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- sqlite, typescript
Direção de pesquisa
Start with packages/db-sqlite-persistence-core/tests/sync-metadata-session-persisted.test.ts and its persisted receiving driver, then read the shared law, model, grammar, and comparison in packages/db/tests/sync-metadata-session-oracle.ts. Run the supplied Vitest replay command to reproduce the missing row 2 metadata at the peer checkpoint. Done means the replay passes after the repair, fails on the parent, and a hostile mutant fails at that checkpoint.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
The persisted sync-metadata session oracle found a history in which a peer row notice for row 1 makes row 2's metadata disappear from the source-facing read. At that checkpoint, the model expects row 2's earlier metadata write to remain visible.
Found by the random SQLite core campaign in PR #2314's CI job. The exact replay also fails on the PR's merge-base, so the indexing changes in #2314 do not introduce this failure.
To reproduce
From the repository root, run:
TANSTACK_DB_ORACLE_PROPERTY=sync-metadata-session.persisted-peers \
TANSTACK_DB_ORACLE_SEED=346038028 \
TANSTACK_DB_ORACLE_PATH=36:2:4:6:10:14:16:14:14:13:13:13 \
pnpm --filter @tanstack/db-sqlite-persistence-core exec vitest run \
tests/sync-metadata-session-persisted.test.ts \
--coverage.enabled=false --typecheck.enabled=false --maxWorkers=2
Verified on both commits:
| Tree | Commit | Result |
|---|---|---|
| PR #2314 | a0d2c4e3780307a770ef7734b64a2d4adf5bd3ce |
Same metadata assertion failure; 37 other tests pass and one existing expected failure remains |
| Unchanged merge-base | bfd1da1a7e752d66fd667adfd3cdf54f60732b22 |
Same failure at the same checkpoint; 37 other tests pass and one existing expected failure remains |
The base run used a complete git archive snapshot with the same installed dependencies and the package's source aliases. Neither the production code nor the oracle was changed for either replay.
Fast-check originally failed after 37 generated histories and shrank 11 times. Both direct replays fail after one history, without further shrinking.
The first failing prefix, with zero-based step 11 as the final action:
[
{ "type": "seed", "key": 2, "narrow": false, "bare": true },
{ "type": "begin" },
{ "type": "begin" },
{ "type": "rowSet", "key": 2 },
{ "type": "commit" },
{ "type": "upsert", "key": 2, "metadata": false },
{ "type": "commit" },
{ "type": "commit" },
{ "type": "truncate" },
{ "type": "collectionDelete", "key": "cursor" },
{ "type": "release" },
{ "type": "peer", "key": 1, "notice": "row", "keepsValue": true }
]
The generated counterexample continues with commit, another identical peer action, a bare seed for key 1, collectionSet(cursor), and release. The mismatch occurs before that suffix executes.
Expected and actual behavior
The existing sync-metadata session contract gives the source read-your-writes and own reads in serialization order. The shared model requires this source-facing metadata.row.get observation at the peer checkpoint:
law: source reads its row metadata (metadata.row.get)
at step 11 (peer)
expected: {"1":{"peer":{"s":11}},"2":{"s":3}}
actual: {"1":{"peer":{"s":11}},"2":"<absent>"}
Row 1's peer metadata agrees. Row 2's metadata is missing. This is a reproducible assertion mismatch, not a timeout or setup error. The root cause has not been diagnosed.
Additional context
- Production path:
persistedCollectionOptions, with an in-memory persistence adapter and a controlled peer notice through the coordinator. - Persisted receiving driver.
- Shared law, model, grammar and comparison.
- The observation is source-facing row metadata. This controlled witness does not establish durable row loss or behavior with two real browser coordinators; that receiving coverage is tracked separately in #2272.
- CI used Ubuntu and Vitest/jsdom; local replay used macOS, Vitest 4.1.12 and fast-check 3.23.2.
Keep this trace as a replay through the existing model, driver and comparison during the repair. Show RED on the parent, GREEN after the fix, and a hostile mutant that fails at the metadata checkpoint.
- Linguagem predominante
- TypeScript
- Estrelas
- 4k
- Forks
- 277
- Merge médio
- 1d 6h
- PRs com merge (30d)
- 199
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/db
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesTalvez já em andamento @Claire-ovo assumiu há 5 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TanStack/db#2254 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutTalvez já em andamento @jp-knj assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/db
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
excaliburjs/Excalibur#3895 ·
Mantenedores costumam responder em até 3 dias
-
infer_audio_type only recognises one MPEG Layer III frame header, so most MP3 files are rejectedTalvez já em andamento @Steve-20-ai assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Earn report crashes with "RangeError: Invalid time value" when a report row has an unparsable timestampTalvez já em andamento @Gurkaran18 assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
joinmarket-webui/jam#1588 ·
Mantenedores costumam responder em até 3 dias
-
BeOS .json missingAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
mihaip/infinite-mac#475 ·