Skip to content

fix(db): unify ordered window semantics - #1778

Open
KyleAMathews wants to merge 99 commits into
codex/loadsubset-coverage-registryfrom
codex/loadsubset-total-order
Open

fix(db): unify ordered window semantics#1778
KyleAMathews wants to merge 99 commits into
codex/loadsubset-coverage-registryfrom
codex/loadsubset-total-order

Conversation

@KyleAMathews

Copy link
Copy Markdown
Collaborator

Summary

  • define one TotalOrder for query execution, cursor boundaries, source refinement, and public-key ties
  • retain applied row provenance in WindowState so offset/limit changes and SSE updates cannot widen from unproven rows
  • fetch and refine the full filtered region when locale, reference, or invalid-Date order cannot be expressed safely as a cursor
  • align DB-IVM, BTree, and live-query ordering for NaN keys and descending-index ties

Why

Lazy ordered queries previously used different order and coverage rules at each layer. A source page could look complete to one layer while the live query still lacked a tied row, or a later window could reuse a boundary that did not prove its prefix. This made results depend on request shape, event timing, and index direction.

This PR makes the applied row receipt the source of boundary provenance and uses the same total order from acquisition through publication.

Validation

  • DB: 135 files, 3,450 passed, 6 skipped, no type errors
  • Query DB: 8 files, 334 passed, no type errors
  • focused TotalOrder/coverage suites: 417 passed
  • 100x pagination and replay oracles: 130 passed
  • DB, DB-IVM, and Query DB builds and lints
  • independent adversarial runtime review: approved

Stacked on #1774. Advances the TotalOrder/window-state step of #1657.

…t-total-order

# Conflicts:
#	packages/db/src/query/effect.ts
…et-total-order

# Conflicts:
#	packages/db/src/collection/subscription.ts
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 786a66d9-87a4-4005-b13e-ee3d43e740c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant