Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Persisted on-demand Electric collection enters error after a committed transaction waits across subset hydration

オープン
#2,036 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@alec-watts がすでに取り組んでいます。

2026年10月5日 から。

  • #2037 @alec-watts による — オープン

評価

難易度
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:

  1. Electric begin and commit both execute at hydration generation 0.
  2. Two persisted subset hydrations run, advancing the generation to 1 and then 2.
  3. applyBufferedSyncTransactionUnsafe calls applyTransactionToCollection for the already-committed transaction.
  4. 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/db のほかの issue

TanStack/db の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。