You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(db): enforce aggregate reach and retain campaign seeds - #2331
The aggregate oracle could pass after its generated histories lost required coverage. Twelve fixed histories satisfied every shared reach check. A later reach failure also lacked a campaign seed when fast-check comparisons passed.
Each campaign now checks structural and generated reach separately. The structural set guarantees 21 initial premises. The 160 generated histories must reach those states themselves, plus seven mutation and route comparison checkpoints. A missing generated state fails with its selected seed and counts.
Shared helpers report fresh seeds and preserve explicit replay selection. Aggregate statistics survive failures and require TANSTACK_DB_ORACLE_STATISTICS=1. Three existing consumers now distinguish replay selection from fresh seed metadata. Their fixed campaigns and serializer calibration remain active.
Named history fields replace the positional tuple. Repository-relative configs make the focused test and TypeScript commands reproducible. This PR changes test support, tests, and evidence. It changes no production code or package dependencies.
Oracle evidence
The coverage-map owner remains Aggregate selects. The review record accounts for all nine findings and the shared-seed compatibility fix.
Reach: Both campaigns require 21 structural states and 28 generated states. Each retains 160 generated histories, minimum one, and fixed seed 2094.
RED: Three generator ablations passed the old shared reach. Separate generated reach rejects each ablation. The shared diagnostic model also failed against unchanged helpers.
GREEN: The aggregate and helper checks pass 14 tests. Reporting and manifest checks pass another 38 tests. The three affected consumer owners pass 131 tests.
Mutant: Missing ordered histories, string terms, runtime stripping, mutation steps, shadowing, or union fails generated reach. A missing structural triple input fails structural reach.
Replay: Lexical collation fails the public row comparison at seed 2094/path 11. Restoration passes. A fresh reach failure also repeats identical counts through seed-only replay.
Limits: Structural guarantees concern initial compilation or publication. Generated coverage remains sampled. The seven checkpoints do not cover every law after every mutation.
Focused TypeScript, formatting, whitespace, and pnpm lint:changed pass. Local cached Vitest is 3.2.4, while CI uses 4.1.12. The full repository test and build commands did not run locally.
The later a0e323a CI run found one stale ordinary seed assertion in utils.test.ts. The assertion now accepts the selected numeric seed and still rejects unexpected path options. All 132 tests in that file pass locally. The oracle sources and shared helpers remain unchanged. New head CI remains pending.
The later ee13953 CI run found the same stale expectation in the React Native adapter tests. The complete option assertion now accepts the fresh numeric seed. All 93 tests in that ordinary file pass locally. Shared helpers and oracle sources remain unchanged. Final head CI remains pending.
Integration and release
The branch includes main b190945965e2d7ed51bcc04885283961a5ad4c50, including #2332, #2333, and #2303. Production and dependency files equal that main commit.
The main integration preserves all authored test changes. Aggregate, helper, reporting, and manifest checks pass 52 tests. Eight metadata properties also complete their fixed and fresh campaigns at unchanged budgets. These controlled persistence and native SQLite checks pass 19 tests. They cover one process with two coordinators. Scoped TypeScript, lint, and whitespace checks pass.
The integrated head requires new CI. The latest completed CodeRabbit review covered one ordinary native test file at 28102dd. Automatic reviews remain paused.
The earlier guarded refetch replay remains historical integration evidence at df5353866bbc99aed92e0ae3361901f2007d32c2. That invocation passed 36 tests and skipped two. It ran one target execution and two fast-check runs. This review did not repeat a complete refetch campaign.
This test-only change needs no package changeset. A separately approved merge and later successful main workflow must precede release regeneration.
Checklist
I ran the full repository pnpm test command.
This change affects published code and includes a changeset.
This change is docs/CI/dev-only (no release).
Summary by CodeRabbit
Tests
Aggregate-selection checks run 12 structural histories before 160 generated histories. Structural histories must cover all 21 operator states; generated histories independently check those states and additional mutation, route, alias, and union checkpoints.
Oracle campaigns report their selected replayable seed and coverage counts, including when a campaign fails. Replay settings consistently control fixed-seed test runs.
Added focused test configurations for aggregate-selection and oracle diagnostics.
Documentation
Updated coverage guidance and added review records describing scenarios, results, reproduction steps, and limitations.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
Walkthrough
Aggregate-select oracle tests now combine structural and generated histories and check their reach separately. Shared oracle utilities select and report campaign seeds, including when reach checks fail. Focused test configurations and review records document execution and evidence.
Changes: Aggregate-select oracle campaigns
Layer / File(s)
Summary
Aggregate histories and reach checks packages/db/tests/query/aggregate-select-oracle.property.test.ts, packages/db/tests/query/includes-publication-oracle.test.ts, packages/db-ivm/tests/structural-identity-oracle.property.test.ts, docs/contributing/oracle-coverage.md
Aggregate-select tests run 12 structural histories and 160 generated histories. The structural set must reach all 21 operator states. Generated histories are checked independently for those states and additional mutation, route, alias, and union checkpoints. Replay selection uses replaySeed.
Ordinary campaigns select and report a seed. Campaign reach reports include the effective seed and run in a finally block. Tests verify seed and reach reporting, including for failing campaigns, and update replay selection.
Review evidence and focused test setup docs/contributing/oracle-reviews/*, packages/db/tsconfig.aggregate.json, packages/db/vitest.aggregate.config.mjs, scripts/oracle-diagnostics.vitest.config.mjs
Review records document reach counts, test results, reproduction commands, and evidence limits. Focused Vitest and TypeScript configurations select oracle tests.
TanStack/db#2290: Adds fixed-history tracking that the aggregate-select tests use for structural reach checks.
TanStack/db#2233: Adds the declared-state reach helper used by the aggregate-select checks.
TanStack/db#2236: Changes shared oracle seed selection and campaign configuration used by this PR.
Merge Risk: Minimal · up to 28102
No merge-blocking risk is identified in the reviewed changes.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly identifies the two main changes: enforcing aggregate reach and retaining campaign seeds.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is mostly complete. It explains the changes, motivation, oracle owner, law, reach requirements, RED/GREEN evidence, replay data, limits, testing status, release impact, and changeset d…
Full details: Description check
Explanation
The description is mostly complete. It explains the changes, motivation, oracle owner, law, reach requirements, RED/GREEN evidence, replay data, limits, testing status, release impact, and changeset decision. The headings differ from the template, but the required information is present.
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 13 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comparing e52146efb (this PR) against b19094596 (base). Write times are per-write medians over 100 iterations (20 warmup writes). Cold hydrate is one timed first load of each query.
Overall median write time vs base: 1.00× · cold hydrate time: 1.04× (geometric mean of per-case ratios; lower is faster).
Writes: 2 regression(s), 1 improvement(s) (threshold: ±20% and >0.05ms).
Cold hydrate: 2 regression(s), 2 improvement(s) (threshold: ±50% and >5ms).
Per-case flags are noisy on shared runners. Read the geometric means first.
Writes
Query
Δ median write time (geomean)
Best case
Worst case
Flags
list: newest 50 open
+4.2%
-14.9%
+68.9%
1 🔴
list + author
+7.1%
-18.3%
+125.2%
1 🔴
list + comment count
+0.9%
-19.3%
+12.4%
—
list + 3 recent comments
-6.3%
-53.3%
+14.3%
1 🟢
issue detail + comments
-6.8%
-44.4%
+8.5%
—
Cold hydrate
Query
Δ cold hydrate time (geomean)
Best case
Worst case
Flags
list: newest 50 open
+10.8%
-50.2%
+535.2%
1 🔴 1 🟢
list + author
-6.9%
-23.4%
+20.3%
—
list + comment count
-1.2%
-67.5%
+70.0%
1 🟢
list + 3 recent comments
+8.3%
-52.3%
+215.3%
1 🔴
issue detail + comments
+4.0%
-18.1%
+24.6%
—
Each row aggregates the 14.4 scale/index/write-mode configurations of that query; per-configuration tables below.
Runner: node v24.8.0, linux 7.0.0-1017-azure, AMD EPYC 9V45 96-Core Processor. Timings on shared CI runners are noisy; treat small deltas as indicative only.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
The aggregate oracle could pass after its generated histories lost required coverage. Twelve fixed histories satisfied every shared reach check. A later reach failure also lacked a campaign seed when fast-check comparisons passed.
Each campaign now checks structural and generated reach separately. The structural set guarantees 21 initial premises. The 160 generated histories must reach those states themselves, plus seven mutation and route comparison checkpoints. A missing generated state fails with its selected seed and counts.
Shared helpers report fresh seeds and preserve explicit replay selection. Aggregate statistics survive failures and require
TANSTACK_DB_ORACLE_STATISTICS=1. Three existing consumers now distinguish replay selection from fresh seed metadata. Their fixed campaigns and serializer calibration remain active.Named history fields replace the positional tuple. Repository-relative configs make the focused test and TypeScript commands reproducible. This PR changes test support, tests, and evidence. It changes no production code or package dependencies.
Oracle evidence
The coverage-map owner remains Aggregate selects. The review record accounts for all nine findings and the shared-seed compatibility fix.
Focused TypeScript, formatting, whitespace, and
pnpm lint:changedpass. Local cached Vitest is 3.2.4, while CI uses 4.1.12. The full repository test and build commands did not run locally.The later
a0e323aCI run found one stale ordinary seed assertion inutils.test.ts. The assertion now accepts the selected numeric seed and still rejects unexpected path options. All 132 tests in that file pass locally. The oracle sources and shared helpers remain unchanged. New head CI remains pending.The later
ee13953CI run found the same stale expectation in the React Native adapter tests. The complete option assertion now accepts the fresh numeric seed. All 93 tests in that ordinary file pass locally. Shared helpers and oracle sources remain unchanged. Final head CI remains pending.Integration and release
The branch includes main
b190945965e2d7ed51bcc04885283961a5ad4c50, including #2332, #2333, and #2303. Production and dependency files equal that main commit.The main integration preserves all authored test changes. Aggregate, helper, reporting, and manifest checks pass 52 tests. Eight metadata properties also complete their fixed and fresh campaigns at unchanged budgets. These controlled persistence and native SQLite checks pass 19 tests. They cover one process with two coordinators. Scoped TypeScript, lint, and whitespace checks pass.
The integrated head requires new CI. The latest completed CodeRabbit review covered one ordinary native test file at
28102dd. Automatic reviews remain paused.The earlier guarded refetch replay remains historical integration evidence at
df5353866bbc99aed92e0ae3361901f2007d32c2. That invocation passed 36 tests and skipped two. It ran one target execution and two fast-check runs. This review did not repeat a complete refetch campaign.This test-only change needs no package changeset. A separately approved merge and later successful main workflow must precede release regeneration.
Checklist
pnpm testcommand.Summary by CodeRabbit
Tests
Documentation