Skip to content

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

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/area-A3-33792
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/area-A3-33792

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #33792

Clause-②: no (narrowing) — on the native SQL strategy, a cross-object where leaf that a NULL satisfies ($ne, $nin, $notContains through the lowering's NULL escape, $null: true, $eq: null, $exists: false, $empty: true) 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. $exists: false lowers to the same notSet leaf and moves with $null: true. 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 changeset.
Metadata-protocol: none
Skills-docs: none — no skills/** file teaches what a related-field analytics filter does with a row that has no parent (git grep of orphan, no related record and relationship.field over skills/: no analytics hit; objectstack-ui/rules/dashboards.md says only "filter by a parent's attribute → a dimension", which stays true). content/docs/ui/dashboards.mdx now states the rule for the native path too.

维护者速读

  • 改了什么:分析服务的原生 SQL 路径在按关联对象字段过滤(如 order.status $ne 'open')时,不再把"没有父记录"的明细行算进去;引擎路径和 /data 本来就不算。
  • 为什么改:同一个仪表盘组件,加不加时间分桶会走不同路径,原生路径多算孤儿明细,合计数随分桶而变(卡片实测 6/1500 对 5/500)。
  • 风险与回滚:只影响原生路径上"NULL 也能满足"的关联叶子($ne/$nin/$notContains 的 NULL 兜底分支、$null: true、$eq: null、$exists: false、$empty: true),查询 where、度量自带 filter、数据集自带 filter 三处同变,这些叶子多一个 父表.id = 父表.id 条件(父记录存在为真、孤儿为未知,所以外层 $not 翻不成真);正向比较的 SQL 一字不变,$not 下的结果与改动前相同。依赖旧行为(把孤儿算进去)的看板合计会变小;回滚 = revert 本 PR。
  • 先看:packages/services/service-analytics/src/strategies/native-sql-strategy.ts(compileFilterNode 的 leaf 分支与 NULL_SATISFIED_LEAF_OPERATORS、joinedParentKey)、src/__tests__/cross-object-negative-orphan.test.ts、changeset 的 FROM → TO 段。
  • 两分钟验证:pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/cross-object-negative-orphan.test.ts,预期 Tests 24 passed (24)。
  • 需要你做的:无,席位落地。

What changes

  • native-sql-strategy.ts compileFilterNode, leaf arm: when the leaf's member is read through a relationship path (it registered a LEFT JOIN) and its operator is one whose compiled clause a NULL column can satisfy, the clause becomes (CLAUSE AND "HOP"."id" = "HOP"."id") (round 1; it was ("HOP"."id" IS NOT NULL AND CLAUSE) at 6509c8617c), where HOP is the last hop's join alias from resolvePathHops, the one resolver the join itself reads (order, order__customer). Added only around a clause that bound, so params stays aligned.
  • NULL_SATISFIED_LEAF_OPERATORS = notSet (the lowering's col IS NULL escape arm, $null: true, $eq: null), empty (col IS NULL OR …), notContains (the constant TRUE on a non-text column, NOT EXISTS (… json_each(col) …) on a JSON-stored one). Every other operator compiles to a comparison that is UNKNOWN on a NULL, or to IS NOT NULL, so it never selected an orphan; its statement is byte-unchanged (the existing SQL pins in infer-cube-relation-traversal, infer-cube-where-spelling-parity, dataset-filter-object-field-binding and filter-normalizer-not-null-safe stay green untouched).
  • joinedParentKey (new private helper): the last hop's "ALIAS"."id", or null for a base column or an SQL expression.
  • content/docs/ui/dashboards.mdx: the no-parent rule, stated before for the engine path only, now covers the native path.

Premise re-measured: #33652 (relation semi-joins on find verbs) did not reach this compile. On origin/main 5a755791a9 the native face still selected both orphans while the engine face and /data did not (table below).

Tests

New file src/__tests__/cross-object-negative-orphan.test.ts, on driver-sql / better-sqlite3 in process, through the plugin's own composition: one native-face service and one engine-face service (nativeSql: false) over the same engine, and the engine's own nested-relation find as the /data control. Fixture: two orphans, l7 (empty relation) and l8 (its parent deleted behind the engine), and a parent o3 that exists with no status and no customer.

Red first, on origin/main's strategy source (git restore --source=5a755791a9) with the new test, at count / sum(amount):

where native, before engine and /data (and native, after)
order.status $ne 'open' / $nin ['open'] / $notContains 'pe' 6 / 6600 4 / 600
order.status $null: true / $eq: null / $empty: true 3 / 6300 1 / 300
order.status $ne 'cancelled' 5 / 6302 3 / 302
order.customer.tier $ne 'gold' (two hops) 6 / 6600 3 / 300
order.customer.tier $null: true (two hops) 3 / 6300 0 / 0
order.status $eq 'cancelled' (positive control) 3 / 300 3 / 300

Before: Tests 11 failed | 1 passed (12) (the positive control passes). Only the native face failed: zero objectql: or /data assertion failures in the red log. After: Tests 12 passed (12).

Ablation (one-shot, not committed): notSet taken out of NULL_SATISFIED_LEAF_OPERATORS through scripts/ablation-replace.mjs (anchor 1 → 0, injected marker 0 → 1, blob 4ccddcfd54a3 → ddc23e5a6448) gives Tests 10 failed | 2 passed (12): every case the escape arm carries goes red, and the two that stay green are $empty: true (its own empty entry) and the positive control. Restored by the same tool: blob back to 4ccddcfd54a3 = HEAD, git diff HEAD empty; re-run 12 passed (12). The test imports the strategy by a relative path into src/, so no dist/ sits between the mutation and the run.

Package suite and typecheck
  • pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2: Test Files 216 passed (216), Tests 5245 passed | 335 skipped (5580), exit 0.
  • pnpm --filter @objectstack/service-analytics typecheck: exit 0.

Acceptance notes

  • $not over a cross-object leaf: a $not operand reaches the leaf arm with notSet, empty and notContains leaves too (the lowering leaves $null, $empty and a null $eq alone under $not, and escapes $ne / $nin / $notContains). At 6509c8617c the conjunct was FALSE for an orphan, so NOT selected it, a widening caught in review. From round 1 the conjunct is id = id, which is UNKNOWN for an orphan; under Kleene logic that never turns a row the compile left out into a selected one, so the $not answer is main's. A positive comparison under $not ({ $not: { 'order.status': 'open' } }) still selects an orphan, as on main; the engine path refuses the shape (negated).
  • Two native answers still select an orphan. Both are unchanged by this PR, stated in the docs and the changeset, and not closed here. One is a positive comparison under $not: native 6 / 6600 on main and at this head, and the engine refuses the shape. The other is $nin: [], which folds to the constant TRUE: native 8 / 6602 (every line) on main and at this head, where the engine face answers 6 / 602 and /data answers l1-l6. That second one is a native-versus-engine disagreement of its own, reported to the seat.
  • An unreadable parent is outside this change. On the native path a joined object's read scope is its own WHERE conjunct, unchanged here.
  • content/docs/ui/dashboards.mdx's path table still says the engine path reaches "one relationship" and that a path of two or more relationships is refused. The 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 changeset says the engine now serves up to three. That sentence is outside this card's surface, so it is noted here and not edited. A second stale sentence is on the same page, in the same family. The paragraph after the orphan rule says the engine path refuses a related field in a dataset's own filter (400 INVALID_FIELD). Measured here through queryDataset on the engine face (nativeSql: false), a dataset filter of { 'order.status': { $null: true } } is answered (1 / 300), not refused. A measure's own filter is refused as stated. Not edited; reported to the seat with the depth text.

Fix round 1

Review M1 (comment 6911858976): under $not the IS NOT NULL conjunct selected orphans main left out.

  • native-sql-strategy.ts L2245-2271: the conjunct is now (CLAUSE AND "HOP"."id" = "HOP"."id"). That is TRUE for an existing parent and UNKNOWN for an orphan, so a NOT cannot flip it. Replacing TRUE with UNKNOWN is monotone in Kleene logic, so no row the compile left out before is selected at any depth of NOT, AND or OR. Outside NOT, UNKNOWN selects exactly what FALSE selects, so the un-negated answers are unchanged. x = x on a primary-key column is standard SQL, NULL on NULL in SQLite, PostgreSQL, MySQL and SQL Server. I chose it over a negated flag through compileFilterNode because the flag would have to decide a meaning per depth, while the UNKNOWN conjunct gives main's $not answer by construction.
  • New pins (native face only): $not over $null: true, $eq: null, $empty: true, $notContains 'pe', $ne 'open', inside $or and $and under the NOT, and over two hops. Each is held to main's answer, and $not {$null: true} must equal $null: false. The two SQL pins now read the new conjunct.
  • content/docs/ui/dashboards.mdx and the changeset now say "outside $not", and that a positive comparison under $not still selects such a row.

Measured in round 2 (below). Every hand-derived $not value held; no pin value changed.

Fix round 2

Takeover round: round 1 measured, and the review's S1, S2, N1 and N2 applied. Head b779b7f25e. No change to native-sql-strategy.ts this round.

  • S1: the changeset's BREAKING notice names the three filter positions one compile serves: the query's where, a measure's own filter (its conditional aggregate) and the dataset's own filter. The docs sentence names them too. New pins: a measure filter of $ne 'open' (native only, because the engine refuses that position) and a dataset filter of $null: true (native and engine). On main's strategy the native face answered 6 / 6600 and 3 / 6300. At this head it answers 4 / 600 and 1 / 300.
  • S2: "whatever the operator" is gone from the docs sentence, the changeset and the test header. Both exceptions are now stated, measured and not closed in code. A positive comparison under $not still selects an orphan: native 6 / 6600 on main and here, and its statement is byte-identical. $nin: [] lowers to (("order"."status" IS NULL AND "order"."id" = "order"."id") OR 1 = 1), which is TRUE for every row: native 8 / 6602 on main and here. The engine face answers 6 / 602 and /data l1-l6.
  • N1: the docs and the changeset now say the $or with { order: { $null: true } } brings back rows with an empty relation. A row naming a record that no longer exists is not brought back. The existing pin's expected set (l3-l7, no l8) already said so.
  • N2: $exists: false is in the operator lists. Measured: it lowers to "order"."status" IS NULL AND "order"."id" = "order"."id" (the notSet leaf). On main it answered 3 / 6300; at this head it answers 1 / 300, equal to the engine. It is pinned on all three faces.
Round-1 measurement: the test file against three strategy sources

The test file was the same each time (round 1's 21 cases). Only native-sql-strategy.ts was swapped, tree-only (git restore --source=REF), then restored with git checkout HEAD --. Restore was proven each time by blob = HEAD 37ce29eca260 and an empty git diff HEAD.

  • At f2b0b56f3f (round-1 head): Tests 21 passed (21).
  • Main's source 5a755791a9 (blob 854df5b5f4f2): Tests 11 failed | 10 passed (21). The 11 red are the un-negated narrowing cases. The 10 green are all 8 $not pins, the $not {$null: true} = $null: false pin and the positive control. So every hand-derived $not value equals main's measured answer, and no pin value changed.
  • Round-0 source 6509c8617c (blob 4ccddcfd54a3): Tests 9 failed | 12 passed (21). Red: 7 of the 8 $not pins, the equality pin and the SQL-text pin. $not $ne 'open' stays green there, as the review predicted, because the escape arm under NOT is UNKNOWN either way.

With round 2's pins (24 cases), main's source gives Tests 14 failed | 10 passed (24): the three new pins are red there too. At this head: Tests 24 passed (24).

Ablation on the negation guard (one-shot, not committed)

node scripts/ablation-replace.mjs replaced the anchor `(${clause} AND ${parentKey} = ${parentKey})` with `(${clause} AND ${parentKey} IS NOT NULL)`. The tool's on-disk evidence: anchor 1 → 0, replacement 0 → 1, blob 37ce29eca260 → 2f756be31b88. Result: Tests 9 failed | 12 passed (21), the same nine as at 6509c8617c (every $not pin but $not $ne 'open', the equality pin and the SQL-text pin). The tool then restored the file: blob back to 37ce29eca260 = HEAD, git diff HEAD empty. The test imports the strategy by a relative path into src/, so no dist/ sits between the mutation and the run.

Package suite, typecheck and gates at b779b7f
  • pnpm --filter @objectstack/service-analytics test: Test Files 216 passed (216), Tests 5257 passed | 335 skipped (5592). typecheck (tsc --noEmit, include: ["src"], so it compiles the test file): exit 0. Lock verdict command-exit 0.
  • Local subset of the derived families, each exit 0: check:test-source-alias, check:nul-bytes, check:doc-authoring, check:issue-citations, check-adr-0087-registration --base origin/main (exemption no-migration-prescription read), check-empty-changeset, check-changeset-no-major, check-affected-docs, check-closing-keyword-parity, check:cross-package-test-inputs, check:docs-single-h1, check:doc-anchors. dispatch-gates --ran: 12 of 97 derived families run locally. The other 85 are declared to CI, which runs the farm.
  • check-governed-merges.mjs --pr 34335: 0 of 4 paths governed, +405 / -1 at the time of reading. Ordinary queue landing applies.
  • Lint & Repo Gates and TypeScript Type Check on 85d43a40 concluded failure only because their aggregators read 16 lanes cancelled. Actions run 43847650486 concluded cancelled when b779b7f25e was pushed. No lane concluded failure on that head.
  • Dogfood battery (title ! with a (narrowing) arm): closure pnpm --filter '@objectstack/dogfood^...' build command-exit 0, then pnpm --filter @objectstack/dogfood test under the lock at b779b7f25, with no shard and no path: Test Files 473 passed | 3 skipped (476), Tests 4003 passed | 42 skipped (4045), lock verdict command-exit 0 (40m07s, shared box). No failures.

Verification

Before push: no open pull request touches native-sql-strategy.ts. All 61 open pull requests were read through the REST files listing, so there was nothing to merge-tree against. Round-2 gate readings are in Fix round 2 above and in the report comment on the card.

🤖 Generated with Claude Code

…orphan detail row on both strategies

Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com>
…parent in the native SQL strategy

Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com>
…ops and a dangling parent; add the changeset

Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com>
…ed leaf a NULL satisfies

Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
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

6 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 2c96e0dfc9297ba791c8acb6484ebe678dfd7d12 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7abf97ca5fcadb360b0ca8e4ec73f9cb59e3e227 — the merge of head b779b7f25e652b22bb791c46a6e58c52ec183c37 into base 2c96e0dfc9297ba791c8acb6484ebe678dfd7d12, 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 7abf97ca5fcadb360b0ca8e4ec73f9cb59e3e227 && git checkout 7abf97ca5fcadb360b0ca8e4ec73f9cb59e3e227
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2c96e0dfc9297ba791c8acb6484ebe678dfd7d12 b779b7f25e652b22bb791c46a6e58c52ec183c37 && git checkout -B drift-repro 2c96e0dfc9297ba791c8acb6484ebe678dfd7d12 && git merge --no-ff b779b7f25e652b22bb791c46a6e58c52ec183c37

node scripts/docs-audit/affected-docs.mjs --json 2c96e0dfc9297ba791c8acb6484ebe678dfd7d12

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head 6509c86 · 2026-11-16T08:48Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

Request: review · PR #34335 · area S2 (A3) · Fixes #33792 · head 6509c8617c1a6cfd03f1c5869ed967621a38c3ee (declared final) · L1 review-b, L2 CONTRACT_REVIEW_TIER

  • Face: Clause-②: no (narrowing), Metadata-protocol: none, patch on @objectstack/service-analytics with a BREAKING banner, a FROM → TO and the ADR-0087 marker not-required (no-migration-prescription). The L2 contract review is owed for the runtime narrowing. check-governed-merges reads it NOT governed: +319/-1 over 4 files, K=9 behind main.
  • os-dev report 6911709306. Premise re-measured red first on origin/main 5a755791: feat(objectql): a nested-relation condition on a read verb is one read-scoped in-database subquery per relationship, up to three, where it is provably the same read as the id read #33652 did not reach the native compile. Checks at head: 38 success / 15 skipped / 0 failure.
  • Points for the reviewer:
    • On a joined leaf whose operator a NULL satisfies (notSet, empty, notContains after lowering: $ne, $nin, $notContains, $null: true, $eq: null, $empty: true), compileFilterNode now conjoins the last hop's id IS NOT NULL. The alias is read from resolvePathHops, so two hops read the right join. Positive leaves are byte-unchanged and no existing SQL pin moved.
    • A first cut that wrapped every joined leaf turned 10 pins in 4 files outside the claimed surface red, so the guard was narrowed to the NULL-satisfied set rather than editing those pins.
    • The new test (12 cases) runs a native face, an engine face and engine.find as /data on driver-sql/better-sqlite3 in process. On main's strategy, 11 fail and the positive control passes. Removing notSet from the set turns 10 red.
    • content/docs/ui/dashboards.mdx L535–540 states the rule for the native path.
  • Dev boundary notes (not filed):

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review claim · head 6509c86 · 2026-11-16T08:51Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6509c8617c1a6cfd03f1c5869ed967621a38c3ee
Local-runs: none
Scope: packages/services/service-analytics/src/strategies/native-sql-strategy.ts, packages/services/service-analytics/src/tests/cross-object-negative-orphan.test.ts, .changeset/33792-cross-object-orphan-native.md, content/docs/ui/dashboards.mdx + packages/services/service-analytics/src/strategies/cross-object-where.ts, packages/services/service-analytics/src/strategies/filter-normalizer.ts, packages/spec/src/data/filter-lowering.ts, packages/services/service-analytics/src/tests/filter-normalizer-not-null-safe.test.ts
Security-touching: no

① Derived judgments

  • Right: on the native SQL strategy, outside $not, a detail row with no parent (empty relation, or a dangling reference) is no longer selected by a cross-object leaf lowered to notSet, empty or notContains. That covers $ne a value, $nin and $notContains (through the notSet escape arm rule 3 of filter-lowering.ts lays around them), $null: true, $eq: null, $empty: true, and also $exists: false (same notSet leaf; not named in the changeset). The wrapped clause reads ("HOP"."id" IS NOT NULL AND CLAUSE); the last hop's alias comes from resolvePathHops, the resolver qualifyAndRegisterJoin reads, so two hops read "order__customer"."id".
  • Right: positive leaves (equals, in, gt, gte, lt, lte, contains, startsWith, endsWith, icontains), set, notEmpty, notEquals and notIn take no conjunct, so their statements are byte-unchanged. A leaf on a base column or an SQL expression gets null from joinedParentKey and is unchanged. The diff touches no engine-strategy file. A parent that exists with a NULL field still satisfies the leaf.
  • Wrong, M1: "nothing else moves" does not hold under $not. compileFilterNode wraps a null-satisfied joined leaf wherever it sits, including inside a not node, where the guard inverts. { $not: { 'order.status': { $null: true } } } was NOT ("order"."status" IS NULL) (orphan FALSE, not selected) and is now NOT (("order"."id" IS NOT NULL AND "order"."status" IS NULL)) (orphan TRUE, selected). Same for $eq: null, $empty: true, $exists: false under $not, and for $notContains on a non-text or JSON-stored column under $not (both arms of the escape become FALSE for the orphan). $not over $ne a value or $nin does not move (UNKNOWN stays unselected). The PR body's acceptance note that a $not operand's leaves "are positive or set" is false: nullGuardForFieldSpec returns none for a total spec and leaves it as written, and filter-normalizer-not-null-safe.test.ts pins NOT ("stage" IS NULL) for $not over $eq: null and a joined member under $not on this strategy.
  • Wrong, S1: the moved surface is wider than "where". The same compileFilterNode compiles a measure's own filter (the conditional aggregate) and the dataset's own filter, both of which dashboards.mdx says are evaluated only on the native path when they read a related field. Their totals move the same way; the changeset's BREAKING notice names where alone.

② Semver level

  • '@objectstack/service-analytics': patch with ! in the title, a BREAKING banner, FROM → TO, a one-line fix, Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset, and one ADR-0087 marker not-required (no-migration-prescription): this is the shape AGENTS.md on main prescribes for a non-protocol breaking change (none takes patch and keeps its banner and disposition). No schema key or export changes, so Metadata-protocol: none and the marker's reason are right. Check Changeset and Lint & Repo Gates concluded success on this head.
  • The level is not the problem; the declaration's content is. Per M1 the diff also widens (orphans newly selected under $not of a null-satisfied leaf), which no (narrowing) and the FROM → TO do not state, and per S1 the FROM → TO names one of three filter positions that move.

③ Boundary flags

  • open_questions: empty; nothing to answer.
  • Dev flag, stale depth text in dashboards.mdx (engine path "One relationship", two or more refused, while 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 serves up to three): agreed that it is outside this card's surface and correctly not edited here. It is noted with no carrier; escalated to the seat to file it, since the page is now touched by this PR and still states the stale depth.
  • Dev flag, $not over a cross-object leaf "unchanged by this PR": not accepted, see M1.
  • Dev deviations (HTML comment lines in the PR body, commit trailers without a model name): process matters for the dispatching seat, no effect on the contract.
  • SQL push-down (Prime Directive 5): held. The fix is one conjunct on the join the statement already carries; no id materialisation, no in-app filter, no second query.
  • Check-runs on this head: every run concluded success or skipped (Test Core 8/8, TypeScript Type Check, Lint & Repo Gates, Build Core, Dogfood Regression Gate, Check Changeset, Governed Surface Queue Guard, Spec property liveness). The gates do not see M1: the new test file has no $not case.

④ Design judgment

  • The narrowing itself is declared semantics, not a new choice. cross-object-where.ts on main states "No parent, or one the caller cannot read, never matches, whatever the operator, $ne / $nin / $null: true included", and dashboards.mdx on main says the same for the engine path. So $null: true and $empty: true leaving the orphan out is the published reading (the leaf asks about a record the relation reaches), and no ruling is needed for it. The card's expected result and feat(service-analytics): serve a one-hop cross-object where on the engine-aggregate path #33512's acceptance note agree.
  • Outside $not, the native result matches that rule for every listed operator, one hop and multi-hop: each hop joins on the alias id, so the last hop's key is NULL exactly when the chain reached no row, and a line whose order exists with no customer is left out of a two-hop leaf as on the engine. A deleted parent is a dangling reference (the recycle bin captures the row elsewhere), so it is covered. An unreadable parent is unchanged: the joined object's read scope stays its own WHERE conjunct through applyReadScope, which does not pass through the changed code. The conjunct is plain SQL and portable across SQLite, PostgreSQL, MySQL and SQL Server; the or-absorb path restores params and joins as before.
  • M1 (must-fix) — the guard is not polarity-aware. Under $not it turns a leaf that was TRUE for an orphan into FALSE, so the negation newly selects the orphan. That is a widening in a no (narrowing) change, on exactly the rows this card is about. It contradicts the changeset's "no such row is selected, whatever the operator" and the new docs sentence, and it is the outcome cross-object-where.ts gives as the reason the engine refuses $not ("negating the existential test admits every row whose parent is absent"). Repair: do not add the conjunct inside a not operand (thread the polarity through compileFilterNode), which keeps those statements byte-unchanged as the PR body claims, and pin it with a $not case over $null: true on a joined member. Keeping the new behaviour instead is a semantic choice the engine path has no answer for; it would need a maintainer ruling, a declaration in the changeset and a test.
  • S1 (should-fix) — the changeset's BREAKING notice must name every position that moves: a measure's own filter and a dataset's own filter beside where.
  • S2 (should-fix) — "not selected, whatever the operator" in the docs sentence and the changeset over-claims on the native path even after M1 is repaired. A positive leaf under $not compiles to NOT (col IS NOT NULL AND col = v) and selects the orphan (unchanged, and the engine refuses the shape). $nin: [] folds to the TRUE constant in fieldLeaves and selects every row, where the engine path's nested form would leave the orphan out (read from the code, not run). State the exceptions or close them.
  • N1 (nit) — "The same $or keeps such rows on both paths": { order: { $null: true } } keeps a row with an empty relation, not one naming a record that no longer exists; the sentence's "such rows" covers both. The test's own title says it correctly.
  • N2 (nit) — the changeset's operator list omits $exists: false, which lowers to the same notSet leaf and moves with $null: true.

Implemented-by: claude/area-A3-33792
Reviewed-by: session_01ASNY8Ywba8ySbMdWvra2vS

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — FAIL

Head-sha: 6509c8617c1a6cfd03f1c5869ed967621a38c3ee

L1 ordinary ACCEPT read. The declaration is Clause-②: no (narrowing), so the contract record is review#2's.

M1 (must-fix): under $not the conjunct now selects orphans that were left out before

The Acceptance notes say "$not over a cross-object leaf is unchanged on the native path. Its operand's leaves are positive or set, so they take no conjunct". The shared lowering says otherwise.

In packages/spec/src/data/filter-lowering.ts, rule 3 (guardNullPolarity with negated, through nullGuardForFieldSpec) treats $null, $empty and a null $eq as already total, and leaves them alone inside a $not operand. It gives a negative-polarity leaf ($ne, $nin, $notContains) the { $or: [{ f: { $null: true } }, { f: spec }] } escape. So a $not operand does reach compileFilterNode with notSet, empty and notContains leaves, and each now takes ("HOP"."id" IS NOT NULL AND …). That conjunct is two-valued FALSE for an orphan, so the enclosing NOT turns it TRUE.

These are the exact statement shapes, run on SQLite with the PR's fixture shape. o3 exists with a NULL status, l7 has an empty relation, and l8 has a dangling relation.

where on the native path before (main) at this head
{ $not: { 'order.status': { $null: true } } } → NOT ("order".status IS NULL) l1, l2 l1, l2, l7, l8 (both orphans newly selected)
{ 'order.status': { $null: false } } (same meaning) l1, l2 l1, l2
{ $not: { 'order.status': { $ne: 'open' } } } (escape arm under NOT) l1 l1

$not over $eq: null, $empty: true and $notContains compiles the same way, as a notSet, empty or notContains leaf directly under NOT or inside an escape $or, and moves the same way. So in this one class the PR widens: rows the native answer left out are now counted. It also breaks two things the PR states:

  • $not {$null: true} and $null: false agreed before; they now disagree.
  • dashboards.mdx now says such a row is "not selected, whatever the operator", which is untrue under $not.

No test covers $not. The new file's cases are all un-negated.

Fix, inside this PR's surface:

  1. Make the conjunct keep an orphan UNKNOWN, not FALSE, so a NOT cannot flip it. For example, (CLAUSE AND "HOP"."id" = "HOP"."id") is UNKNOWN on a NULL key and TRUE otherwise. On the same fixture, NOT (("order".status IS NULL AND "order".id = "order".id)) answers l1, l2, and the un-negated cases still leave the orphans out. A negated flag carried through compileFilterNode is another way.
  2. Pin $not over $null: true, $eq: null, $empty: true, $notContains and $ne: no orphan is selected, and the $not {$null: true} answer equals $null: false. Native face only, since the engine refuses negated.
  3. Correct the Acceptance note.

Holds

  1. The un-negated rule.
    • NULL_SATISFIED_LEAF_OPERATORS (notSet, empty, notContains) is the right set outside a $not. Every other compiled operator is UNKNOWN on a NULL, or IS NOT NULL, so a positive statement is byte-unchanged.
    • The conjunct is added only around a clause that bound, so params stays aligned.
    • joinedParentKey reads resolvePathHops, the same resolver the join uses, and returns null for a base column or an expression.
  2. The tests. The new file runs a native face, an engine face (nativeSql: false) and the engine's nested-relation find over one engine on driver-sql. It covers two orphan kinds, a parent that exists with a NULL value, two hops, and a positive control. The red-first measurement on main's strategy shows only native-face failures (11 of 12), and the notSet ablation reds 10 of 12 as described.
  3. Declarations. Changeset @objectstack/service-analytics: patch with !, a BREAKING FROM → TO, the ADR-0087 not-required marker, and a $or remedy for authors are all consistent with an un-negated narrowing. M1 makes Clause-②: no (narrowing) untrue for the $not class until it is fixed.
  4. Battery stance. service-analytics is not a shared package under the 16:10Z rule, and the merge group runs the Dogfood shards.
  5. Check-runs on the head. Latest run per check: 38 success, 15 skipped, none failed or pending. mergeable_state is clean.

The patch-id is ff4f14f69c5867855785e20ddbc11263301e3045. A delta at the fixed head will be read against this record.

…nct so a $not cannot select it

Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

Hand-off (maintainer order 2026-11-16 09:01Z: push now, hand off)

  • Head: f2b0b56f3f8fd3883ead48b5ecec73d2c7e67345, fix round 1 for L1 FAIL 6911858976 (M1: orphans newly selected under $not). The conjunct is now (CLAUSE AND "HOP"."id" = "HOP"."id"): UNKNOWN (not FALSE) for an orphan, so an enclosing NOT cannot flip it. Body applied.
  • State: draft, not landed. Nothing in this round is measured. The push came under the order before any test ran.
    • The expected values in the 8 new $not pins are hand-derived from main's compiled SQL and must be confirmed against main's strategy source (5a755791a9).
    • The round-0 readings at 6509c861 (12/12, suite 216/216, ablation 10/12) do not cover this head.
  • Left (dev's list):
    1. Build the closure. Run the test file at main's strategy source (the $not values must equal main), at 6509c861 (the $not pins red) and at this head (green).
    2. Ablation on the negation guard.
    3. The package suite and typecheck, the derived dispatch gates, and pnpm check:test-source-alias.
    4. The dogfood battery on the final head (narrowing).
    5. If the measured values differ, fix the pins and the Fix round 1 section.
  • Owed reviews:
    • L1 delta from the S2 review thread (review-b), against FAIL 6911858976.
    • L2 at CONTRACT_REVIEW_TIER for the narrowing: not yet claimed, so the request comment from the first head stands for the final head.
  • Landing: NOT governed (+319/-1 at round 0; re-run on the final list). After both PASS: K check / merge main, then the seat ACCEPT and --land.

…n filter and $exists: false against the orphan

The same compile serves where, a measure's conditional aggregate and the
dataset's own filter; all three moved, so each position carries a pin.

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
…e and the two native answers that still select an orphan

The BREAKING notice names where, a measure's own filter and the dataset's
own filter; $exists: false joins the operator list; the over-claim
"whatever the operator" gives way to the two measured exceptions (a
positive comparison under $not, and $nin: [] folding to TRUE); the $or
remedy is stated for an empty relation only.

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Request: review · PR #34335 · area o1-B · Fixes #33792 · head b779b7f25e652b22bb791c46a6e58c52ec183c37 (declared final, green) · 2026-11-16T11:21Z

  • Owed: L1 delta (thread L1-a) against L1 FAIL 6911858976, and L2 delta at CONTRACT_REVIEW_TIER (review#1) against FAIL 6911851965. Declaration unchanged: Clause-②: no (narrowing), Metadata-protocol: none.
  • Since FAIL (6509c86): two rounds, f2b0b56f and b779b7f2. Dev report 6914971022 on 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.
    • M1 (both records): the conjunct is now (CLAUSE AND "HOP"."id" = "HOP"."id"). It is UNKNOWN for an orphan, so a NOT cannot flip it. Measured: the 8 $not pins and the $not {$null:true} = $null:false pin are green on main's strategy source (they equal main), red at 6509c861, and green at head. The ablation that puts back IS NOT NULL reds the same nine. No strategy code changed in round 2.
    • S1: the changeset and the docs name where, a measure's own filter and the dataset's own filter. New pins: the measure filter (native), and the dataset filter (native and engine).
    • S2: "whatever the operator" is replaced by the two measured exceptions, left open in code: a positive comparison under $not, and $nin: [] folding to TRUE.
    • N1: the $or remedy now says it brings back an empty relation only.
    • N2: $exists: false is listed and pinned on all three faces.
  • Readings at head:
    • service-analytics suite: 216/216 files, 5257 passed. Typecheck exit 0.
    • Dogfood battery: 473 files passed, 4003 tests, no failures.
    • Test file: 24/24 at head; 14 red on main's source.
    • check-governed-merges --pr 34335: NOT governed (+405/-1, 4 paths).
  • Check-runs (latest per check): 35 success, 17 skipped, 0 failure. The reds on 85d43a40 were the aggregators of a run that was cancelled by the next push; no lane failed.
  • Landing: this area lands it after both records PASS on this head. It is the second of the pair with fix(service-analytics)!: the dataset query door refuses measures and dimensions the dataset does not declare #34198, so main is merged first if fix(service-analytics)!: the dataset query door refuses measures and dimensions the dataset does not declare #34198 lands earlier.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head b779b7f · 2026-11-16T11:23Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi

席位核对 · ACCEPT (L1 delta) · Head-sha: b779b7f · 2026-11-16T11:24Z

L1 thread L1-a for area o1-B, on the final head declared in 6915011564. Delta against the L1 FAIL 6911858976 at 6509c861: three linear commits (f2b0b56f, 85d43a40, b779b7f2), 4 files, +102/−16. The L2 delta at CONTRACT_REVIEW_TIER is review#1's.

M1 — resolved

  • The conjunct. native-sql-strategy.ts now emits (CLAUSE AND "HOP"."id" = "HOP"."id") in place of ("HOP"."id" IS NOT NULL AND CLAUSE). That is the fix the FAIL proposed. For an orphan the key is NULL, so the conjunct is UNKNOWN and the leaf is UNKNOWN, never FALSE. A single NOT then gives UNKNOWN, so the row is not selected, which matches main (where the leaf was TRUE and the NOT gave FALSE). Un-negated, UNKNOWN selects what FALSE selects. I worked the two combinator shapes through Kleene tables, and both give the same answer as main:

    • $not $or [$null, amount > 2000]: orphans not selected;
    • $not $and [$null, amount < 2000]: l8 selected, as on main.

    The SQL pins assert the new statement text, one hop and two.

  • Pins (fix item 2). The new table has eight native $not cases, each held to its answer on origin/main 5a755791a9: $null: true, $eq: null, $empty: true, $notContains, $ne, the $or and $and combinators, and two hops. A separate case pins $not {$null: true} = $null: false. The engine face is left out by design, because it refuses negated. The area's reading: these nine are green on main's source, red at 6509c861, and green at head, and the IS NOT NULL ablation turns the same nine red.

  • Acceptance note (fix item 3). Rewritten. It now names the 6509c861 widening, the id = id rule, and the one $not shape that still selects an orphan, a positive comparison (unchanged from main; the engine refuses it).

The rest of the delta

  • Three filter positions (S1). New pins cover a measure's own filter (native; the engine refuses it there) and the dataset's own filter (native and engine both answer 1 / 300). The changeset and dashboards.mdx now name all three positions.
  • Exceptions (S2). "Whatever the operator" is gone from the changeset, dashboards.mdx and the test's docblock. The two native answers that still select an orphan are stated in all three places: a positive comparison under $not, and $nin: [] folding to TRUE. Both are unchanged from main.
  • N1, N2. The $or remedy now says it brings back an empty relation only. $exists: false is in the FROM list and pinned on all three faces.
  • Changeset sentences checked against the diff. FROM/TO now reads id = id with its TRUE/UNKNOWN reason. The "Not moved" list adds the two exceptions, with their remedies. Both are consistent with the code: $nin: [] lowers to … OR 1 = 1 before this arm sees it.
  • Declarations. Unchanged: !, Clause-②: no (narrowing), BREAKING FROM → TO, ADR-0087 not-required, Metadata-protocol: none. With M1 fixed, the narrowing claim holds for the $not class too: no row main left out is selected now.
  • Battery (! arm). Dev report 6914971022, dogfood_battery: pinned to b779b7f25, the full @objectstack/dogfood run, 473 files passed, 3 skipped, 4003 tests, no failures.
  • Checks on this head (check-runs, latest per name). 53 names: 36 success, 17 skipped, 0 failed, 0 pending. Lint & Repo Gates, TypeScript Type Check and Check Changeset are success. The 85d43a40 reds were aggregators of a run that was cancelled by the next push, and that head is not current.
  • Base. PRBASE = 2c96e0df (the Test Core plan on this head). K = 5 to origin/main 183a89e3, below 15. Nothing since PRBASE touches service-analytics, filter-lowering.ts or dashboards.mdx.

Before landing (area)

  • The dev report's two out_of_scope_findings are "reported to the seat" but carry no card number yet. One is $nin: [] native vs engine. The other is the stale dashboards.mdx sentence saying the engine refuses a dataset's own related-field filter, which this PR's new test shows the engine answers. That sentence now sits right after this PR's new paragraph. Link the card(s) in a PR comment before label-write --land.
  • The statement shape is measured on SQLite. x = x being NULL on a NULL key is standard three-valued logic, and the body says so for PostgreSQL, MySQL and SQL Server; no PG or MySQL run is cited. Not a blocker.
  • It lands second of the pair with fix(service-analytics)!: the dataset query door refuses measures and dimensions the dataset does not declare #34198, as the area's comment says.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Acceptance notes · out-of-scope findings of PR #34335 · 2026-11-16T11:26Z

Head unchanged at b779b7f25e652b22bb791c46a6e58c52ec183c37.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b779b7f25e652b22bb791c46a6e58c52ec183c37
Local-runs: none
Scope: packages/services/service-analytics/src/strategies/native-sql-strategy.ts, packages/services/service-analytics/src/tests/cross-object-negative-orphan.test.ts, .changeset/33792-cross-object-orphan-native.md, content/docs/ui/dashboards.mdx + packages/services/service-analytics/src/strategies/cross-object-where.ts, packages/services/service-analytics/src/strategies/filter-normalizer.ts, packages/spec/src/data/filter-lowering.ts
Security-touching: no

Delta record against FAIL 6911851965 at 6509c861; the head is judged in full. Net diff against main: 4 files, +405 / -1. Round delta 6509c861..b779b7f2: one strategy line (the conjunct) and its comment, 12 new test cases, changeset and docs wording.

M1: closed.
S1: closed.
S2: closed.
N1: closed.
N2: closed.

No must-fix, no should-fix.

① Derived judgments

  • Right, M1: the leaf arm of compileFilterNode now returns (CLAUSE AND "HOP"."id" = "HOP"."id") for a joined leaf whose operator is notSet, empty or notContains. The key is NULL exactly when the chain reached no row, so the conjunct is TRUE for an existing parent and UNKNOWN for an orphan. The leaf can therefore only move from TRUE to UNKNOWN on an orphan, never to FALSE and never from FALSE or UNKNOWN to TRUE.
  • Right, M1: the not arm compiles to a plain NOT (inner) and and / or to plain AND / OR; notOf in filter-normalizer.ts folds only a constant and never pushes a negation into a leaf. Under three-valued logic these connectives cannot turn an input that went from TRUE to UNKNOWN into an output that goes from not-TRUE to TRUE. So no row the compile left out on main is selected at this head, at any nesting. The widening M1 graded is gone.
  • Right, M1: the fix is not the polarity flag the earlier record suggested, and it does not need to be. Under one $not the operand is a positive formula of leaves, so a FALSE operand stays FALSE and the selected set is exactly main's. The eight $not pins ($null: true, $eq: null, $empty: true, $notContains, $ne, under $or, under $and where main does select l8, and two hops) and the $not {$null: true} = $null: false pin state that, and the two SQL-text pins read the new conjunct. The repair asked for a $not pin over $null: true on a joined member; it is there.
  • Right, S1: the changeset's BREAKING notice and the docs sentence name the query's where, a measure's own filter and the dataset's own filter. A measure-filter pin (native) and a dataset-filter pin (native and engine) cover the two positions that had none.
  • Right, S2: "whatever the operator" is gone from the docs sentence, the changeset and the test header. The rule is now scoped to a condition not under $not, and the two remaining native answers are stated. Both statements hold against the code:
    • A value comparison under $not is made total by rule 3 of filter-lowering.ts as NOT (col IS NOT NULL AND col = v), which is TRUE for an orphan. set and equals take no conjunct, so the statement is byte-identical to main, and cross-object-where.ts refuses the shape as negated.
    • $nin: [] becomes the escape $or whose second arm the normalizer folds to the constant TRUE, giving ((col IS NULL AND id = id) OR 1 = 1), TRUE for every row. That is the same answer as main. The engine path respells it as the nested-relation form and reads parents first, so an orphan is left out there.
  • Right, S2: outside $not I found no third operator that selects an orphan. set, notEmpty, notEquals, notIn and every positive comparison are UNKNOWN or FALSE on a NULL column; $in: [] folds to FALSE; notSet, empty and notContains carry the conjunct, including the 1 = 1 arm of notContains on a non-text column.
  • Right, N1: the docs and the changeset say the $or remedy brings back rows with an empty relation, and that a row naming a record that no longer exists is not brought back. The pin's expected set (l3 to l7, no l8) agrees.
  • Right, N2: $exists: false is in the operator lists of the changeset and docs and is pinned on the native, engine and /data faces.
  • Unchanged and still right: joinedParentKey, NULL_SATISFIED_LEAF_OPERATORS, the clause !== null guard that keeps params aligned, and the byte-unchanged positive statements. The diff touches no file of the engine strategy, the lowering or the normalizer.
  • Inexact, N3 and N4 below: two sentences about $not are narrower than the code. Neither is a widening.

② Semver level

  • Unchanged shape: '@objectstack/service-analytics': patch, ! in the title, BREAKING banner, FROM → TO, Clause-②: no (narrowing) and Metadata-protocol: none on the PR body and the changeset, and one ADR-0087 marker not-required (no-migration-prescription). That is the shape AGENTS.md on main prescribes for a non-protocol breaking change. Check Changeset and Lint & Repo Gates concluded success on this head.
  • The declaration's content now holds. With M1 repaired, every moved answer is a row no longer selected, so no (narrowing) is true of the whole diff. The FROM → TO names the three positions and the full operator list, the TO names the id = id conjunct and why a $not cannot flip it, and "Not moved" names the two remaining native answers with a remedy for the first.

③ Boundary flags

④ Design judgment

  • The narrowing against the published spec on main: cross-object-where.ts and dashboards.mdx state "no parent never matches, whatever the operator" for the engine path, and the card's expected result is that the native path agrees. Outside $not the native answer now matches that rule for every operator but $nin: [], across one hop and two, in all three filter positions. It makes the spec's own rule real at the consumer and takes no declared capability away. An author who wants the empty-relation rows has the $or remedy, pinned on all three faces.
  • Under $not the engine has no answer (it refuses), so main's native answer is the only reference, and the head holds it for a single $not. Choosing UNKNOWN over a polarity flag is sound: it gives the guarantee "nothing newly selected" by construction, where a flag would need a meaning per depth.
  • Is stating S2's exceptions an acceptable close? Yes. The earlier record offered "state the exceptions or close them". Both stated exceptions are true of the code, both are unchanged from main, the first has a remedy in the text, and the second has a carrier (analytics: review follow-ups of PR #34335 (dashboards.mdx stale engine-path text, and $nin: [] selects orphans on the native path) #34384 item 3). The test header says plainly that the two are not pinned; that is acceptable while item 3 is open, since a pin would fix a known disagreement in place.
  • N3 (nit) — the $not exception is described too narrowly. dashboards.mdx says the native path still selects such a row under $not "when the negated condition is a comparison with a value", and the changeset says "a positive comparison under $not". A presence test under $not selects it too: { $not: { 'order.status': { $null: false } } } compiles to NOT (col IS NOT NULL), TRUE for an orphan, and likewise $exists: true, $ne: null and $empty: false. This is unchanged from main, but it now disagrees with the un-negated $null: true, which leaves the orphan out. The governing sentence is correctly scoped to "not under $not", so no claim is false; the exception's wording could say "any condition a missing value does not satisfy". It can ride analytics: review follow-ups of PR #34335 (dashboards.mdx stale engine-path text, and $nin: [] selects orphans on the native path) #34384.
  • N4 (nit) — the changeset's "Under $not the native answer is the one it gave before" holds for one $not, which is what the pins cover. Under a doubly nested $not over a NULL-satisfied leaf ({ $not: { $not: { 'order.status': { $null: true } } } }), main selected the orphan and this head does not: the lowering and notOf keep both negations, and UNKNOWN passes through both. That is a narrowing in the declared direction and consistent with the un-negated rule, but the sentence does not say so and no pin covers it. Read from the code, not run.

Implemented-by: claude/area-A3-33792
Reviewed-by: session_01ASNY8Ywba8ySbMdWvra2vS

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Verdict: ACCEPT at 2026-11-16T11:34Z, and the landing rides this stroke. ACCEPT → PR #34335 comment 6915083064.

Reading Head b779b7f25e652b22bb791c46a6e58c52ec183c37
L1 delta (L1-a) ACCEPT 6915083064
L2 delta (review#1, CONTRACT_REVIEW_TIER) PASS 6915252881
check-governed-merges --pr 34335 (detached origin/main) NOT governed, 4 paths, +405/-1, under 3,000
Dogfood battery (! title) dev report 6914971022, pinned to this head, no failures
K (PRBASE 2c96e0df → origin/main) 5, below 15
Check-runs 0 failure (L1 read: 36 success, 17 skipped)

State: ready plus auto-merge through the merge queue. On MERGED, Fixes #33792 closes the card. The L2 nits N3 and N4 (the $not exception's wording, and the doubly nested $not) ride #34384. #34198 lands second and merges main first.

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

2 participants