feat(db): track applied loadSubset coverage - #1774
Conversation
…t-coverage-registry
…t-coverage-registry
…t-coverage-registry
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/react-router-with-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: +6.72 kB (+4.14%) Total Size: 169 kB 📦 View Changed
ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 7.25 kB ℹ️ View Unchanged
|
…t-coverage-registry # Conflicts: # packages/db/src/collection/sync.ts # packages/db/tests/load-subset-outcome.test.ts
…t-coverage-registry # Conflicts: # packages/db/src/query/live/collection-config-builder.ts # packages/db/src/types.ts # packages/db/tests/collection-subscription.test.ts
…t-coverage-registry # Conflicts: # packages/db/src/collection/sync.ts # packages/db/src/query/live/collection-config-builder.ts # packages/db/tests/collection-subscription.test.ts # packages/db/tests/load-subset-outcome.test.ts
…t-coverage-registry # Conflicts: # packages/db/src/collection/sync.ts
…t-coverage-registry # Conflicts: # packages/db/src/collection/subscription.ts # packages/db/tests/collection-subscription.test.ts
…ry' into codex/loadsubset-coverage-registry
This adds a source-side coverage registry that publishes only exact, authoritative
loadSubsetfacts backed by rows that have reached the collection. It also keeps cleanup retry-safe and restores Query DB's eager observer after TanStack Query removes its cache entry.Root cause
Request intent and a resolved adapter Promise do not prove that a source has established reusable coverage. Coverage also cannot own adapter resources or rows implicitly: compaction, stale results, failed release, and cache removal each have different lifetimes.
Approach
_sync.loadSubsetand_sync.unloadSubset.Key invariants
Non-goals
Verification
The coverage-registry command model also passes a 100× campaign of 10,000 generated histories.
Files changed
packages/db/src/query/coverage-registry.ts: coverage, ownership, generation, and retry-safe release state.packages/db/src/collection/sync.ts: production load/unload integration.packages/db/src/query/load-subset-outcome.tsand types: exact applied-row evidence.packages/db/tests/query/coverage-registry-oracle.property.test.ts: command/state-machine oracle and focused laws.packages/query-db-collection/src/query.ts: eager lifetime observer repair.packages/db/src/query/live/ARCHITECTURE.md: source coverage and release contracts.Depends on #1772. Part of #1657.