Skip to content

fix(service-analytics)!: an empty $nin on a related field leaves a detail row with no parent out on the native path, and dashboards.mdx reads the engine path as it is - #34514

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-gebxl9
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-gebxl9

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34384

Clause-②: no (narrowing) — on the native SQL strategy, an empty $nin on a related field ({ 'order.status': { $nin: [] } }) no longer selects a detail row with no parent (an empty relation, or one naming a record that no longer exists), in each of the three filter positions one compile serves: the query's where, a measure's own filter and the dataset's own filter. The engine path and /data already left such rows out. BREAKING banner, FROM → TO and ADR-0087 disposition (not-required (no-migration-prescription)) are in the new changeset.
Metadata-protocol: none
Skills-docs: none — no skills/** file teaches what an empty $nin, or a related-field analytics filter, does with a row that has no parent (git grep of nin: [], empty $nin, orphan and no related record over skills/: no analytics hit). content/docs/ui/dashboards.mdx states the rule.

维护者速读

  • 改了什么:原生 SQL 分析路径上,关联字段的空 $nin({ 'order.status': { $nin: [] } })不再把「没有父记录」的明细行算进去;dashboards.mdx 里四处过时说法改成现状(引擎路径可走三层关系、数据集自身 filter 两条路径都支持、$not 例外的范围、双重 $not 相互抵消)。
  • 为什么改:同一个仪表盘部件,走原生路径时空 $nin 会多数孤儿行(实测 8 行 / 6602),走引擎路径则不数(6 行 / 602),总数随路径变;文档也在描述引擎已经不再有的限制。
  • 风险与回滚:只动 service-analytics 的筛选归一化与原生编译的一个常量分支,同对象字段的语句字节不变;回滚即 revert 本 PR。
  • 先看:packages/services/service-analytics/src/strategies/native-sql-strategy.ts 的 compileFilterNode const 分支;filter-normalizer.ts 空列表折叠处;.changeset/34384-empty-nin-related-field.md。
  • 两分钟验证:pnpm --filter @objectstack/service-analytics exec vitest run src/__tests__/cross-object-negative-orphan.test.ts,预期 31 条全过。
  • 需要你做的:无,席位落地。

What changes

The defect (item 3). The analytics filter normalizer folds an empty $nin to the constant TRUE (filter-normalizer.ts, the empty-list fold of #5134), and the fold dropped the member the leaf was written on. The shared lowering wraps every $nin in its NULL escape, so { 'order.status': { $nin: [] } } compiled on the native path to

(("order"."status" IS NULL AND "order"."id" = "order"."id") OR 1 = 1)

The first arm carries #34335's existing-parent conjunct; the second, a bare 1 = 1, selected every detail row, orphans included. cross-object-where.ts states the contract: "No parent, or one the caller cannot read, never matches, whatever the operator". The engine path respells the dotted leaf as a nested-relation condition before normalization, so it was never affected.

The fix. The empty $nin's TRUE now keeps the member it was written on ({ kind: 'const', value: true, member }, an optional field on the const node). The native compile's const arm, for such a TRUE on a member read through a relationship path, emits the last hop's "ALIAS"."id" = "ALIAS"."id": the same technique as #34335's conjunct, TRUE for an existing parent and UNKNOWN for none, through every hop. The statement is now

(("order"."status" IS NULL AND "order"."id" = "order"."id") OR "order"."id" = "order"."id")

On a base column, or an expression, the constant is still 1 = 1, and that statement is byte-identical to main's. The empty $in's FALSE is unchanged and names no member. Neither the engine path's conversion nor the /analytics/sql echo reads the new field.

Docs and changesets (items 1, 2, 4, 5). content/docs/ui/dashboards.mdx:

DELIBERATE CORRECTION of the unreleased .changeset/33792-cross-object-orphan-native.md (#34335), two sentences:

  • "Under $not the native answer is the one it gave before." now reads "Under one $not the native answer is the one it gave before. Under two, { $not: { $not: { 'order.status': { $null: true } } } }, the two negations now cancel and the answer is the un-negated condition's, so such a row is no longer selected there either, where it was before." (item 5)
  • The "Two native-path answers still select such a row" sentence now reads "One native-path answer still selects such a row, unchanged by this release: under one $not, any condition a missing value does not satisfy, such as a comparison with a value ({ $not: { 'order.status': 'open' } }) or a presence test ($null: false, $exists: true, $ne: null, $empty: false), a shape the engine path refuses; write $ne / $nin inside the condition instead." (item 4; the $nin: [] half moves to this PR's own changeset, which ships in the same release.)

New changeset .changeset/34384-empty-nin-related-field.md (@objectstack/service-analytics: patch, BREAKING banner, ADR-0087 marker not-required (no-migration-prescription)).

Tests

Pins added to the existing harness src/__tests__/cross-object-negative-orphan.test.ts (its fixture: two orphans, l7 with an empty relation and l8 naming a removed parent):

  • order.status $nin [] and order.customer.tier $nin [] (two hops): native, engine and /data select the same lines, the orphans not among them (6 / 602 and 5 / 302);
  • the native statement: the last hop's key in place of 1 = 1 on a joined member (one and two hops), 1 = 1 and no join on a base column;
  • a measure's own filter with $nin: []: native 6, the engine refuses it INVALID_FIELD / 400 as every related field there;
  • the dataset's own filter with $nin: []: 6 / 602 on both faces;
  • $not over $nin: []: no line, before and after;
  • item 5: $not over $not over $null: true answers what $null: true answers (1 / 300).

Tests changed because the fix moved them (the tree shape they pin, not their behaviour): src/__tests__/where-equality-slot-list-refusal.test.ts and src/__tests__/where-face-arms-refusal.test.ts, case "the empty $nin — the TRUE constant": the expected const node now carries member: 'stage'.

Acceptance notes

  • The member gates need no change. The gates read members through collectFilterLeaves, which still reads no member from a constant. The lowering's NULL escape always puts a notSet leaf on the same member beside the empty $nin's TRUE, so every gate already sees it, and the native join's object is already admitted and read-scoped. Measured: the field gate, the relationship-path (include) gate and the engine's measure-filter refusal answer the same refusals on main and on this head for $nin: [] on an unknown field, an unknown related field, an undeclared path, inside $or and in a measure's or the dataset's own filter.
  • The empty $in is left as it was. Its FALSE selects no row, parent or not, and names no member.
  • Bounded in-place fix in the same page: the engine path's "more than 1,000 matching related records are refused" bullet was stale in the same way as items 1 and 2: since analytics: on SQL drivers compile a cross-object where into an in-database semi-join (no 1000-id cap), each hop read-scoped; non-SQL drivers refuse #33626 a SQL datasource runs the related condition as a subquery with no cap. The bullet now says where the 1,000-id cap still applies and links Query Syntax for the full list. It is the same defect class (stale engine-path text), in the same list, in a file no other claim holds.

Verification

All readings at head 63d53d6c (repository objectstack-ai/objectstack), main merged at 24b6ae55.

Premise on main, the fix, and the ablation
  • Premise, on main e8cba8fe with the new pins: Tests 5 failed | 26 passed (31). Native answered { n: 8, total: 6602 } for order.status $nin [] where engine and /data answer { n: 6, total: 602 }; the two-hop case 8 / 6602 against 5 / 302; the native statement was (("order"."status" IS NULL AND "order"."id" = "order"."id") OR 1 = 1).
  • With the fix: cross-object-negative-orphan.test.ts Tests 31 passed (31).
  • Ablation (scripts/ablation-replace.mjs, the native const arm's guard disabled, anchor 1 to 0, blob 8c01a1686390 to 17068e30efb2): Tests 5 failed | 26 passed (31), the same five pins; restored, blob equals HEAD and git diff HEAD empty. The tests import the strategy from src/, so no build sits between the mutation and the run.
  • The item 5 pin ($not over $not over $null: true) passes on main too: fix(service-analytics)!: the native SQL strategy leaves a detail row with no parent out of a cross-object filter, as the engine path does #34335 already made that narrowing; this PR pins and states it.
Package and gates
  • pnpm --filter @objectstack/service-analytics test: Test Files 218 passed (218), Tests 5325 passed | 335 skipped (5660); typecheck: lock verdict command-exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 63d53d6c: 98 commands, each run with stdin closed; --ran reconciliation: 98 run, 0 NOT-MEASURED. Four first answered exit 3 (prerequisite not met: a shallow clone, unbuilt packages, the verify lock busy with the dogfood run) and were re-run after the prerequisite was met: exit 0.
  • One red, by design: check-empty-changeset exit 1 on .changeset/33792-cross-object-orphan-native.md, the DELIBERATE CORRECTION declared above.
Dogfood battery (Clause-② narrowing arm)

At 63d53d6c, closure built, then pnpm --filter @objectstack/dogfood test under the verify lock, no shard and no path: Test Files 478 passed | 3 skipped (481), Tests 4030 passed | 44 skipped (4074), lock verdict command-exit 0 (36m58s).


Generated by Claude Code

…d on an existing parent on the native path

Claude-Session: https://claude.ai/code/session_01ADHkmRhzAMS9So2gFmAV11
Co-authored-by: Claude <noreply@anthropic.com>
…, dataset filter and cap as they are; the $not exception covers every condition a missing value does not satisfy

Claude-Session: https://claude.ai/code/session_01ADHkmRhzAMS9So2gFmAV11
Co-authored-by: Claude <noreply@anthropic.com>
…e two tree-shape pins

Claude-Session: https://claude.ai/code/session_01ADHkmRhzAMS9So2gFmAV11
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 107d2e8497270aad611f77a81bc341f48c6d3e00 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 8585084d7a39b5d3d6c54658f09fbdd338b3513d — the merge of head c0b712ce0b7723252c394e9e18f165773992a164 into base 107d2e8497270aad611f77a81bc341f48c6d3e00, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 8585084d7a39b5d3d6c54658f09fbdd338b3513d && git checkout 8585084d7a39b5d3d6c54658f09fbdd338b3513d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 107d2e8497270aad611f77a81bc341f48c6d3e00 c0b712ce0b7723252c394e9e18f165773992a164 && git checkout -B drift-repro 107d2e8497270aad611f77a81bc341f48c6d3e00 && git merge --no-ff c0b712ce0b7723252c394e9e18f165773992a164

node scripts/docs-audit/affected-docs.mjs --json 107d2e8497270aad611f77a81bc341f48c6d3e00

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 63d53d6 · 2026-11-16T23:41Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 63d53d6cd62f52272f9fa6f0dafb8ffb29fbadf4
Local-runs: none
Scope: packages/services/service-analytics/src/strategies/filter-normalizer.ts, packages/services/service-analytics/src/strategies/native-sql-strategy.ts, packages/services/service-analytics/src/tests/cross-object-negative-orphan.test.ts, packages/services/service-analytics/src/tests/where-equality-slot-list-refusal.test.ts, packages/services/service-analytics/src/tests/where-face-arms-refusal.test.ts + read, not reviewed: packages/spec/src/data/filter-lowering.ts (rule 3, the NULL escape), packages/services/service-analytics/src/strategies/cross-object-where.ts (the contract sentence), packages/services/service-analytics/src/strategies/objectql-strategy.ts (the two other const arms), packages/services/service-analytics/src/drill-window.ts, .changeset/33792-cross-object-orphan-native.md and .changeset/34384-empty-nin-related-field.md (the corrected and new release sentences, judged in ② and ③)

Inputs read: card #34384 body and all six comments, PR #34514 body, file list and both comments, the net diff from merge base 24b6ae55 to the head, the check-runs on the head, and the log of the one failed job.

① Derived judgments

  • Accept set: no filter shape is newly refused or newly accepted. fieldLeaves still accepts an empty $nin and an empty $in; only the node an empty $nin folds to gains a field. Right.
  • Answer set, native SQL strategy: { 'rel.field': { $nin: [] } } on a member read through a relationship path no longer selects a detail row with no parent, in all positions compileFilterNode serves (query where, a measure's filter, the dataset's filter, the read scope and the window share the one compile). The statement changes from (... IS NULL AND key = key) OR 1 = 1 to (... IS NULL AND key = key) OR key = key. Right: a narrowing, and it is the one the card names.
  • Answer set, base column or SQL expression member: joinedParentKey returns null, so the arm falls through to 1 = 1; the notSet leaf beside the constant has already resolved the same member, so the added resolveFieldSql call registers no join the statement did not carry and binds nothing. Statement unchanged. Right.
  • Answer set under one $not: NOT ((IS NULL AND key = key) OR key = key) is FALSE for an existing parent and UNKNOWN for an orphan; main answered FALSE for every row. No row either way. Right.
  • Answer set under two $nots over an empty $nin on a related field: main selected every row, the head selects the rows whose parent exists. A narrowing in the declared direction, stated only generally (N2 below).
  • Public surface: NormalizedFilterNode's const arm gains an optional member. The type is not re-exported from the package index and no file outside service-analytics/src names it. The three other readers of a const node (filterNodeToCondition, renderFilterNodeSql, collectFilterLeaves) and drill-window.ts read kind and value only, so the engine hand-off and the engine echo are unchanged. Additive and internal. Right.
  • notOf folds a constant to a member-less opposite. Right: the fold of a member-carrying TRUE is FALSE, which selects no row, parent or not; and a lone $nin: [] under $not always reaches notOf as the escape's or, never bare (filter-lowering.ts, guardNullPolarity, the allowNull arm).
  • Empty $in: still the member-less FALSE. Right.
  • Member gates: collectFilterLeaves still reads no member from a constant. Verified against the lowering rather than the PR body: outside $not every $nin is moved into the escape, whose first arm is a notSet leaf on the same member; inside $not the spec takes either the escape or a $null: false requirement on the same member (its own conjunct, or the enclosing one that put the field in required). In every shape a leaf on the member sits in the tree, so no member reaches the native join ungated. Right.

② Semver level

  • .changeset/34384-empty-nin-related-field.md grades @objectstack/service-analytics patch, with the ! title, the BREAKING banner, FROM and TO, and the ADR-0087 marker not-required (no-migration-prescription). This matches what the diff publishes: a moved aggregate answer, no schema key, no export shape, no stored value. It is the level the sibling note of analytics: a one-hop cross-object $ne selects an orphan detail row on the native SQL path but not on the engine path, so adding a time bucket changes a widget's total #33792 shipped at.
  • Clause-②: no (narrowing) on the claim, the PR body and the changeset, and it is the true line: no packages/spec/src/** path is in the diff, and the diff narrows an answer. Metadata-protocol: none is true.
  • Gate verdicts read from the failed job's log, whose later steps ran past the designed red: ADR-0087 registration passed (1 declared-breaking changeset, disposition accepted), the major guard passed (no major), the level axis passed (no (narrowing) at patch), protocol lockstep passed.

③ Boundary flags

  • Dev deviation, file surface: the root is the fold in filter-normalizer.ts, not packages/spec/src/data/filter-lowering.ts. Answered: confirmed in the tree; the lowering passes $nin: [] through inside its escape and the normalizer is what dropped the member. The claim was amended before the edit (card comment 6931188630) and spec is untouched.
  • Dev deviation, the 1,000-record cap bullet in dashboards.mdx: prose face, not reviewed here; it is the lane seat's to accept.
  • Dev deviation, the two forced test edits: answered. Both pin the tree shape of the empty $nin, which now carries member: 'stage'; behaviour pinned by neither moved.
  • Dev deviation, the dropped --maxWorkers flag on the first local run: no contract effect.
  • open_questions: none in the dev report.
  • SQL push-down: no finding. The fix is a predicate on a LEFT JOIN the statement already carries. No id materialisation and no in-app join is added.
  • Check Changeset red on this head, claimed by design. The log shows one cause only: the foreign-changeset refusal of scripts/check-empty-changeset.mjs on .changeset/33792-cross-object-orphan-native.md. Against the three conditions (pm-dispatch SKILL.md):
    1. Source-declared: stands. scripts/check-empty-changeset.mjs states the DELIBERATE CORRECTION class is refused and left red on a pushed branch, and that the seat's record confirms it.
    2. No merge_group run: stands. The job lives in .github/workflows/pr-automation.yml, whose only trigger is pull_request.
    3. A PR comment naming the gate and the cause: NOT met at the time of this reading. The PR carries two comments, the docs-drift report and the review claim; neither names the gate. The PR body declares it, and a body is not a comment. This record names the gate and the cause; posted as a comment on the PR it meets the condition, posted on the card it does not, and the seat then owes a separate PR comment before the PR is queued red.
  • Confirmation of the correction (landing-operations.md, the code-changing class: this same-head record judges each rewritten sentence of the one changed note, .changeset/33792-cross-object-orphan-native.md):
    • Sentence 1, before: "Under $not the native answer is the one it gave before." After: "Under one $not the native answer is the one it gave before. Under two, [...] the two negations now cancel and the answer is the un-negated condition's, so such a row is no longer selected there either, where it was before." Judged true. $null is total, so the lowering leaves it alone under both negations; the leaf compiles to IS NULL AND key = key, UNKNOWN for an orphan, and NOT (NOT UNKNOWN) is UNKNOWN. Before fix(service-analytics)!: the native SQL strategy leaves a detail row with no parent out of a cross-object filter, as the engine path does #34335 the inner NOT was FALSE and the outer TRUE. The correction is owed by fix(service-analytics)!: the native SQL strategy leaves a detail row with no parent out of a cross-object filter, as the engine path does #34335, not by this diff, and card item 5 asks for it.
    • Sentence 2, before: "Two native-path answers still select such a row [...]: a positive comparison under $not [...], and $nin: [], which folds to the constant TRUE [...]". After: "One native-path answer still selects such a row, unchanged by this release: under one $not, any condition a missing value does not satisfy, such as a comparison with a value [...] or a presence test ($null: false, $exists: true, $ne: null, $empty: false) [...]". Judged true. The $nin: [] half is falsified by this PR and moves to the new note, pending in the same release. The widened $not wording is right: under $not such a spec takes a $null: false requirement, the set leaf is not in NULL_SATISFIED_LEAF_OPERATORS, so it is FALSE for an orphan and the NOT selects it.
    • Restoring either sentence from the base would republish a false statement. The correction is deliberate, not a filename collision.
  • Check-runs on the head, at reading: Check Changeset failure (above). Success: Lint ESLint, Lint PM dispatch-gates, Lint scoped tooling self-tests, Type Check source gates, Live E2E UI, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Check Documentation Links, Flag docs affected by code changes, Plan Test Core shards, Check PR Size. PENDING, and so no verdict: Test Core 1/8 to 8/8, Build Core, Build Docs, Type Check workspace, Type Check consumer gates, Type Check debt ledger, Lint repo and tooling gates, Lint docs and code guards, Lint CI release and engine gates, Lint scoped query-options erasure, Lint scoped slot lookup and corpus. The new pins run in Test Core; their result is the dev's local reading until those shards conclude. This PASS is on the contract and attests no pending gate.

④ Design judgment

The narrowing, read against the published contract on main: cross-object-where.ts says "No parent, or one the caller cannot read, never matches — whatever the operator, $ne / $nin / $null: true included". The engine path and /data already answer an empty $nin on a related field that way. The native path was the one face that did not, and #34335 recorded it as an exception. So this diff takes no declared capability away at a consumer: it makes the spec's own refusal real on the last face, and the way back for an author ($or with the base relation field) is stated in the changeset.

Attempts to break it, all read in the head tree:

  • A constant with a member and no leaf on that member, which would let the native compile register a join no gate saw. Not reachable: see the member-gate judgment in ①. Checked for a lone $nin: [], a mixed spec under $not ({ $nin: [], $eq: 'x' }, { $nin: [], $in: [] }), an author-written escape, and a field already in required.
  • A row selected at the head that main left out. Not possible: the change replaces TRUE with a value that is TRUE or UNKNOWN, and under Kleene logic that turns no FALSE row TRUE at any depth of NOT, AND or OR. Outside an even number of negations it can only remove orphans.
  • params alignment and the absorbing or. The new arm binds nothing and returns a string, so the or restore of params and joins is as before.
  • The mixed spec under one $not, { $not: { 'order.status': { $nin: [], $eq: 'x' } } }. Main and head both select the orphan (NOT (FALSE AND ...)), which is the documented one-$not exception. Unmoved.
  • Two hops. joinedParentKey returns the last hop's key, NULL when any hop reached no row; the test pins the two-hop statement and answer.
  • The engine echo printing 1 = 1 where the native statement prints the key. Not reachable: the engine path carries a dotted related leaf as a relation node, which the echo declines.

No must-fix, no should-fix.

  • N1 (nit) — the jsdoc on the const arm in filter-normalizer.ts and the comment in collectFilterLeaves say the member is always named by the escape's notSet leaf. Inside $not with a mixed spec there is no escape; the member is named by the $null: false requirement and the sibling leaf instead. The conclusion the comments draw holds; the stated reason is incomplete. No effect on correctness. Not on a prose face: left as an accepted deviation or a follow-up card, since a fix moves the head.
  • N2 (nit) — .changeset/34384-empty-nin-related-field.md says "Under $not an empty $nin on a related field selected no row and still selects none", which holds for one $not. Under two, the answer moves from every row to the rows whose parent exists. The direction is the declared one, and the corrected analytics: a one-hop cross-object $ne selects an orphan detail row on the native SQL path but not on the engine path, so adding a time bucket changes a widget's total #33792 note and dashboards.mdx state in general that two $nots cancel, in the same release. Fixable on the prose face by writing "Under one $not", or left as it is.

Implemented-by: claude/project-thread-gebxl9
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRfW5u1LRmhWwaYHRp

Final head for review: 63d53d6cd62f52272f9fa6f0dafb8ffb29fbadf4. Local: 98 derived gates, 98 run, 0 NOT-MEASURED (report 6932754856 on #34384); the one designed exit 1 is check-empty-changeset on .changeset/33792-cross-object-orphan-native.md, the DELIBERATE CORRECTION class declared in the PR body. Dogfood battery at this head: 478 files passed, 3 skipped, lock verdict command-exit 0. CI at this head: 53 check-runs, 37 success, 15 skipped, 1 failure, and that failure is Check Changeset with the designed cause only, as L2 read it from the job log. L2: PASS 6932908866 at this head. Nits N1 and N2 stay as accepted deviations; a review follow-ups card is owed after landing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQVWXw7KT8ThxT4CBy

席位核对

L1 verdict: ACCEPT · PR #34514 · card #34384 · first review · read 2026-11-17T01:01Z

Head-sha: 63d53d6cd62f52272f9fa6f0dafb8ffb29fbadf4 (the head named in final-head comment 6934382705)

Read from GitHub at this head (get_files, diff, check-runs, the failed job's workflow and gate source), not from the report.

Checklist

  • Shape: draft, base main, title carries !. The body opens with the attribution lines and then Fixes #34384, and all five card items are delivered. No other card number sits next to a closing verb.
  • Declarations: Clause-②: no (narrowing) appears in the PR body, the new changeset and the claim, with Metadata-protocol: none. Skills-docs: none is present and backed by a stated git grep of skills/. The BREAKING banner, FROM → TO and the ADR-0087 marker not-required (no-migration-prescription) are in .changeset/34384-…md.
  • Scope: 8 files. Source changes are filter-normalizer.ts (the empty $nin's TRUE keeps member) and native-sql-strategy.ts (the const arm emits the last hop's key = key for such a TRUE on a joined member). The rest are three tests, two changesets and content/docs/ui/dashboards.mdx. No content/docs/releases/.
  • Existing tests: two lines changed, one each in where-equality-slot-list-refusal.test.ts and where-face-arms-refusal.test.ts. Both are the empty-$nin tree-shape pin, which now carries member: 'stage'. That is a forced shape update; no behaviour either file pins moved.
  • Gates: 53 check-runs on this head, all completed: 37 success, 15 skipped, 1 failure. Lint & Repo Gates success, TypeScript Type Check success, Test Core success, Dogfood Regression Gate success. The one failure is Check Changeset, below.
  • (narrowing) battery: the dev report 6932754856 records the full dogfood battery at 63d53d6c (478 files passed, 3 skipped; 4030 tests passed; lock verdict command-exit 0). It is pinned to this head and is a full run.

Check Changeset red: by design, all three conditions stand (my own reading)

  1. Source-declared: scripts/check-empty-changeset.mjs (:127, :560, :572) names the DELIBERATE CORRECTION class. It says not to restore the note, to declare the correction on the PR, and that the dispatching seat confirms it by its own record.
  2. No merge_group run: the job is in .github/workflows/pr-automation.yml, whose only trigger is pull_request.
  3. A PR comment names the gate and the cause: L2 record 6932908866 and final-head comment 6934382705, both on this PR. The body declares the correction too (line "DELIBERATE CORRECTION of the unreleased .changeset/33792-…md").

Prose faces, sentence by sentence (dashboards.mdx; the changeset sentences are covered by L2 ② and checked again here)

  • Path table, engine row "Up to three relationships (ADR-0071's hop limit), each read as the caller": true. CROSS_OBJECT_WHERE_MAX_HOPS = 3 (cross-object-where.ts:95), and objectql-strategy.ts:277 refuses past it.
  • Refusal bullet "a path of four or more relationships (line.plan.order.customer.tier)": true. The refusal fires on segments.length - 1 > 3 (cross-object-where.ts:206), and the example has four hops.
  • "$nin: [] (an empty list, which excludes no value) selects every row whose related record exists": true at this head. The native compile now emits "ALIAS"."id" = "ALIAS"."id" in place of 1 = 1 for a joined member; the engine path already matched.
  • "One native-path exception remains, under $not … one a missing value does not satisfy, such as a comparison with a value … or a presence test ($null: false, $exists: true, $ne: null, $empty: false)": true, per L2 ② (a set leaf is not in NULL_SATISFIED_LEAF_OPERATORS).
  • "Two $nots cancel": true, per L2 ② (NOT (NOT UNKNOWN) is UNKNOWN for an orphan).
  • "A related field in a dataset's own filter is evaluated on both paths … a measure's own filter is still evaluated only on the native SQL path": true. objectql-strategy.ts:597 and :1294 serve the dataset filter's cross-object leaves (analytics: on SQL drivers compile a cross-object where into an in-database semi-join (no 1000-id cap), each hop read-scoped; non-SQL drivers refuse #33626), and the measure filter refusal is unchanged.
  • The 1,000-record bullet: the second sentence (ids read first for another datasource, a federated object, or a driver with no subquery, cap 1000, 400 INVALID_FILTER, never truncated) matches content/docs/protocol/objectql/query-syntax.mdx:705-720. Deviation D1, accepted: the opening clause "On a SQL datasource the related condition runs inside the same statement, as a subquery, so the number … is not limited" is broader than query-syntax.mdx:715-725. There, a related object on a SQL datasource still keeps the id read and its cap when an object-scoped middleware or afterFind hook shapes its reads, or when it is read under different driver options (its tenant scope). The bullet points to that list ("the full list is in Query Syntax"), so a reader is not left with a wrong rule, but the opening clause should say "usually" or name those cases. Not REWORK: moving the head for one clause would re-open L2 and CI. It goes on the same follow-up card as L2's N1/N2.

Spot checks (mine)

  1. On a base column or an expression, joinedParentKey returns nothing, so the constant is still 1 = 1 and the statement is byte-identical to main (the body's claim). The empty $in is still the member-less FALSE.
  2. resolveFieldSql is called in the new const arm only for its side effect: it registers the path's joins before joinedParentKey reads them, the same order the leaf arm uses. It binds nothing, so no parameter index shifts.
  3. Under one $not, the escape (notSet AND key=key) OR key=key is UNKNOWN for an orphan and TRUE for an existing parent, so NOT selects neither. That matches the new changeset's "Under $not … still selects none" for one negation. See N2 below for two.

Accepted deviations, owed as ONE follow-up card after landing: L2's N1 (the jsdoc reason in filter-normalizer.ts / collectFilterLeaves is incomplete inside $not with a mixed spec), L2's N2 (the new changeset's "Under $not" holds for one negation; the same release's corrected #33792 note and dashboards.mdx state that two cancel), and D1 above.

L2 owed: yes, and on record. It is owed at CONTRACT_REVIEW_TIER because of the (narrowing) declaration. The record is PASS 6932908866 at this same head (claim 6932800650), with no must-fix and no should-fix.

Landing tier: check-governed-merges.mjs --pr 34514 reports NOT governed, +157/−26 = 183 lines ≤ 3000. Ordinary queue landing by the area at this head, queued with the one designed red named above.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRfW5u1LRmhWwaYHRp

Landing · Head-sha: c0b712c · ACCEPT → comment 6934430234 (at 63d53d6) · contract review PASS 6932908866 (at 63d53d6)

The head moved from 63d53d6 only by a relay pr_update_branch (merge of main, K was 16): git patch-id --stable of the PR's own diff is 2bf2982f… at both heads, so the ACCEPT and the contract record carry over (area-lease rule: same patch-id clean main merge keeps ACCEPT).

Probe Reading
check-governed-merges --pr 34514 NOT governed; +157/−26 = 183 lines ≤ 3000
check-runs at this head 53 runs: 37 success, 15 skipped, 1 failure; K = 9 from PRBASE 107d2e8
the one red Check Changeset, non-required, check-empty-changeset on .changeset/33792-cross-object-orphan-native.md only: the DELIBERATE CORRECTION confirmed by L2 6932908866 and L1 6934430234; it runs on pull_request only, never merge_group
dogfood battery full run at this head c0b712c: 478 files passed, 3 skipped; 4030 tests passed; lock verdict command-exit 0 (report on #34384)

State: ready for review and auto-merge enabled with the designed red; #34384 closes with the merge (Fixes).

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

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analytics: review follow-ups of PR #34335 (dashboards.mdx stale engine-path text, and $nin: [] selects orphans on the native path)

2 participants