Repository navigation
fix(orm): let union sources anchor their own index range - #394
Merged
Merged
Conversation
Fixes #385. `FindManyUnionSource` had only `where`, so the documented per-source `index: { name, range }` failed with TS2353. Deeper: without an anchor the source fell back to `by_creation_time`, so `interleaveBy` on any other field threw. Add `index?: PredicateWhereIndexConfig` and resolve each source on `source.index ?? chain withIndex`. Also fixes the reverse docs defect: the shared-`withIndex` + per-source-`where` union example in api-reference, filters, and the kitcn skill throws at runtime, since a rangeless `withIndex` pins no equality fields and `OrderByStream` then rejects a shorter `interleaveBy`. Rewrote all three to per-source anchors. Plan: docs/plans/385-index-anchored-union-sources.md
🦋 Changeset detectedLatest commit: 4a2c113 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.
|
Member
|
Autoclosure receipt
No P1 feedback remains. Ready to merge. |
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🐛 Fixes #385
🧭 Task plan: docs/plans/385-index-anchored-union-sources.md
🟢 95-100% confidence
bun check✅ Outcome
select().union(...)source can declare its ownindex: { name, range }anchor.interleaveBy..withIndex(...); sources without one retain the chain index.interleaveByfields must remain a trailing ordered suffix after each source range pins its leading index fields.🏗️ Design
FindManyUnionSourceowns per-source index intent using the existing typed index-range configuration._buildUnionSourceStreamresolvessource.index ?? configuredIndexbefore building and validating each stream.🧪 Verified
bun checkpasses, including lint, typecheck, tests, fixture parity, verification, and runtime scenarios.