Persisted on-demand Electric collection enters error after a committed transaction waits across subset hydration
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- databases
調査の方向性
Start by reading the transaction-boundary and hydration logic in applyBufferedSyncTransactionUnsafe, applyTransactionToCollection, loadSubset, and assertHydrationSequenceCurrent. Trace the reported sequence: a commit accepted at generation 0 is published after two subset hydrations. Done means accepted commits publish and persist consistently despite delayed publication, while genuinely open transactions crossing hydration cycles are still rejected; no reproduction or test file is named in the issue.
索引モデルが issue の本文から書いたものです。
説明
Observed behavior
With @tanstack/db-sqlite-persistence-core 0.4.3 and @tanstack/browser-db-sqlite-persistence 0.2.28, on-demand Electric collections enter a terminal error state during normal startup/subset loading:
InvalidPersistedCollectionConfigError: a persisted sync transaction cannot cross a hydration cycle
This surfaces as live-query source errors for jobs and documents.
Captured runtime sequence
Instrumentation around the source transaction boundaries, hydration generation changes, and publication captured this ordering for the jobs collection:
- Electric begin and commit both execute at hydration generation 0.
- Two persisted subset hydrations run, advancing the generation to 1 and then 2.
- applyBufferedSyncTransactionUnsafe calls applyTransactionToCollection for the already-committed transaction.
- The transaction has hydrationSequence=0, current generation=2, queuedBecauseHydrating=false, and internal=false. assertHydrationSequenceCurrent throws and the source enters error state.
The application did not keep the transaction open across these hydrations. Commit was accepted before the generation changed; publication happened later inside persistence scheduling.
Expected behavior
An accepted source commit should publish and persist in a consistent order with subsequent subset hydration, without invalidating the source merely because the persistence queue delayed publication. The existing rejection of genuinely open transactions crossing hydration cycles should remain.
Current source and related coverage
Current main still records the generation at external begin, validates it at commit, and validates it again at delayed publication. loadSubset schedules hydration through the same apply mutex and advances the generation.
Related: https://github.com/TanStack/db/pull/1911 covers a transaction beginning during hydration and committing after that hydration closes. This report concerns a commit accepted before later hydrations execute.
An isolated deterministic regression and fix are being investigated. No minimal standalone reproduction or tested upstream patch is attached yet. Disabling persistence for on-demand collections avoids the captured failure in the application; eager persistence remains enabled.
- 主要言語
- TypeScript
- スター
- 3.9k
- フォーク
- 268
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 178
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/db のほかの issue
-
SQLite persistence silently serializes Temporal values as {}, breaking hydration and subset queries対応中かも @KyleAMathews が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
-
useLiveInfiniteQuery commits an empty first render over a synchronously loaded collection (useLiveQuery doesn't)対応中かも @KyleAMathews が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
umbraco/Umbraco-CMS-MCP-Dev#512 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
wimpysworld/sidra#290 ·
メンテナーはふだん 1 日以内に返信
-
defuFn invokes function values for inherited default properties対応中かも @xiehuanyi が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
feature request good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
TabularisDB/tabularis#853 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 85/100
capricorn86/happy-dom#2474 ·
メンテナーはふだん 2 日以内に返信