Repository navigation
Conversation
…tions AND-joined conditions on one to-many relationship must be met by one related record, and a relationship condition inside an OR decides parents without narrowing select(). Both changed in v5.4.0 (harper#3724). Qualify the existing sentences that said outer relationship conditions always narrow the selected children, and note the collection DELETE impact in the 5.4 release notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: documentation-relationship-and-or-same-record
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: documentation-relationship-and-or-same-record
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-779 This preview will update automatically when you push new commits. |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for the Resource API, REST querying, and the v5.4 release notes to describe new behaviors in version 5.4.0 regarding nested relationship constraints. Specifically, it explains that AND-joined filters on the same to-many relationship must be met by a single related record, and that relationship filters inside an OR group only determine parent matches without restricting the returned related records. There are no review comments, so I have no feedback to provide.
…oups for 5.4
Separate AND conditions on a to-many relationship are each met by some
related record; relationship[conditions] (programmatically
{ attribute, operator, conditions }) requires one related record to meet
all of them. select() keeps the related records any AND condition matched,
and a condition inside an OR decides rows without narrowing the selection.
Documents HarperFast/harper#3927 and replaces the same-record rule
documented in #779, which did not ship.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch-Task: docs-harper-3927
…oups for 5.4 (#784) * Document existential relationship conditions and relationship[...] groups for 5.4 Separate AND conditions on a to-many relationship are each met by some related record; relationship[conditions] (programmatically { attribute, operator, conditions }) requires one related record to meet all of them. select() keeps the related records any AND condition matched, and a condition inside an OR decides rows without narrowing the selection. Documents HarperFast/harper#3927 and replaces the same-record rule documented in #779, which did not ship. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: link nested and DELETE references to the relationship rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: link the Grouping and nested-filter notes to the relationship rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: use plain-text version note mid-sentence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: state the full-text 400 case and reword the operations API exclusion Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Dispatch-Task: pr-maint-165fdb441be4ca4fb47889bc26fbd2b8 * Address review: warn that bracketed DELETE filters apply to the queried table before 5.4 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Dispatch-Task: pr-maint-165fdb441be4ca4fb47889bc26fbd2b8 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
🧹 Preview CleanupThe preview deployment for this PR has been removed. |
…oups for 5.4 (HarperFast/documentation#784) * Document existential relationship conditions and relationship[...] groups for 5.4 Separate AND conditions on a to-many relationship are each met by some related record; relationship[conditions] (programmatically { attribute, operator, conditions }) requires one related record to meet all of them. select() keeps the related records any AND condition matched, and a condition inside an OR decides rows without narrowing the selection. Documents #3927 and replaces the same-record rule documented in HarperFast/documentation#779, which did not ship. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: link nested and DELETE references to the relationship rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: link the Grouping and nested-filter notes to the relationship rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: use plain-text version note mid-sentence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: docs-harper-3927 * Address review: state the full-text 400 case and reword the operations API exclusion Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Dispatch-Task: pr-maint-165fdb441be4ca4fb47889bc26fbd2b8 * Address review: warn that bracketed DELETE filters apply to the queried table before 5.4 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Dispatch-Task: pr-maint-165fdb441be4ca4fb47889bc26fbd2b8 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
⊙ Problem
Two relationship-query rules changed in v5.4.0 (Keep an AND group's estimate finite when a sibling condition is filter-only), and the docs did not describe them:
name=Acme&products.name=Cable&products.price=ge=number:30matched Acme even though its Cable costs 10. A collectionDELETEwith those conditions deleted Acme.select(). That is false for an OR.🤔 Is the requirement right?
Yes. Both rules are on harper main; tests enforce them. The
DELETEcase alone makes the first rule worth calling out.💡 Solution
changed v5.4.0badge. Look hardest at the OR rule's mixed AND case: it is the least obvious one.⚖️ Alternatives
🤔 The examples were run locally, not added to the fixture harness
The paired fixture must match harper main byte for byte. New cases would need a harper PR, which is outside this task. harper main's HTTP suite already runs the OR and
DELETEcases on this same sample data.🔧 Changes
reference/resources/resource-api.md: two bold-lead paragraphs after Join behavior, each with aBrand.searchexample: same related record and OR decides parents only. The Join behavior, Constraining, nested-options andsortsentences now say the narrowing applies toandconditions. The rule paragraph also notes that a collectionDELETEfollows the same rule. The pending-release note now links harper#3724.reference/rest/querying.md: two####subsections at the end of Nested Select with Joins, each with anhttpexample: same related record and OR decides parents only. The join paragraph, the Filtering-and-Paging lead, the outer-sort paragraph and the nested option reference now say the narrowing applies to&. The pending-release note now links harper#3724.release-notes/v5-lincoln/5.4.md: the two rules, and an upgrade-impact sentence for queries and collectionDELETE.🤔 Prior-version results on reference pages
Each rule ends with one sentence on what v5.3.5 returned, so a reader still on 5.3 can see the difference. These sentences are easy to drop once 5.4 ships.
🤔 New text sits above the "not released yet" note
It relies on the
VersionBadge, like the to-many sort paragraph on the same page.✅ Verification
harper@5.3.5from npm, using the docs fixture schema and sample data. Each documented result matches, for main and for the v5.3.5 sentences.format:check,lint,typecheck,test:examples(13 pass; fixture parity also passes withHARPER_CORE_FIXTURE_ROOTset to harper main's copy),test:workflowsandbuildall pass. The new anchors resolve in the built HTML.Observed responses (main / 5.3.5)
name=Acme&products.name=Cable&products.price=ge=number:30[]name=Acme&products.name=Keyboard&products.price=ge=number:30&select(id,name,products{name,price})[Keyboard][Keyboard, Dock]DELETEwith the Cable conditions(products.name=Cable|id=44)&select(id,products{name})[Cable]; Studio Gear[]products.price=ge=number:30&(products.name=Cable|id=44)&select(...)[Keyboard, Dock]; Studio Gear[Stand, Monitor][]products.name=Keyboard&products.name=Mouse[][][]/ as the OR row🤖 Generated by Claude Opus 5.5; posted via @kriszyp.
Related PRs: #775 overlaps (qualifies its to-many sort wording), #760 independent (edits other sections of resource-api.md)
Complexity: easy
Origin — the dispatch brief this PR was written from
Document same-record AND matching and OR-only-filters-rows for relationship conditions (harper#3724, v5.4)
Document two relationship-query rules that HarperFast/harper#3724 (merged 2026-11-02, release target v5.4) made order-independent. The current docs (
reference/resources/resource-api.md~1130-1222 "Join behavior" and nested relationship selection,reference/rest/querying.md"Relationships and Joins" and "Filtering and Paging Each Relationship") already describe HarperFast/harper#3775 (AND conditions on a to-many relationship restrict itsselect()) but not these rules:GET /Parent/?children.name=child 10&children.label=label 6matches a parent only if a single child has both namechild 10and labellabel 6; a parent with one child namedchild 10and another labelledlabel 6does not match. Before #3724 the result depended on which condition the planner led with (a non-leading AND matched children separately); #3775 had pinned that, and #3724 changed it to same-record. Call this out as a v5.4 behavior change with aVersionBadge type="changed" version="v5.4.0". A to-one relationship trivially has one related record.|in REST,operator: 'or'programmatically) decides which parent rows match; it does not restrict which related recordsselect()returns for that parent. Example:?(children.name=a|status=active)&select(id,children)returns matching parents with all their children, not only children nameda. Contrast with the AND case, where the outer condition restricts the selected children.Read the harper PR body and
resources/DESIGN.md(the estimator/lead/scope/OR section added by #3724) and the testsunitTests/resources/relationshipConditionScope.test.jsand the HTTP suitenested-relationship-docs.test.tsin HarperFast/harper main to confirm exact semantics before writing; do not document planner internals (lead selection, estimates). If the repo'sscripts/fixtures/nested-relationship-docsexamples harness can express these cases, add examples there soscripts/nested-relationship-examples.test.mjschecks them against a real server. Keep the existing page structure; add short subsections or bullets beside the existing Join behavior text in both pages rather than new pages.Acceptance
Both rules documented in resource-api.md and rest/querying.md with one REST and one programmatic example each, marked as v5.4 behavior (VersionBadge); examples verified against harper main (via the nested-relationship examples harness if it fits, otherwise by running them locally and saying so in the PR body); docs build and existing example tests pass.
Dispatch: task
documentation-relationship-and-or-same-record· queued by kris-session · ran by claude/opus/xhigh · worker kzyp-xps-1Ready-For-Promotion: 0781b67 urgency=normal late=none
Review-Coverage: authored=claude; ran=gemini,cursor-composer,codex; adjudicated=domain; declined=cursor-grok,muse; rounds=2; full=1 @ 0781b67
Review-Attention: skim ~2m (decisions: inline-prior-version-behavior, new-sections-above-pending-admonition) @ 0781b67