Ordered refetch retains overlapping first-page requests after the backend becomes empty
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
Piste de recherche
Start with the replay command in the issue and the ordered request contract in packages/db/src/query/live/ARCHITECTURE.md, then inspect finishOrderedPrefixRepair and retireSettledFiniteAcquisitions in packages/db/src/query/live/ordered-source-loader.ts. Preserve the reduced history through the shared model, driver, and comparison, and extend acquisition-retirement histories for empty backends and overlapping repair prefixes. Done means the replay passes after the repair, fails on unchanged production, and rejects the original defect as a mutant while preserving the listed cleanup behaviors.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
The random query-db.refetch-ordered-prefix campaign found an unchanged-backend refetch that sends two overlapping first-page requests instead of at most one. Deleting every backend row is enough to reach it in the reduced history.
Observed on main at 3f05109f60eee7222118b3d838508c3ed046ad7d in Release / Test (collections), attempt 1. The same seed and shrink path reproduce locally on unchanged production. The random campaign may pass with another seed; that does not establish that this history is fixed.
This failure prevented that run's dependent Release job from starting. The maintainer restarted the workflow and requested that this counterexample be tracked separately from release recovery. No production code, oracle expectations, comparisons, or run budgets were changed.
Reduced history
Property: query-db.refetch-ordered-prefix
seed: 1067726211
path: 41:0:1:2:2:2:3:2:2:7:8:8:8
{
"scenario": {
"encoding": "cursor",
"functionKey": false,
"terms": 1,
"orderKey": "rank",
"limit": 1,
"offset": 1
},
"initial": [
{ "id": 2, "rank": 0, "marked": false },
{ "id": 4, "rank": 0, "marked": false }
],
"history": [
{ "type": "delete", "id": 4 },
{ "type": "delete", "id": 2 },
{ "type": "refetch" }
]
}
pageCap is undefined: the provider is uncapped. With one order term the fixture maps rank to rank * 100 + id, so the source ranks are 2 and 4, not tied. Both rows are unmarked, so the LEFT-joined marker filter leaves the public window empty while the source loader pages.
The shared driver appends another refetch and repeats unchanged-backend refetches and invalidation before its final comparisons. The failed checkpoint is the repeated-refetch request-work comparison, not the window or source-coverage comparison:
a refetch of an unchanged backend started 2 first-page requests; expected at most 1
Observed request work
Temporary logging at the existing failing checkpoint recorded these two requests during a repeated refetch after the backend became empty:
orderBy: rank desc, limit: 2, offset: 0, no cursor
orderBy: rank desc, limit: 1, offset: 0, no cursor
Acquisitions observed earlier in the same run:
- Ordered prefix, limit 2.
- Boundary tie,
rank == 2. - Cursor suffix, limit 1, offset 2,
rank < 2. - Repair prefix, limit 2,
refetch: true. - Replacement repair prefix, limit 2,
refetch: true. - Repair first page, limit 1, offset 0,
refetch: true.
This suggests redundant prefix acquisitions survive bounded-repair completion. finishOrderedPrefixRepair / retireSettledFiniteAcquisitions in packages/db/src/query/live/ordered-source-loader.ts are candidate repair locations: completion keeps acquisitions belonging to the current repair chain. A causal fix has not been implemented or verified. Temporary diagnostic logging was removed after capturing the requests.
Replay
From the repository root at the recorded commit, with dependencies installed and Query Collection dependencies built:
TANSTACK_DB_ORACLE_PROPERTY=query-db.refetch-ordered-prefix \
TANSTACK_DB_ORACLE_SEED=1067726211 \
TANSTACK_DB_ORACLE_PATH=41:0:1:2:2:2:3:2:2:7:8:8:8 \
pnpm --config.verifyDepsBeforeRun=false \
--filter @tanstack/query-db-collection exec vitest run \
tests/refetch-ordered-prefix-oracle.test.ts \
--maxWorkers=1 --fsModuleCache=false \
--typecheck.enabled=false --coverage.enabled=false
Local result: the replay fails at the same request-work comparison in approximately 11 seconds; 33 other tests pass, 2 are expected failures, and 9 are skipped by replay selection.
Contract and follow-up
The existing oracle's neighboring work law requires an unchanged-backend refetch or invalidation to start at most one first-page request for this window's predicate and order. Its authority is the ordered request/acquisition contract in packages/db/src/query/live/ARCHITECTURE.md, “Ordered requests, continuation, and recovery.” The recorded history does not fail public window or source-coverage judgments; broader effects have not been ruled out.
Preserve this history through the shared model, driver, and comparison. Extend generated acquisition-retirement histories to exercise empty backends and overlapping repair prefixes. Any cleanup repair must preserve covering demand, whole-chain settlement, truncate replay, and reentrant release behavior. Demonstrate RED on unchanged production, GREEN after repair, and rejection of the original defect as a mutant.
Related, but different observations:
- #2186: broader ordered-refetch oracle follow-up.
- #2191: acquisition-ledger modeling; its stated limits exclude same-epoch prefix supersession and tie/refill sub-steps.
- #2268: two full-source reads after a signalling refetch, rather than two bounded first-page requests.
- #2335: source-coverage failure with two order terms, rather than this request-work failure.
- Langage dominant
- TypeScript
- Étoiles
- 4k
- Forks
- 286
- Merge moyen
- 1 j 1 h
- PR mergées (30 j)
- 104
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TanStack/db
-
extractSimpleComparisons returns value: null when the right side of a comparison isn't a literalOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
`avg`, `min`, `max` and `sum` treat `null` values as `0`Peut-être pris @oyobbeb l’a pris il y a 8 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
`Collection.currentStateAsChanges` JSDoc examples don’t match `CurrentStateAsChangesOptions`Ouverte
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutPeut-être pris @jp-knj l’a pris il y a 20 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TanStack/db
Issues similaires
-
bot:ai-assisted component:platform-js status:untriaged
Difficulté 1/5 Moins d'une heure Accessibilité débutants 74/100
midnightntwrk/platform-js#38 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ranxianglei/billion-context#7068 ·
Les mainteneurs répondent en général sous 1 jour
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
mybigday/whisper.rn#348 ·
-
enhancement severity:low
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Battle-Cattle/BCUK-Bot-4#1075 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
ilan-pinto/roaring-lions#1552 ·
Les mainteneurs répondent en général sous 1 jour