Skip to content

feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit - #33854

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/project-thread-4qnc25
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/project-thread-4qnc25

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #33698

What changes

A per-measure aggregation filter (aggregations[].filter) now runs inside SQL on driver-sql, as a conditional aggregate, instead of the engine reading every scoped row into memory. The route is the one capability bit the card's route A names.

  • Spec (widening). DriverCapabilitiesSchema gains one optional boolean, aggregationFilter: the driver's aggregate() evaluates a per-measure filter itself, with the engine's in-memory answers. Absence means false. Its TSDoc states the promise, the engine reader, why it is a bit and not method presence, and the latitude it inherits: text comparison in a measure filter follows the backend collation, as the where of the same datasource does (ordering everywhere; equality and membership on a case- or accent-insensitive collation), with the measured and unmeasured dialects named. Regenerated: authorable-surface/data.json and the three driver reference pages under content/docs/references/data/.
  • Engine (engine-delete-and-aggregate.ts). A filtered aggregate goes to driver.aggregate only when driver.supports.aggregationFilter === true and the driver has the method. Every other driver keeps find() plus applyInMemoryAggregation, unchanged. The other forks that force the rows path (a non-UTC timezone with a date bucket, an unadvertised granularity) still win.
  • driver-sql. Declares the bit. Each filtered measure's predicate comes from the same where compiler a where uses (applyFilters on a builder of the same table), lifted out of select * from t where … and placed in CASE WHEN. The lift is guarded: a compiled statement that is not exactly that prefix plus one predicate, or whose ? placeholders do not pair one to one with its bindings, is refused NOT_IMPLEMENTED / 501 instead of guessed at (no tested dialect reaches it; a test forces it). Both the reference builder and the filtered builder go through applyTenantScope, like every read builder in the driver (check:tenant-chokepoint), so the lift strips the same scoped prefix and the tenant predicate stays in the statement's own WHERE, outside every CASE; a test pins that with two organizations. SQL Server's GUID priming now also reads the measure filters. SqliteWasmDriver inherits the compile (probed: filtered sum and count answer correctly).
  • driver-turso. Remote mode reports aggregationFilter: false, the way it empties queryDateGranularity, because RemoteTransport.aggregate refuses the key (501). Local mode inherits true and runs SqlDriver's compile; a test measures it answering a filtered sum.
  • objectql walker (option C of the H3 decision, its own commit). A SQL NULL column now fails $gt, $gte, $lt, $lte and $between in the in-memory evaluator, as an absent column already did. See Observable change below.

The SQL shape, per function (H4)

pred is the where compiler's predicate for that measure's filter; the statement's own WHERE (tenant wall, read scope, the caller's where) is untouched.

function without a filter with a filter
sum sum(col) sum(CASE WHEN (pred) THEN col END)
avg avg(col) avg(CASE WHEN (pred) THEN col END)
min min(col) min(CASE WHEN (pred) THEN col END)
max max(col) max(CASE WHEN (pred) THEN col END)
count (no field) count(*) count(CASE WHEN (pred) THEN 1 END)
count (field) count(col) count(CASE WHEN (pred) THEN col END)
count_distinct count(distinct col) count(distinct CASE WHEN (pred) THEN col END)

col keeps the existing aggregand wrapping (PG boolean cast, double accumulation for sum / avg). No ELSE anywhere: a row the filter rejects contributes NULL, which every aggregate skips, so count never counts it (ELSE 0 would). A group the filter empties answers the existing empty-group values (sum and the counts 0, avg / min / max null). CASE WHEN is used on every dialect, PostgreSQL included, so there is one shape to test.

Observable change

  1. Faster filtered measures on driver-sql, same numbers (bench below).

  2. The in-memory evaluator stops treating NULL as 0 in ordering tests. It serves three faces: a measure filter on a driver without the bit, having, and the in-memory where that plugin drivers use (matchesDriverWhere). Before: "count where amount ≤ 0" also counted every row with no amount; $gte 0 / $gt -5 / $lt 1 likewise; $between matched a NULL column for any bounds (numbers, text, dates, times); a having like avg_amount ≤ 0 kept an empty group (whose avg is null). After: none of those match, as SQL and the spec ("null is not ordered") say. Unchanged: $eq, $ne, $in, $nin, $exists, $null, $empty, and a null comparand.

  3. A direct SqlDriver#aggregate call with a measure filter answers the filtered numbers instead of refusing 501.

  4. A measure filter the where compiler refuses now refuses on driver-sql (seat ruling A, comment 6893557132). Because the filter is compiled by the same where compiler as where, it answers what its where twin answers. The recorded case is in aggregation-filter-where-doors.test.ts: a { $field } comparison of created_at with an image field on an object with no audit fields. where refused it 400 INVALID_FILTER before and still does; the measure filter used to be evaluated in memory and answer 200 (total 6), and on driver-sql it now answers 400 INVALID_FILTER. On a driver without the bit it still answers 200, and a new case pins that. The changeset says so.

  5. Text in a measure filter compares by the database collation on driver-sql, as the where of the same datasource already does. The in-memory path compares text exactly. On a case-insensitive collation, stage $eq 'won' now also counts Won rows, as where: { stage: 'won' } already selects them; ordering a non-temporal text column follows the collation everywhere. Measured: SQLite, and PostgreSQL 16 with a C.UTF-8 collation, agree with the in-memory path on every operator; PostgreSQL 16 with an ICU en-US collation differs only in text ordering. MySQL, SQL Server and Oracle were not measured; the MySQL and SQL Server default collations are case-insensitive. The bit is declared on every dialect (review#1 S2, option (b)): gating them off would keep those dialects on a path that answers differently from their own where.

For the contract reviewer (review#1)

Two observable changes above go beyond speed and want a reading against the contract: item 2 (the in-memory NULL rule, which also changes having and plugin-driver where) and item 4 (a measure filter now shares its where twin's refusal on driver-sql, so the same request answers 400 on driver-sql and 200 on a driver without the bit). Item 4 makes the measure filter agree with the where position the spec pairs it with; the remaining split is between drivers, not between positions on one driver.

Why

#33698: a measure filter forced engine.aggregate onto find() plus in-memory aggregation for every driver, so a filtered dashboard tile read the whole scoped table into the process.

H3 measured before the engine edit, per the order: 119 filters through the real engine on a real SqlDriver, in-memory evaluator against driver-sql's where compiler (/mnt/project-files/pm-orders/spec/33698-h3-measurement.md). SQLite 106 same / 13 different; PostgreSQL 16 C.UTF-8 106 / 13; PostgreSQL 16 ICU en-US 101 / 18; four of the "different" rows were the same refusal envelope on both sides. The gap was reported as needs_decision (6892601944); the seat ruled option C (6892621130): fix the walker's NULL rule in this PR, then the static bit is enough. The gap left is declared, not gated (observable change 5): text comparison follows the database collation, as for where. MySQL, SQL Server and Oracle were not measured (no server in the container).

Verification

Tests added or changed:

  • packages/drivers/driver-sql/src/sql-driver-aggregation-filter.test.ts (replaces …-filter-refusal.test.ts): each of the six functions with a measure filter, per group including a group the filter empties, against a hand-written answer and against find(where = filter) aggregated in JS; count(field) vs count(*); binding order with a where and two filtered measures; NULL ordering; vacuous {}; a filter the where compiler refuses is refused alike; the tenant wall (two organizations: the other organization's rows count in no measure, and the tenant predicate sits in WHERE, outside the CASE); the lift guard. SQLite and live PostgreSQL 16: 28 passed, 1 skipped.
  • sql-driver-11455-aggregate-fault-envelope.test.ts: the build-time refusal control now uses the where compiler's refusal (INVALID_FILTER / 400).
  • packages/objectql/src/engine-aggregate-filter-pushdown.test.ts: bit true goes to driver.aggregate with the resolved filter; no bit, false, a truthy non-boolean, or no method go to find() plus in-memory; a non-UTC date bucket still wins; no filtered measure is unchanged.
  • packages/objectql/src/having-filter-null-ordering.test.ts: the NULL rule on all three faces, the unchanged operators, the empty-group having, and the null comparand.
  • packages/rest/src/aggregate-measure-filter-pushdown.test.ts: security parity through POST /api/v1/data/:object/query with the real SecurityPlugin, isolated tenancy, row-level security and an unreadable field. Two engines over identical data: SqlDriver (pushed down, asserted driver.aggregate once and no find) and SqlDriver with the bit off (asserted find once). Same rows and numbers for every function; another organization's won row and an out-of-scope won row counted by neither; a measure filter on the unreadable field is 403 PERMISSION_DENIED on both.
  • packages/drivers/driver-turso/src/turso-driver.test.ts: remote reports the bit off, local inherits it and answers a filtered sum. remote-transport-aggregate-function-refusal.test.ts: the two-face parity pin now says the local face compiles and each face declares what it does.
  • packages/spec/src/data/driver.test.ts: the bit parses, is absent by default, refuses a non-boolean; five live bits.
  • Existing tests that described the old routing (each approved by the maintainer on 2026-11-15, amendments 6893557132 and 6893580970; no expected number changes):
    • packages/rest/src/rest-aggregate-compensated-sum.test.ts compares the native and rows paths and forced the rows path with a filtered measure. Its driver now reports aggregationFilter: false, so the two paths stay the ones their names say; all its numbers hold.
    • packages/rest/src/aggregation-filter-where-doors.test.ts: item 4 above, re-recorded, plus the no-bit case.
    • packages/services/service-analytics/src/__tests__/objectql-echo-date-bucket.test.ts: the measure-filter echo case asserted "the driver grouped nothing". It now asserts the one grouped sum(CASE WHEN …) statement the driver runs; the rows and the echo it runs are unchanged (SQLite and live PostgreSQL 16: 49 passed).

Ablations (old behaviour put back, red, restored):

  • driver-sql: the measure's operand put back to the bare aggregand (no CASE, no filter bindings, count(*)): sql-driver-aggregation-filter.test.ts 10 failed / 4 passed; restored 14 passed (run before the tenant-wall cases were added).
  • driver-sql: count(CASE WHEN … THEN 1 ELSE 0 END): 3 failed (count, count(field) vs count(*), NULL ordering); restored.
  • engine: the gate put back to !hasAggregationFilter: engine-aggregate-filter-pushdown.test.ts 2 failed / 6 passed; the bit ignored (always push): 3 failed / 5 passed; restored 8 passed.
  • walker: the NULL exit disabled: having-filter-null-ordering.test.ts 28 failed / 25 passed (nine ordering cases on three faces, plus the empty-group having); restored 53 passed.

Suites on the final head (rebased on main 1e65a38): spec 28507 passed; objectql 13202 passed; driver-sql 4305 passed / 241 skipped (SQLite), its aggregation files on live PostgreSQL 16 285 passed / 7 skipped; driver-turso 2539 passed / 34 skipped; rest 8748 passed / 355 skipped; service-analytics 5216 passed / 335 skipped; driver-sqlite-wasm 766 passed (before the rebase).

Bench (M0 row aggregate_measure_filter, admin, groupBy status, sum(quantity) filter quantity ≥ 10 + count)

Same box, same build, bench.mjs --only aggregate_measure_filter,aggregate_group_status, 20 iterations after 3 warmups. Before is this build with driver-sql's built supports patched to aggregationFilter: false for the run (exactly the path main takes for this query: find() plus in-memory aggregation), then restored; after is the build as committed. Wall-clock on a shared box: read the ratios, not the absolute milliseconds.

scale dialect before p50 / p95 ms after p50 / p95 ms
100k SQLite 300.2 / 351.6 48.3 / 62.3
100k PostgreSQL 16 608.2 / 685.2 34.5 / 37.4
1M SQLite 5378.2 / 5898.1 431.1 / 501.7
1M PostgreSQL 16 6357.8 / 7106.9 175.8 / 191.8

Control, the unfiltered aggregate_group_status (admin) in the same runs: 100k SQLite 48.5 → 48.2, PG 46.9 → 37.1; 1M SQLite 441.9 → 417.4, PG 171.8 → 183.1. The filtered measure now costs what the unfiltered aggregate costs. The statement the server ran after (SQLite 100k, from the admin's debug timing):

select `status`, sum(CASE WHEN (`quantity` >= ?) THEN `quantity` END) as `big`, count(*) as `n`
from `bench_line_item` where `opportunity` in (select `id` from `bench_opportunity` where `account` in (select `id` from `bench_account`)) group by `status`

Nothing under packages/qa/dogfood/bench/sql-perf/ is changed: the bench writes its results under its work directory, not the repo. Its scenario note ("a per-measure filter routes engine.aggregate to the in-memory path") is now true only for drivers without the bit; left as is because the surface allows the bench only for recording numbers.

Gates

On the final head aea48520: every family node scripts/pm/dispatch-gates.mjs --commands derives for this tree was run, each exit code recorded before any pipe: 124 run, 124 exit 0. --ran reconciliation: 124 derived, 124 run, 0 NOT-MEASURED, 0 UNRUN. The per-package type-check lanes, which that list does not derive, exit 0: pnpm --filter <pkg> run typecheck for spec, objectql, driver-sql, driver-turso, rest and service-analytics on 8e48947d, and for spec again on aea48520 (round 3 moved prose in spec, the changeset and nothing else). The list with its exit codes is in the card's order folder (33698-gates-ran.txt).

Round 2 (review#1 record 6894395884, seat amendments 6894412038 and 6894446721)

finding what changed
M1 — the head did not type-check (TS2769 ×4 in sql-driver-aggregation.ts) fix(driver-sql) 4775f3f: the lifted predicate's bindings are typed readonly Knex.Value[] where they are sliced from knex's own toSQL(), and filterBindings is Knex.Value[]; no cast at the call sites. pnpm --filter <pkg> run typecheck was red (exit 2, the same four errors) before and is green after, and exits 0 on all six touched packages (spec, objectql, driver-sql, driver-turso, rest, service-analytics; the test-typecheck legs included). Round 1's gate pass missed it because dispatch-gates --commands does not derive the per-package type-check lanes (its own output says a card owes them), and vitest does not type-check.
S1 — the declared kind added under-declared The changeset and this body now say Metadata-protocol: semantic: a stored having, measure filter or plugin-driver where keeps validating and now matches other rows under the NULL rule. Clause-② and the semver levels are unchanged. Skills-docs: follow-up #33868 added. check:adr-0087-registration on the new changeset: exit 0, no entry owed (the gate does not judge a changeset that declares no break), so nothing was added under migrations/entries/semantic/.
S2 — the bit's TSDoc promised more than was measured Option (b): the bit stays on every dialect. Its TSDoc, its .describe() (regenerated into the three driver reference pages) and the changeset now say text comparison in a measure filter is the backend collation's, as for where (ordering everywhere; equality and membership on a case- or accent-insensitive collation), naming SQLite and PostgreSQL 16 as measured and MySQL, SQL Server and Oracle as not. driver-sql's declaration comment points there. Observable change 5 gives the stage $eq 'won' example.
N1 — filter.zod.ts should state the column-side null rule Filed as #33869.
N2 — bench scenario note Already stated under Bench.
Docs drift (the bot's seven pages via IDataDriver) One sentence was false: content/docs/protocol/objectql/query-syntax.mdx listed aggregations[].filter as [EXPERIMENTAL — not enforced], applied by neither SQL nor the in-memory fallback (false since #10576 in memory, and now in SQL too). The row is dropped from that "validate but not executed" table (amendment 7). The other six pages say nothing this PR makes false.

Round 3 (review#2 delta record 6895214298, PASS with one should-fix)

Prose only: no code, type or binding change.

finding what changed
S3 — the aggregate() contract still promised the in-memory answers packages/spec/src/contracts/data-driver.ts: a driver that declares the bit answers each measure filter with the in-memory path's answers except where DriverCapabilities.aggregationFilter states a latitude (text compares by the backend collation, as in where).
N3 — Oracle unnamed The bit's TSDoc and the changeset name Oracle beside MySQL and SQL Server as not measured. The .describe() names no dialect (it says only that text compares by the backend collation), so it and the generated reference pages are unchanged.
N4 — "is exempt" The S1 row above now says the gate does not judge a changeset that declares no break.

Comments brought up to date outside the code surface

Amendment 6892875666 added three files for comment edits only; the maintainer approved them on 2026-11-15. Each described the old routing ("the engine lowers filtered aggregations in memory for every driver"):

  • packages/spec/src/contracts/data-driver.ts (aggregate() TSDoc): a measure filter reaches aggregate() only on a driver that declares supports.aggregationFilter; on every other driver it forces the in-memory path.
  • packages/objectql/src/in-memory-aggregation.ts (header): the fallback is the lowering for every driver without the capability.
  • packages/drivers/driver-turso/src/remote-transport.ts (refusePerAggregationFilter docblock): no longer calls itself the twin of driver-sql's refusal; unreachable through engine.aggregate because TursoDriver reports the bit off in remote mode.

The driver-memory and driver-mongodb refusal docblocks that say the engine lowers filtered aggregations in memory stay true for those drivers, which do not declare the bit; they are outside this card and untouched.

Clause-②: yes (widening: one optional DriverCapabilities bit)
Metadata-protocol: semantic
Skills-docs: follow-up #33868

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

An optional DriverCapabilities boolean: aggregate() evaluates a per-measure
aggregations[].filter itself, with the engine's in-memory answer. Absence
means false, so a driver that declares nothing keeps the in-memory path.
Regenerated the authorable surface and the driver reference pages.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
…gate

aggregate() compiles aggregations[].filter with the same where compiler a
where goes through and places it in fn(CASE WHEN (pred) THEN arg END);
count(*) becomes count(CASE WHEN (pred) THEN 1 END) with no ELSE. A group
the filter empties answers the empty-group value. A predicate that cannot be
lifted cleanly is refused NOT_IMPLEMENTED/501. SqlDriver advertises
supports.aggregationFilter.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
The remote transport refuses a per-aggregation filter, so remote mode
reports the bit off and the engine keeps filtered measures on find() plus
in-memory aggregation. Local and replica modes inherit SqlDriver's compile.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
…ory walker

The walker's value-less exit read undefined only, so a SQL NULL column
reached the JS comparison and coerced to 0: count where amount <= 0 counted
every row with no amount, and $between failed neither bound. A NULL column
now fails $gt, $gte, $lt, $lte and $between, as an absent one does and as
SQL does. The equality family, $in/$nin, the presence operators and a null
comparand answer as before. Pinned on all three faces: the measure filter,
having, and the in-memory where for plugin drivers.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
… bit

engine.aggregate sends an aggregate whose measures carry a filter to
driver.aggregate only when the driver declares supports.aggregationFilter
and has the method; every other driver keeps find() plus in-memory
aggregation. The other forks that force the rows path still win.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
… numbers under the security layer

Two engines over the same data and security (isolated tenancy, row-level
security, an unreadable field): SqlDriver with the capability, and the same
driver reporting it off. Every function answers the same rows and numbers on
both, and neither counts another organization's row or a row outside the
member's read scope that the filter would match.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
…ry read builder

The two builders that compile a measure filter's predicate now carry the
statement's tenant scope, so every read builder routes through
applyTenantScope; the lift strips the scoped reference statement and its
bindings. A test pins that each organization counts only its own rows and
that the tenant predicate stays in the WHERE, outside the CASE.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
… that SqlDriver compiles them

The compensated-sum file keeps its rows path by reporting the capability off;
the where-doors file records the 400 a compiled measure filter answers and
keeps the 200 on a driver without the bit; the analytics echo case asserts
the conditional aggregate the driver now runs. No expected number changes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
…s evaluated now

The aggregate() contract, the in-memory aggregation header and the remote
transport's refusal said every driver lowers a measure filter in memory.
They now name the aggregationFilter capability. The changeset records the
where-compiler refusal a compiled measure filter now shares.

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

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/driver-sql, @objectstack/driver-turso, @objectstack/objectql, @objectstack/spec, touching 6 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/drivers/driver-turso/src/remote-transport.ts, packages/objectql/src/in-memory-aggregation.ts, packages/spec/authorable-surface/data.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/data-modeling/index.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/data-modeling/queries.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/data-modeling/virtual-objects.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/kernel/contracts/data-engine.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/kernel/contracts/index.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/kernel/services.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/protocol/objectql/query-syntax.mdx (via IDataDriver (symbol, a top-level interface))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-3.mdx (via IDataDriver (symbol, a top-level interface))
  • content/docs/releases/v17/17-5.mdx (via IDataDriver (symbol, a top-level interface))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/drivers/driver-turso/src/remote-transport.ts, packages/objectql/src/in-memory-aggregation.ts, packages/spec/authorable-surface/data.json) — pages documenting those are invisible to this run
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 178 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 895783a1e864e0fe629c56b3c6315771ca87bf87 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 895783a1e864e0fe629c56b3c6315771ca87bf87

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 895783a1e864e0fe629c56b3c6315771ca87bf87 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (maintainer routing 「review#1 正在入座,你这个账户后续的契约复审找他」, 2026-11-15T12:23Z) · head 1e2fb85

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head 1e2fb85 · 2026-11-15T12:26:06Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1e2fb8541bc8c9fee8acfa4fa90fde98a92a22b4
Local-runs: none
Scope: packages/spec/src/contracts/data-driver.ts, packages/spec/src/data/driver.zod.ts + packages/spec/src/data/driver.test.ts, packages/spec/authorable-surface/data.json, packages/objectql/src/engine-delete-and-aggregate.ts, packages/objectql/src/having-filter.ts, packages/objectql/src/in-memory-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-top-level.ts, packages/drivers/driver-sql/src/sql-driver.ts, packages/drivers/driver-turso/src/turso-driver.ts, packages/drivers/driver-turso/src/remote-transport.ts

First review of this head. Claim: comment 6894293725. Tier evidence: scripts/pm/verify-review-tier.mjs on this review run's own transcript (subagents/agent-a930767d0e984b1ae.jsonl of the seat session) answers PASS, every turn served at the tier. Independence: the diff was claimed and dispatched by domain:spec#4 (os-project-manager, claim 6892526787) and written by its card thread; os-elon-musk neither implemented nor dispatched it. For the record: card #33698 itself was filed by another os-elon-musk session (domain:server#5) as an epic child; filing is not dispatch, and the lane, claim, decisions and diff are all os-project-manager's.

① Derived judgments

  • Clause-②: yes (widening) holds. DriverCapabilitiesSchema gains one optional boolean; every value accepted before is accepted now, absence parses as before, a non-boolean is refused (pinned in driver.test.ts). authorable-surface/data.json carries the new row; Spec property liveness, Check Changeset and the lint gate families are green on this head.
  • The bit has its reader in the same change (engine-delete-and-aggregate.ts, supports.aggregationFilter === true ANDed with method presence), so it is a live bit, not a declared-and-unread one. Memory, mongodb and odata declare nothing and keep the rows path; TursoDriver turns the bit off in remote mode, where the transport refuses the key.
  • Point 1 (the in-memory null correction): the direction is right. It matches what driver-sql's where compiler already answers and what the walker already answered for an absent column, and it is pinned on all three faces with an ablation. The reading "a patch-level correction, not a contract change" does not hold on the declaration axis, see S1.
  • Point 2 (undeclared-column posture, seat decision 6893557132 option A): the seat's reading holds; this is not a Clause-② narrowing. The published position rule is that a per-aggregation filter answers what its where twin answers (objectql + REST: the per-aggregation filter still lacks four of where's doors — a bad date, an addDays numeric pair, an undeclared { $field } and an unknown key answer 200 with every count 0 #20148, objectql having and the per-aggregation filter judge a cross-field reference's comparison class only on an addDays pair, so a plain datetime-vs-date { $field } answers by formula's whole-day reading where the where twin refuses it 400 #21255, objectql having and the per-aggregation filter answer a { $field } comparison against a no-class column (file, multi-valued, formula) where the where twin refuses it 400: the family's close-out card, with a per-position enumeration pin #21299; rows 1 to 4 of aggregation-filter-where-doors.test.ts already refuse a key or a reference that names no field at that position, before any read). The one case that answered 200 was recorded in that file as a fail-open posture "so a change on either side is seen", not as an accepted shape: a { $field } comparison across two column classes is refused whenever both sides are declared, and it slipped through only because one side had no declaration. No declared shape loses acceptance. The split that remains is between drivers, as it already is for the where position, and the changeset and the new no-bit case say so. The declarations need no change on this account.
  • Point 3 (security parity) holds on this head, read at the rule level. The epic rule is that read scope and the tenant wall stay on the pushed-down statement: both arrive on the statement's own where exactly as they do for an unfiltered aggregate, the measure filter is compiled separately and can only narrow inside them, and a compile that cannot be isolated is refused rather than emitted. The field-readability refusal applies at the measure-filter position before any driver is reached, on both paths. aggregate-measure-filter-pushdown.test.ts pins it through the REST door with the real security layer and the isolated posture, asserting which driver method ran on each path; the driver test pins the wall with two organizations. I found no path in the diff where a measure filter widens the row set or where scope is dropped.
  • Divergence 2 (ordering of non-temporal text under a non-C collation, ungated): acceptable as declared for the measured backends. filter.zod.ts already states that order is permitted and not promised, and after pushdown the measure filter agrees with the where of the same datasource. The unmeasured dialects are a different matter, see S2.

② Semver level

③ Boundary flags

  • No id materialisation and no in-app join is added where SQL can push down; the change removes a whole-set read.
  • The PR author is objectstack-fleet[bot]; no off-relay write to note.
  • CI on this head is not green: Type Check · workspace (and the TypeScript Type Check roll-up) is red on the diff's own lines, see M1. The Test Core, Test UI and build jobs were still running when this record was written.

④ Design judgment

packages/spec/src/data/driver.zod.ts: an opt-in bit ANDed with method presence is the right shape. aggregate() predates the key, a subclass can inherit a compiler its transport refuses, and the engine fallback is always correct, so absence changing nothing is true. The promise text is where the two findings below sit. packages/spec/src/contracts/data-driver.ts: the aggregate() TSDoc now matches the engine's gate.

Implementing files: the engine gate is a strict === true (a truthy non-boolean stays on the rows path, pinned). The driver compiles the predicate with the same where compiler and emits no ELSE, so count cannot count rejected rows; a group the filter empties folds to the existing empty-group values. The walker change is five operators wide, leaves the equality family, the listed no-value operators and a null comparand alone, and negation keeps the null row as the lowering's totality rule expects.

M1 (must-fix) — the head does not type-check. Type Check · workspace fails in packages/drivers/driver-sql with TS2769 at src/sql-driver-aggregation.ts 322, 324, 371 and 373: the four this.knex.raw(..., filterBindings) calls this PR adds pass unknown[] (from readonly unknown[] in compileMeasureFilter) where knex wants its raw-binding type. These are the diff's own lines, so the red is not a merge-base signature. The PR body's "124 run, 124 exit 0" did not include this check. Type the lifted bindings as knex's binding type at the point they are sliced, rather than casting at the four call sites.

S1 (should-fix) — Metadata-protocol: added under-declares; the line should read Metadata-protocol: semantic, in the PR body and in the changeset body. Seat decision 6892621130 reads the walker's null rule as a correction below the declaration axis. The test the fleet has already ruled is whether a stored declaration keeps validating and now selects other rows (#33518, record ID: 6885895029: "a stored filter keeps validating but now matches different rows; that is a changed meaning"). That is exactly what happens here, and on every driver: a stored having such as avg_amount $lte 0 kept an empty group and no longer does (having is engine-evaluated on driver-sql too); a stored measure filter on a driver without the bit, and a plugin driver's where, stop counting rows with no value under $gt, $gte, $lt, $lte and $between. #33518 was itself a correction of a silent wrong answer and was still ruled semantic. The spec sentence the decision leans on ("null is not ordered", filter.zod.ts) is written about a null comparand, not a null column, so the column-side rule is new published meaning rather than an existing promise being met. With added also present the precedence in AGENTS.md step 3 gives semantic. Clause-②: yes (widening) stays. The level does not move. The changeset's "What answers differently in memory" paragraph already says the right thing in user words; only the kind line is wrong. A kind other than none also owes the PR body its Skills-docs: line, which is absent today.

S2 (should-fix) — the bit's TSDoc promises more than was measured, and driver-sql declares the bit on dialects nobody measured. The text names one latitude (ordering of non-temporal text) and then says every other operator answers alike. That was measured on SQLite and PostgreSQL 16 only. driver-sql also targets MySQL and SQL Server, declares aggregationFilter: true there unconditionally, and its where compiler emits a plain = and in for text equality, which those backends decide by the column collation; their default collations are case-insensitive, where the in-memory path compares exactly. So on those dialects a stored measure filter like stage $eq 'won' can start counting Won rows after this PR, silently, and the published promise says it cannot. I did not measure it either; the point is that the schema text asserts it. Either declare the bit only on the dialects that were measured, or widen the stated latitude to what is true: text comparison in a measure filter is the backend collation's, as for the where of the same datasource (ordering everywhere, equality and membership on a case- or accent-insensitive collation), with the unmeasured dialects named in the TSDoc as they are in the changeset.

Nits, no effect on the verdict:

  • N1 (nit): filter.zod.ts should state the column-side rule (a column with no value fails an ordering operator) beside the comparand-side sentence, so the walker's docblock cites text that says it. Follow-up card.
  • N2 (nit, prose face): the bench scenario note is now true only for drivers without the bit; the PR body already says so.

Implemented-by: session_01FEkQ5nSNBMzF8jj9quUkjf
Reviewed-by: session_016WV4cy7hQ5MvQ83ByNZ8ZH

VERDICT: FAIL

knex.raw takes RawBinding[]; the lifted predicate's bindings were typed
unknown[], which the package type-check refuses. They are the bindings
knex's own toSQL() returned, so they carry its Value type through.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
…by the backend collation

The aggregationFilter bit promised the in-memory answer on every operator but
text ordering, which was measured on SQLite and PostgreSQL 16 only. Text
equality and membership also follow a case- or accent-insensitive collation,
as the same datasource's where does; the TSDoc, the describe and the
changeset now say so and name MySQL and SQL Server as not measured. The
changeset's kind line becomes semantic: a stored having or measure filter
keeps validating and now matches other rows under the NULL rule. The query
syntax page drops a row that listed the per-measure filter as not enforced.

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

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (maintainer routing 「review#1 正在入座,你这个账户后续的契约复审找他」, 2026-11-15T13:19Z) · head 8e48947

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 8e48947 · 2026-11-15T13:21Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8e48947dc02f3a076122abda2c2d81be1ad1c3d0
Local-runs: none
Scope: packages/spec/src/contracts/data-driver.ts, packages/spec/src/data/driver.zod.ts + packages/spec/src/data/driver.test.ts, packages/spec/authorable-surface/data.json, packages/objectql/src/engine-delete-and-aggregate.ts, packages/objectql/src/having-filter.ts, packages/objectql/src/in-memory-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-top-level.ts, packages/drivers/driver-sql/src/sql-driver.ts, packages/drivers/driver-turso/src/turso-driver.ts, packages/drivers/driver-turso/src/remote-transport.ts

Read at 2026-11-15T13:43Z. Claim: comment 6894944006. Handed to review#2 by review#1 (6894936609 on mailbox #33873). Delta review of the earlier record, ID 6894395884, which reviewed head 1e2fb854 in full and raised M1, S1, S2, N1 and N2. Two commits sit on top of that head: 4775f3f4 (the binding types in sql-driver-aggregation.ts) and 8e48947d (declarations and prose). git diff 1e2fb854 8e48947d touches eight files: the changeset, query-syntax.mdx, the three generated driver reference pages, sql-driver-aggregation.ts, sql-driver.ts and driver.zod.ts. Every other file of the PR is byte-identical to the head the earlier record judged, and the merge base is the same (1e65a389).

Closures, by id:

  • M1: closed.
  • S1: closed.
  • S2: closed.

One new finding on this head, S3 below, on a hits file the delta did not touch.

① Derived judgments

  • The delta changes no accept set and no exported type. DriverCapabilitiesSchema is the same shape as on the earlier head: one optional boolean, absence parses as before, a non-boolean is refused. Only the bit's TSDoc and its .describe() string moved. Clause-②: yes (widening) still holds.
  • The .describe() string is published text, and it was regenerated into the four rows of content/docs/references/data/driver.mdx, driver-sql.mdx and driver-nosql.mdx; the rows on the head match the schema string word for word. authorable-surface/data.json holds the key only, so it is unchanged and right. Lint · docs & code guards and Spec property liveness are green.
  • 4775f3f4 changes types only: the return type of compileMeasureFilter reads readonly Knex.Value[] and filterBindings is Knex.Value[]. No emitted SQL, binding order or guard moves, so every judgment the earlier record made on the driver compile holds unchanged.
  • The query-syntax.mdx row removal is a prose face and the lane seat's to accept; I note only that amendment 6894446721 names removal as one of its two allowed outcomes.
  • The earlier record's other derived judgments (the live reader in the same change, the walker's null rule in direction, seat decision 6893557132 read as a refusal of a malformed filter and not a narrowing, security parity at the rule level, the text-ordering latitude) rest on files this delta does not touch, and I confirm them on this head. One extra attempt to break the design: a composed ReadableIds leaf compiles to a subquery, which SQL Server refuses inside an aggregate. It cannot reach a measure filter, because the engine refuses that leaf at every position but the statement's own where (filter-comparand-shape.ts), so the pushed-down CASE WHEN never holds a subquery.

② Semver level

  • Check-runs on 8e48947d, read at 2026-11-15T13:41Z: 71 runs. 56 success, 12 skipped, 1 cancelled, 2 still in progress (Test Core (3/8) and Test Core (8/8)). No failure. The cancelled run is a superseded PR-body guards run; its sibling on the same head is green.
  • Type Check · workspace is green on this head (completed 13:41:00Z), and so are the TypeScript Type Check roll-up, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger and Type Check UI. On 1e2fb854 the same check was red. That is the evidence M1 closes on.
  • Check Changeset is green (both runs). minor on @objectstack/spec with patch on objectql, driver-sql and driver-turso satisfies the level rule: a declared kind takes at least minor on one moved package. All four packages sit in the changeset fixed group, so they publish at one level in any case.
  • Metadata-protocol: semantic is now the line in the changeset body and in the PR body, and the two agree. It is the right kind: a stored having, measure filter or plugin-driver where keeps validating and selects other rows under the null rule, and semantic takes precedence over added (AGENTS.md, landing step 3). The PR body carries Skills-docs: follow-up #33868; whether that card exists and says what is owed is the lane seat's checklist line, not read here.
  • Clause-②: yes (widening: one optional DriverCapabilities bit), identical in the PR body and the changeset, and right.
  • The ADR-0087 question. No entry under packages/spec/src/migrations/entries/semantic/ is owed, and that is right for the walker's null rule. Read on the tree: scripts/check-adr-0087-registration.mjs asks for a disposition only from a changeset that declares breaking, by one of five signals (breakingDeclaration: a major bump, a BREAKING banner, a ! summary, the (narrowing) arm, or the narrowed kind). This changeset carries none of them. semantic adds no signal by ruling A, the gate's self-test pins that, and the 2026-11-12 addendum to ADR-0087 says added, semantic and none keep the exemption. AGENTS.md step 3 asks for the disposition from a breaking changeset only. On the merits the ledger feeds objectstack migrate meta and the upgrade guide with edits an author must make; the null rule refuses nothing and prescribes no rewrite, and its notice is the changeset paragraph "What answers differently in memory", which ships in the CHANGELOG. One correction of wording only: the PR body says the changeset "is exempt"; more exactly, the gate never judges it, since it is not a breaking declaration.

③ Boundary flags

  • The last dev report on the card (6894248671) has open_questions: [] and security_findings: none. The two earlier questions were answered by seat decisions 6892621130 (option C) and 6893557132 (option A), both judged in the earlier record. No report for round 2 is on the card, so round 2 raises no open question there.
  • The round-2 plan (6894412038) is followed on each point: bindings typed where they are sliced with no cast at the call sites, the kind line changed, option (b) for the latitude, N1 filed as a follow-up.
  • The PR body says the maintainer approved the out-of-surface test and comment edits by name in the dev's card thread. That approval is not on the card, so it is taken as stated and is the lane seat's to hold.
  • No hits path is under skills/**, so the security-label rule does not apply.
  • No in-app join or id materialisation is added; the earlier record's reading stands.

④ Design judgment

No must-fix.

packages/spec/src/data/driver.zod.ts (changed in the delta). The rewritten latitude now says only what holds on every dialect driver-sql declares the bit on. Sentence by sentence: text comparison in a measure filter is the backend collation's, and the filter answers what its where twin answers. That is true by construction on every dialect, because the predicate comes from the same where compiler (applyFilters) and is placed in CASE WHEN unchanged. Ordering of non-temporal text is "not promised in any case", which is what filter.zod.ts says of the comparison operators. Equality and membership "follow the collation too", with the stage $eq 'won' example, stated as what a case- or accent-insensitive collation does and not as something measured. The measured list names SQLite, PostgreSQL 16 with C.UTF-8 and PostgreSQL 16 with ICU en-US; MySQL and SQL Server are named as not measured, and the case-folding there is worded "expected", not asserted. The closing sentence is limited to "wherever measured". The first paragraph's promise (the in-memory answer) is now followed directly by the latitude it inherits, so the two no longer contradict. The .describe() string carries the same exception in one clause. S2 asked for exactly this, by its second option, and the seat chose that option on the card with a reason that holds: gating the bit by dialect would keep MySQL and SQL Server on a path that answers differently from their own where.

packages/drivers/driver-sql/src/sql-driver.ts (changed in the delta). The three new comment lines say the bit is declared on every dialect, that text comparison is then the collation's as for the datasource's where, and point at the bit's TSDoc for the measured dialects. Each is true against the code: supports is one literal for every dialect, and the compile uses applyFilters.

packages/drivers/driver-sql/src/sql-driver-aggregation.ts (changed in the delta). The bindings are typed at the point they are sliced from knex's own toSQL(), as the earlier record asked, with no cast at the four knex.raw calls. The type is honest: the values are what knex itself produced for the same builder. The check-run is the verdict, and it is green.

packages/spec/src/contracts/data-driver.ts (not changed in the delta):

S3 (should-fix) — the aggregate() TSDoc still states the promise without the latitude. It reads that a driver declaring supports.aggregationFilter "then evaluates each measure's filter with the in-memory path's answers". After this delta that sentence is the one place in the published contract that still says what S2 found untrue: on a case-insensitive collation driver-sql answers its where twin, not the in-memory path. The delta amended the same wording in the bit's .describe() ("with the engine's in-memory answer, except that text compares by the backend collation as in where") and left this copy as it was. It matters beyond wording because IDataDriver.aggregate() is where a driver author reads the obligation: as written, an author whose backend compares text case-insensitively would conclude the bit cannot be declared, while DriverCapabilities says it can. One clause fixes it, for example: "which then evaluates each measure's filter itself, with the in-memory path's answers except where DriverCapabilities.aggregationFilter states a latitude (text compares by the backend collation, as in where)". Comment-only; no regenerated artefact carries this sentence.

The remaining implementing files (engine-delete-and-aggregate.ts, having-filter.ts, in-memory-aggregation.ts, sql-driver-top-level.ts, turso-driver.ts, remote-transport.ts, driver.test.ts, authorable-surface/data.json) are unchanged since the earlier record, and its judgments on them hold on this head: the strict === true gate ANDed with method presence, no ELSE in the conditional aggregate, the guarded lift, the tenant predicate outside every CASE, the five-operator walker change, and the bit turned off in Turso remote mode.

Nits, no effect on the verdict:

  • N1 (nit): carried from the earlier record; filed as spec filter.zod.ts: state the column-side rule — a column with no value fails an ordering operator (nit N1 of #33698's review) #33869 per the PR body.
  • N2 (nit, prose face): carried; the PR body states it.
  • N3 (nit): the bit's TSDoc names MySQL and SQL Server as not measured. driver-sql also serves Oracle (federation, read path), which was not measured either and is not named. The rule the TSDoc states (the collation's answer, the where twin's answer) covers it, so nothing is false; the list is incomplete. Follow-up or left as is.
  • N4 (nit, prose face): the PR body's line on check:adr-0087-registration says a semantic changeset "is exempt"; the gate does not judge a changeset that declares no break. See ②.

Implemented-by: claude/project-thread-4qnc25
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

…t and name Oracle as unmeasured

The aggregate() TSDoc said a driver declaring aggregationFilter answers each
measure filter with the in-memory path's answers; it now defers to the
latitude the bit states. The bit's TSDoc and the changeset name Oracle beside
MySQL and SQL Server as not measured.

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

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

ACCEPT · PR #33854 (#33698) · head aea485202eb2e4a293afa06bfc04cd8f2571bbcf · 2026-11-15T14:49Z

席位核对

  • 形态: 28 files, read from the PR's file list.
    • One optional DriverCapabilitiesSchema bit, aggregationFilter. Its reader is in engine.aggregate (strict === true ANDed with method presence).
    • driver-sql advertises the bit and compiles each measure filter into a conditional aggregate with the same where compiler: CASE WHEN with no ELSE, and the tenant predicate outside every CASE.
    • driver-turso turns the bit off in remote mode. memory, mongodb and odata leave it absent.
    • The in-memory walker's null rule: a null column fails $gt, $gte, $lt, $lte and $between.
    • Also in the diff: three re-recorded tests, three corrected comments, the query-syntax.mdx row removed, regenerated references, and a changeset with Clause-②: yes (widening) and Metadata-protocol: semantic (minor on @objectstack/spec, patch on objectql, driver-sql and driver-turso).
    • Not governed (check-governed-merges --pr 33854: 0 of 28 paths): Tier S.
  • 前提实测: the bench aggregate_measure_filter p50 at 1M rows goes 5378→431 ms on SQLite and 6358→176 ms on PG; at 100k, 300→48 ms on SQLite and 608→35 ms on PG.
    • H3 was measured over 119 filters (33698-h3-measurement.md). The security parity test runs through the REST door with the real security layer.
    • Ablations were red and then restored, per dev report 6894248671.
    • Typecheck exits 0 on all six touched packages, and 124/124 gates pass on the final head.
  • 门禁 check-runs: on this head 72 runs: 59 success, 12 skipped, 1 cancelled, 0 failed.
    • The cancelled run is a superseded PR-body guards run (132840731010). Its sibling on the same head is green (132840840996).
    • mergeable_state: clean.
  • 契约复审:
    • Round 1: review#1 record 6894395884, FAIL on 1e2fb854 (M1, S1, S2).
    • Delta: review#2 record 6895214298, PASS on 8e48947d. It closes M1, S1 and S2, raises S3 (should-fix, prose) and nits N3 and N4.
    • Routing: 「review#1 正在入座…」 (2026-11-15T11:16Z), then 「review#2 就上线了,后续的契约复审交给他」 (2026-11-15T13:24Z).
    • Round 3 (8e48947d → aea48520) is a prose-only delta: three files, +9/−6, no code, type or binding change. The seat read git diff 8e48947d aea48520 and confirms it sentence by sentence, as the landing rules allow:
      • S3, data-driver.ts aggregate() TSDoc: "…evaluates each measure's filter with the in-memory path's answers" → "…with the in-memory path's answers except where DriverCapabilities.aggregationFilter states a latitude (text compares by the backend collation, as in where)". This is exactly the clause S3 asked for, and it now agrees with the bit's .describe().
      • N3, driver.zod.ts TSDoc: "NOT measured: MySQL and SQL Server, whose default collations are case-insensitive…" → "NOT measured: MySQL, SQL Server and Oracle. The MySQL and SQL Server default collations are case-insensitive…". This adds Oracle to the unmeasured list. The rest is the same claim, split into two sentences, and it asserts nothing new.
      • N3, changeset: "MySQL and SQL Server were not measured; their default collations…" → "MySQL, SQL Server and Oracle were not measured; the MySQL and SQL Server default collations…". Same change.
      • N4: the PR-body S1 row now says the gate does not judge a changeset that declares no break, which is the reviewer's own wording.
    • S3 is closed by this delta. No must-fix or should-fix is open.
  • 接受的偏差: the maintainer approved the out-of-surface edits by name in the card thread (2026-11-15T11:30Z, 「以上都批准」); they are claim amendments 3 to 5. Seat decisions 6892621130 (null correction, option C) and 6893557132 (undeclared-column 400, option A) were judged sound by both review records. Text-collation latitude: option (b), per amendment 6894412038.
  • 范围外去向: Skills-docs: follow-up #33868; N1 is spec filter.zod.ts: state the column-side rule — a column with no value fails an ordering operator (nit N1 of #33698's review) #33869. Both are pm:blocked on this card and move to pm:queue when it lands.
  • 落地条款: Tier S, so the seat lands it after the at-tier PASS: ready + auto-merge under 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z) and 「你应该使用 pm-dispatch 技能审核和落地pr」 (2026-11-07T16:59Z). P2 work under 「后续只处理 p1 p2」 (2026-11-15T05:05Z), finishing in-hand work per 「当前任务处理完,合并后就下班」 (2026-11-15T11:07Z). K = 0 commits on main past PRBASE 895783a1 (the Test Core affected-set diff base).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 14:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head aea4852 · 2026-11-15T15:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: aea485202eb2e4a293afa06bfc04cd8f2571bbcf
Local-runs: none
Scope: packages/spec/src/contracts/data-driver.ts, packages/spec/src/data/driver.zod.ts + packages/spec/src/data/driver.test.ts, packages/spec/authorable-surface/data.json, packages/objectql/src/engine-delete-and-aggregate.ts, packages/objectql/src/having-filter.ts, packages/objectql/src/in-memory-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-aggregation.ts, packages/drivers/driver-sql/src/sql-driver-top-level.ts, packages/drivers/driver-sql/src/sql-driver.ts, packages/drivers/driver-turso/src/turso-driver.ts, packages/drivers/driver-turso/src/remote-transport.ts

Read at 2026-11-15T15:04Z. Claim: comment 6896505381. Independence: implemented and dispatched by domain:spec#4 (os-project-manager); reviewed by os-tesla.

Delta review of record 6895214298, which judged head 8e48947d (PASS, with S3 open and nits N3 and N4). The round-1 record is 6894395884. One commit sits on top of 8e48947d: aea48520, a single-parent commit, so no merge of main; the merge base is still 1e65a389. git diff 8e48947d aea48520 touches three files, 9 lines added and 6 removed: the changeset, packages/spec/src/contracts/data-driver.ts and packages/spec/src/data/driver.zod.ts. Every hunk is comment or changeset prose. Every other file of the PR is byte-identical to the head record 6895214298 judged.

Closures, by id:

  • S3: closed.
  • N3: closed.
  • N4: closed (prose face; the PR body's S1 row now says the gate does not judge a changeset that declares no break).

M1, S1 and S2 stay closed. One new nit on this head, N5 below.

① Derived judgments

  • The delta changes no accept set, no exported type and no emitted SQL. DriverCapabilitiesSchema is the same shape: one optional boolean, absence parses as before. Clause-②: yes (widening) still holds.
  • The .describe() string of aggregationFilter is NOT changed by this delta. The driver.zod.ts hunk sits wholly inside the TSDoc block above the key. So no regeneration is owed, and none was made: no file under content/docs/ is in the delta. Checked on the head all the same: the four rows (driver.mdx lines 35 and 91, driver-sql.mdx line 81, driver-nosql.mdx line 168) match the schema string word for word. The string names no dialect, so adding Oracle to the TSDoc gives it nothing to carry.
  • authorable-surface/data.json holds the key only and is unchanged, which is right.
  • The earlier derived judgments (the live reader in the same change, the walker's null rule, seat decision 6893557132 read as a refusal and not a narrowing, security parity, the ReadableIds leaf never reaching a measure filter) rest on files this delta does not touch. They hold on this head.

② Semver level

  • Check-runs on aea48520: 73 runs, all completed. 60 success, 12 skipped, 1 cancelled. No failure, none in progress, so nothing to wait for. The cancelled run is a PR-body guards run superseded two seconds later by its sibling on the same head, which is green.
  • Green on this head: Type Check · workspace, TypeScript Type Check, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, Type Check UI, Check Changeset (both runs), Lint · docs & code guards, Spec property liveness.
  • The changeset front matter and its Metadata-protocol: semantic and Clause-② lines are unchanged by the delta; only the last sentence of the latitude paragraph moved. minor on @objectstack/spec with patch on objectql, driver-sql and driver-turso is still the right level, and the ADR-0087 reading of record 6895214298 stands as written.

③ Boundary flags

  • The delta stays inside the card's surface: two hits files and the changeset.
  • The PR body carries a Round 3 section that answers S3, N3 and N4 by id, and each answer matches the tree.
  • No hits path is under skills/**. No in-app join or id materialisation is added.
  • The lane seat's ACCEPT on this head is on the PR; it is not an input to this verdict, and the sentences below were read on the tree.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/contracts/data-driver.ts (changed in the delta). The aggregate() TSDoc now reads that a driver declaring supports.aggregationFilter evaluates each measure's filter "with the in-memory path's answers except where DriverCapabilities.aggregationFilter states a latitude (text compares by the backend collation, as in where)". This is the clause S3 asked for. It defers to the bit, so the contract has one statement of the latitude and one pointer to it, and the parenthesis is a true summary of what the bit states: text comparison is the collation's, and the measure filter answers what its where twin answers. That holds by construction on every dialect driver-sql declares the bit on (supports.aggregationFilter: true is one literal for all of them, sql-driver.ts line 395), because the predicate is produced by the same where compiler and placed in the CASE WHEN unchanged. It does not depend on any dialect having been measured. A driver author on a case-insensitive backend now reads here that the bit may be declared, which agrees with DriverCapabilities. S3: closed.

packages/spec/src/data/driver.zod.ts (changed in the delta). The TSDoc now lists MySQL, SQL Server and Oracle as not measured, and then says of MySQL and SQL Server only that their default collations are case-insensitive. The split is right: the old relative clause would have said the same of Oracle once Oracle joined the list, and Oracle's default comparison is binary, so the rewrite avoids a false statement. "Expected to fold case" is still worded as an expectation, and "wherever measured" still limits the closing sentence. The changeset sentence carries the same split. N3: closed.

One thing I tried to break: Oracle treats the empty string as NULL, which is not a collation matter. It does not falsify the sentence. The rule the bit states is the where twin's answer, which holds there too, and the in-memory path reads the rows find() returns from the same backend, so it sees the same NULL. Oracle is named as not measured in any case.

The remaining implementing files (driver.test.ts, authorable-surface/data.json, engine-delete-and-aggregate.ts, having-filter.ts, in-memory-aggregation.ts, sql-driver-aggregation.ts, sql-driver-top-level.ts, sql-driver.ts, turso-driver.ts, remote-transport.ts) are unchanged since record 6895214298, and its judgments and those of record 6894395884 hold on this head: the strict === true gate ANDed with method presence, no ELSE in the conditional aggregate, the tenant predicate outside every CASE, the binding types, the walker change, and the bit turned off in Turso remote mode.

Nits, no effect on the verdict:

  • N1 (nit): carried; filed as spec filter.zod.ts: state the column-side rule — a column with no value fails an ordering operator (nit N1 of #33698's review) #33869 per the PR body.
  • N2 (nit, prose face): carried; the PR body states it.
  • N5 (nit): the bit's TSDoc and now the aggregate() sentence name one difference from the in-memory path, text collation. The changeset names a second: a measure filter the where compiler refuses answers 400 INVALID_FILTER on driver-sql where the in-memory path answered 200 (the cross-class $field comparison with one undeclared side). Record 6894395884 judged that case a refusal of a shape that was failing open, not an accepted one, and the changeset and aggregation-filter-where-doors.test.ts state it, so nothing published is false: the TSDoc speaks of answers, and this is a loud refusal. The driver contract itself does not mention it. A half sentence in the bit's TSDoc ("a filter the driver's own where compiler refuses is refused here too") would complete it. Not new in this delta; follow-up or left as is.

Implemented-by: claude/project-thread-4qnc25
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

Merged via the queue into main with commit 0ac112f Nov 15, 2026
72 of 73 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-4qnc25 branch November 15, 2026 15:27
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ter, and where a per-measure filter runs (objectstack-ai#34014)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9NXd2SJ1z5XQzawbhD1qEaF)_

Fixes objectstack-ai#33868

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 改了什么:查询技能新增一条规则「没有值的列(null
或缺失)不满足任何大小比较(`$gt/$gte/$lt/$lte/$between`)」,并改正了「带 filter
的度量一定走内存」这句已过时的话(声明 `aggregationFilter` 的驱动在数据库里算),另加一条评测用例。
- 为什么改:objectstack-ai#33854 已改变运行时行为;不教的话,作者和 AI 会以为 `amount $lte 0`
也会把没填金额的记录算进去,仪表盘上的数字会被误读,且技能还在说一句已经不成立的话。
- 风险与回滚:只改技能文档、一条 eval 和一个 changeset,不动运行时代码;回滚即 revert 本 PR。
- 先看:`skills/objectstack-query/rules/aggregation.md`(Filtered
Aggregation 提示块,措辞最接近契约承诺)→ `rules/filters.md`(新规则一节,以及为付账删掉的两处重复)→
`evals/filters-pagination-search.json` 第 8 条。
- 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期全绿,filters.md 显示
`2473 / 2473`、aggregation.md 显示 `2264 / 2357`。
- 需要你做的:批准本 draft(受管面 Tier H)。

## What changes

The query skill now teaches two things PR objectstack-ai#33854 made true, and drops
one sentence it made false.

`skills/objectstack-query/rules/filters.md` (published, English):

- **New section "A column with no value fails every ordering test"** (it
replaces "Prefer `$null` to a bare `null` comparand", whose rule is kept
as its last sentence): `$gt` / `$gte` / `$lt` / `$lte` / `$between`
never match a row whose column is null or absent, in `where`, an
aggregation's `filter` and `having` alike; `{ amount: { $lte: 0 } }`
skips the rows with no amount, and an `$or` with `{ amount: { $null:
true } }` keeps them. `null` is not an ordering comparand (`{ $gte: null
}` is refused `INVALID_FILTER` / 400).
- **Paid for in the same file** by two restatements: the
case-sensitivity paragraph, whose rule `SKILL.md` § String Operators
carries ("compare CASE-SENSITIVELY; `$icontains` is the case-INSENSITIVE
twin (ASCII folding only)"), now a one-line pointer; and the second Date
example (`$between` over two `Date`s), whose home is the operator
table's `$between` row plus the `$gte: new Date(…)` example kept
directly above it. Lost with no home: the `café` / `CAFÉ` illustration
of ASCII-only folding (the rule survives in SKILL.md).

`skills/objectstack-query/rules/aggregation.md`:

- **§ Filtered Aggregation:** the callout no longer says any filtered
measure "forces the in-memory path — no driver compiles a conditional
aggregate, and one reached directly refuses `NOT_IMPLEMENTED`". A driver
that declares `supports.aggregationFilter` (`driver-sql`; `driver-turso`
outside remote mode) runs the filter in the database whenever the
aggregate itself is pushed down (a date bucket under a non-UTC
`timezone`, or a granularity the driver does not bucket natively, keeps
the whole call in memory: `tzRequiresInMemory` and
`allStructuredSupported` sit in the same route condition), compiled as
that datasource's `where` is: it answers what the same condition answers
there (text by the database collation) and is refused where it is (the
pinned case: a `{ $field }` comparison on a column the object does not
declare, `INVALID_FILTER` / 400). On any other driver the engine reads
the scoped rows and evaluates the filter itself; no answer is promised
beyond that. A column with no value fails its ordering tests either way.
- **§ HAVING:** `avg` / `min` / `max` over no values is `null`, so
`having: { average: { $lte: 0 } }` drops that group.

`skills/objectstack-query/evals/filters-pagination-search.json`: case 8,
one aggregate call returning the total and the count of deals whose
`amount` is zero or less, where a deal with no amount must count.
`must_contain`: `filter`, `$or`, `$lte: 0`, `$null: true`;
`must_not_contain` is empty, so no correct answer that restates the rule
can trip it. Spliced with the file's hand formatting kept.

`skills/objectstack-ui/rules/dashboards.md` is untouched: it never
states how a measure filter is evaluated (it only lists "measure-scoped
filters" as fitting a dataset).

`.changeset/33868-skills-no-value-ordering-measure-filter.md`:
`'@objectstack/skills': patch`.

Every taught fact is read from origin/main at or after `0ac112fc`:

- `packages/objectql/src/having-filter.ts`:
`NULL_IS_NOT_ORDERED_OPERATORS = new Set(['$gt', '$gte', '$lt', '$lte',
'$between'])`; in `checkCondition`, `if (value === undefined &&
!NO_VALUE_ANSWERED_BY_OPERATOR.has(op)) return false;` then `if (value
=== null && NULL_IS_NOT_ORDERED_OPERATORS.has(op) &&
!orderingComparandHoldsNull(op, target)) return false;`. Pinned by
`having-filter-null-ordering.test.ts` (each face, and the empty-group
`having`) and
`packages/rest/src/aggregate-measure-filter-pushdown.test.ts` ("a NULL
amount fails an ordering filter on both paths").
- `packages/spec/src/data/filter.zod.ts` ("null is NOT a comparand: null
is not ordered — state absence with the null predicate instead") and
`filter-comparand-shape.ts` (`nullOrderingComparandError`,
`INVALID_FILTER` / 400).
- `packages/objectql/src/engine-delete-and-aggregate.ts`: `const
aggregationFilterNative = drv?.supports?.aggregationFilter === true;`
and the `(!hasAggregationFilter || aggregationFilterNative)` route
condition.
- `packages/drivers/driver-sql/src/sql-driver.ts` (`aggregationFilter:
true`); `packages/drivers/driver-turso/src/turso-driver.ts`
(`aggregationFilter: false` in remote mode);
`packages/spec/src/data/driver.zod.ts` (the bit's describe text: text
compares by the backend collation as in `where`).
- `packages/rest/src/aggregation-filter-where-doors.test.ts`: the
`where` twin and the per-aggregation filter of `{ created_at: { $ne: {
$field: 'photo' } } }` on an audit-opt-out object both answer `{ status:
400, code: 'INVALID_FILTER' }` on driver-sql.

### Size readings (tree objectstack-ai/objectstack, origin/main bc6b7ff
→ head d47493b)

| Reading | Before | After |
|:--|--:|--:|
| `rules/filters.md` lines / bytes / tokens | 211 / 9925 / 2482 | 209 /
9892 / 2473 (row re-locked 2482 → 2473 at the measurement) |
| `rules/aggregation.md` lines / bytes / tokens | 262 / 8381 / 2096 |
270 / 9053 / 2264 (ceiling 2357, row unchanged) |
| `evals/filters-pagination-search.json` lines / bytes / tokens | 75 /
5464 / 1366 | 85 / 6422 / 1606 (eval fixture, measured, not ratcheted) |
| All 11 `skills/*/SKILL.md` lines | 4596 | 4596 (none touched) |
| Whole bundle, ratcheted (authored) tokens / ceilings | 187685 / 194017
| 187844 / 194008 (+159 / -9) |
| Whole bundle, eval fixtures tokens | 46508 | 46748 (+240) |
| Whole bundle total tokens | 245988 | 246387 (+399) |

`scripts/check-skills-token-ratchet.mjs`: the `filters.md` row is
re-locked at its measured 2473 (review N3), with the arithmetic and each
cut's home in the row comment; no other row moves.

## Tests

No code changed, so there is nothing to ablate. Gate readings are under
Verification.

## Acceptance notes

- **Build tier, declared:** `dispatch-gates --tier` puts `skills/**` at
the contract-review tier (clause ①). This card thread is served below it
and cannot switch its own model, so (as the claim records) the authoring
and the commit ran in an isolated os-dev subagent pinned to the
contract-review tier inside this worktree; the merge of main, relay
writes, gates and report ran in the thread.
- **Not taught, on purpose:** what `$ne` / `$nin` / `$notContains`
answer on a column with no value (each answers a column with no value by
its own arm, `NO_VALUE_ANSWERED_BY_OPERATOR`). It is a standing rule
this card did not change; the card's list of unchanged operators also
omits `$empty`, which the code keeps in the same set.
- **Refusal wording:** the skill names only the pinned refusal case. A
plain undeclared key (`{ nope: 1 }`) answers `INVALID_FIELD`, not
`INVALID_FILTER`, on both positions (row 4 of
`aggregation-filter-where-doors.test.ts`), so "undeclared column ⇒
`INVALID_FILTER`" is not written bare.
- **NOT MEASURED:** `driver-mongodb` own `where` on a null column with
`$lte` (no pin read; it rests on BSON type bracketing). `driver-memory`
own `find` is pinned by
`memory-matcher-null-value-and-comparand.test.ts` (objectstack-ai#13553), per review
6897568297.
- Review round 1 (record 6897568297): S1 (pushdown clause), N1 ("no
values") and N3 (row re-lock) taken in one commit, `b87277b6`, authored
at the contract-review tier like the first; N2 left as is.
- Main was merged before each gate run (`a7754819`, `d47493ba`) so the
derivation read a current tree.

## Verification

All readings are at head `d47493ba` (`git rev-parse --short HEAD` after
the last commit), tree objectstack-ai/objectstack.

- Package build closure: `turbo run build --concurrency=2
--filter='./packages/**'` under `os-verify-lock.sh`, `VERDICT
command-exit 0` (held 5m35s, after the first merge; the second merge
touched only `scripts/pm/**` and `.claude/**`, nothing built).
- Acceptance gates: `check:skill-docs` ✅ "Skill docs in sync";
`check:skill-refs` ✅ "9 generated files in sync with packages/spec";
`check:skill-examples` ✅ "346 prose examples type-check across 3
surface(s)"; `check-skills-token-ratchet` ✓ "57 authored bundle file(s)
within their ceilings", rows `2473 / 2473` and `2264 / 2357`.
- `dispatch-gates --ran`: "63 derived famil(ies) accounted for — 63 run,
0 NOT-MEASURED (a DERIVED zero)" (63, not 45: the ratchet script is now
in the diff, so its families and `check:pm-dispatch-gates` are derived).
Three extra runs are recorded outside the derivation
(`check:skill-docs`, `check:skill-refs`, `check:skill-examples`).
- CI families outside the derived list are left to this PR's check-runs.

<details><summary>Derived gate list, 63 + 3, exit codes captured before
any pipe</summary>

```text
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs --self-test :: exit 0
node scripts/check-doc-route-spelling.mjs --advisory :: exit 0
node scripts/check-doc-route-spelling.mjs --self-test :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-self-test-wired.mjs :: exit 0
node scripts/check-self-test-wired.mjs --self-test :: exit 0
node scripts/check-self-test-workflow-commands.mjs :: exit 0
node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0
node scripts/check-skills-token-ratchet.mjs :: exit 0
node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0
node scripts/check-whole-set-label-write.mjs :: exit 0
node scripts/check-whole-set-label-write.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:bash32-floor :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-command-ids :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:corpus-claim-drift :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 0
pnpm check:entry-guard :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:parse-guard :: exit 0
pnpm check:pm-dispatch-gates :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-skill-id-lint :: exit 0
pnpm check:pnpm-filter-targets :: exit 0
pnpm check:pnpm-flag-spellings :: exit 0
pnpm check:published-files :: exit 0
pnpm check:ratchet-remedy-authority :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:role-word :: exit 0
pnpm check:scripts-symbol-anchors :: exit 0
pnpm check:skill-compatibility :: exit 0
pnpm check:skill-frame-sync :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:skill-links :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm --filter @objectstack/spec check:skill-docs :: exit 0
pnpm --filter @objectstack/spec check:skill-refs :: exit 0
pnpm --filter @objectstack/spec check:skill-examples :: exit 0
```

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmQokeaWJKGm2S7ZrDA)_

<!-- signed: domain:skills#2 · os-steve ·
session_01ADHkmRxXmVQ41fqnaTPGAv -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 protocol:data size/xl 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.

aggregate: a per-measure filter compiles to a conditional aggregate in the GROUP BY instead of the in-memory aggregate (epic #33631 R1)

1 participant