Repository navigation
fix(orm): read compiled index-union probes at every stream site - #425
Conversation
_toConvexQuery compiled probeFilters; every stream builder dropped them via a narrowed queryConfig type. Cursor-paginated in() fell back to a full table scan and required maxScan. One CompiledQueryPlan type + _buildPlanStream now own the ladder: compiled index union, compiled index range, caller withIndex, order index, scan. Union merges probes on an index-key suffix inside the eq-pinned run, declines when the order is not servable or past 64 probes.
🦋 Changeset detectedLatest commit: 1c292f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Autoclosure complete for exact head
Final feedback inventory: 0 review threads, 0 review bodies, 3 informational issue comments, 0 deferred items.
Terminal verdict: ready to squash-merge. No unresolved P1 or P2 feedback. |
🐛 Fixes #415
🧭 Task plan: docs/plans/415-restore-compiled-probefilters-at-orm-stream-sites.md
🟢 95-100% confidence
bun checkexit 0✅ Outcome
Compiled index-union probes reach every ORM stream construction path. Cursor pagination reads the planned index ranges, preserves normal cursor direction and bounds, excludes disjoint merged ranges without duplicates, and retains equality-prefix metadata when a narrowed child is empty.
Rejected unions keep the original predicate, require
maxScanunder strict mode, and use the bounded unanchored scan fallback instead of silently walking a rangeless plan index.🏗️ Design
One
CompiledQueryPlanflows to every plan consumer._buildPlanStreamowns the precedence ladder and reports whether the read is bounded by an accepted probe union. Advanced cursor callers preserve that result, whileOrderedStreamQuery.narrowcloses empty intersections without discarding merge metadata.Probe unions use
mergedStreamonly when the requested order is serviceable. They fall back to a budgeted scan when the requested order is unsupported, the union exceedsMAX_INDEX_UNION_PROBES(64), or schema metadata is unavailable.With no
orderBy, an accepted index-union page follows its index order. AddorderBy: { createdAt: 'desc' }when creation order is required.maxScanon a K-probe union can overshoot by up to K−1 reads while the merged stream fills one row per probe; K is capped at 64.🧪 Verified
bun check;bun typecheck5/5;bun --cwd packages/kitcn build; fixture sync/check 8/8; intent validation/staleness; 157 focused tests passed with 1 skipped; exact-head P1 autoreview clean at 0.87 confidence.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.