Skip to content

docs(skills): teach that a column with no value fails an ordering filter, and where a per-measure filter runs - #34014

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-xamcki
Nov 15, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-xamcki

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33868

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:查询技能新增一条规则「没有值的列(null 或缺失)不满足任何大小比较($gt/$gte/$lt/$lte/$between)」,并改正了「带 filter 的度量一定走内存」这句已过时的话(声明 aggregationFilter 的驱动在数据库里算),另加一条评测用例。
  • 为什么改:feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #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 #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 Dates), 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 (driver-memory's reference matcher puts a NULL-VALUED row inside $gt/$gte/$lt/$lte on a NUMERIC column — null coerces to 0, and the live mingo path excludes it #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.
Derived gate list, 63 + 3, exit codes captured before any pipe
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

Generated by Claude Code

…ter, and where a per-measure filter runs

objectstack-query rules/filters.md: `$gt` / `$gte` / `$lt` / `$lte` /
`$between` never match a row whose column is null or absent, in `where`,
an aggregation's `filter` and `having` alike; the `$or` + `$null: true`
spelling keeps those rows; `null` is not an ordering comparand. Paid for
in the same file by two restatements: the case-sensitivity paragraph
SKILL.md's String Operators section carries, and a second `$between`
example. 9925 -> 9892 bytes, 2482 -> 2473 tokens; the ceiling row stays.

rules/aggregation.md: a per-measure `filter` no longer "forces the
in-memory path". A driver declaring `supports.aggregationFilter` runs it
in the database, answering and refusing as that datasource's `where`
does; any other driver has the engine evaluate it over the scoped rows.
`having` on an `avg` / `min` / `max` over no rows fails an ordering
test. 8381 -> 8883 bytes, 2096 -> 2221 tokens, inside the 2357 row.

One eval case (id 8) where the no-value rule decides a measure filter.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a775481935f73fefdfa78ee1724021cc2e4eb56d
Local-runs: none
Scope: skills/objectstack-query/evals/filters-pagination-search.json, skills/objectstack-query/rules/aggregation.md, skills/objectstack-query/rules/filters.md + none

First review of this head. Read: card #33868 and its four comments (6894608532, 6896874152, 6897100433, 6897496261), the PR body, the file list (4 files) and the net diff origin/main...a7754819 (the head is one merge of main 03b4d2d1 over f1a9233f; the net diff is +45/-21 in those 4 files). The semantic change taught is PR #33854 (merged as 0ac112fc, an ancestor of the origin/main read here, bc6b7ffd); its records 6894395884, 6895214298 and 6896557459 were read for what was promised. No file in the diff implements or enforces the three hits files, hence + none. The changeset is the lane seat's ACCEPT; its level and declaration lines are judged in ②. Code named below is on origin/main, read to judge, not reviewed.

① Derived judgments

  • Null or absent column fails the five ordering operators, engine-evaluated positions. True. packages/objectql/src/having-filter.ts: NULL_IS_NOT_ORDERED_OPERATORS = new Set(['$gt', '$gte', '$lt', '$lte', '$between']), and in checkCondition if (value === undefined && !NO_VALUE_ANSWERED_BY_OPERATOR.has(op)) return false; followed by if (value === null && NULL_IS_NOT_ORDERED_OPERATORS.has(op) && !orderingComparandHoldsNull(op, target)) return false;. having-filter-null-ordering.test.ts pins it on the three faces that share the walker (matchesAggregationFilter, applyHaving, matchesDriverWhere), with amount null on one row and absent on another.
  • "in where ... alike". True on every where path I could read. SQL where: record 6894395884 measured the walker against driver-sql's where compiler, and the five operators were the only divergence on a NULL column. Plugin-driver in-memory where: driver-query-in-memory.ts filters with matchesDriverWhere. driver-memory's own find: pinned by memory-matcher-null-value-and-comparand.test.ts (driver-memory's reference matcher puts a NULL-VALUED row inside $gt/$gte/$lt/$lte on a NUMERIC column — null coerces to 0, and the live mingo path excludes it #13553, { n: { $lte: 0 } } keeps only the row storing 0; driver-memory's reference matcher matches a NULL-VALUED row against a well-formed bounded $between — the live mingo path excludes it, so one package answers one filter two ways #13549 for a bounded $between). The PR body lists this as not measured; the pin exists. driver-mongodb's own where has no pin I read; it rests on BSON type bracketing. Nothing in the tree contradicts the sentence.
  • having on an empty aggregate. True. in-memory-aggregation.ts: out[alias] = nums.length === 0 ? null : ... for avg, the same for min / max, and the comment "count/count_distinct/sum → 0, avg/min/max → null"; the test "an empty group's avg is not ≤ 0" pins applyHaving dropping it. having is engine-applied on both routes (return applyHaving(aggregated, ast.having, ...) on the pushed-down one), so the sentence holds on driver-sql too. Wording: see N1.
  • null is not an ordering comparand, refused INVALID_FILTER / 400. True at all three positions. packages/spec/src/data/filter-comparand-shape.ts: if (ORDERING_COMPARAND_OPERATORS.has(op)) { if (spec[op] === null) { throw nullOrderingComparandError(...) } }; the engine runs that door on where (engine-top-level.ts), on each aggregations[i].filter and on having (engine-delete-and-aggregate.ts, assertListComparandShapes(object, 'aggregate', aggFilter, ...) and (..., query.having, 'having')). The bare { deleted_at: null } sentence is the old section's rule, kept; the walker test pins { amount: null } selecting the null and the absent row.
  • Unchanged operators. The skill teaches none of them either way, which is consistent: it does not enumerate $ne, $nin, $notContains, $exists, $null or the equality family on a no-value column anywhere. $empty sits with them in NO_VALUE_ANSWERED_BY_OPERATOR and is pinned unmoved. It should not be named alone: naming one member of a set the file does not teach would imply the others differ. The existing $empty rows (IS NULL, '' or [] by type) already say a null column is empty. No finding; the dev's option A stands.
  • Pushdown only on drivers declaring the bit. True as to which drivers: engine-delete-and-aggregate.ts reads const aggregationFilterNative = drv?.supports?.aggregationFilter === true;; sql-driver.ts declares aggregationFilter: true; turso-driver.ts has ...(this.transportMode === 'remote' ? { aggregationFilter: false } : {}). "On any other driver the engine reads the scoped rows and evaluates the filter itself" is the find() plus applyInMemoryAggregation branch, and promises nothing more. The sentence is unqualified about WHEN the declaring driver gets the call; see S1.
  • Answers what where answers, text by the database collation. True when pushed down: sql-driver-top-level.ts says the driver "compiles a measure filter with the SAME where compiler (applyFilters) a where goes through", and the bit's describe text reads "except that text compares by the backend collation as in where".
  • Refuses what where refuses. The named case is true and is the pinned one: aggregation-filter-where-doors.test.ts row 3 ({ amount: { $gt: { $field: 'nope' } } }, 400 INVALID_FILTER) and the aggregate: a per-measure filter compiles to a conditional aggregate in the GROUP BY instead of the in-memory aggregate (epic #33631 R1) #33698 re-recorded audit-opt-out case. The dev was right not to write "undeclared column" bare: a plain undeclared key answers INVALID_FIELD (row 4).

② Semver level

  • '@objectstack/skills': patch is right: prose and one eval fixture in the published bundle, no schema, no code. It is the name the neighbouring skills changesets use.
  • Clause-②: no is right: no accept set moves. Metadata-protocol: none is right: the semantic change was declared by feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #33854 (semantic, per S1 of record 6894395884); this PR pays its Skills-docs: follow-up and changes no meaning itself. The PR body and the changeset carry the same two lines.
  • Check-runs on this head, read at about 2026-11-15T16:21Z: 41 runs, 18 success, 16 skipped, 0 failed, 7 still running: Test Core (1/8), Test Core (2/8), Lint · ESLint, Lint · docs & code guards, Lint · CI, release & engine gates, Lint · repo & tooling gates, Type Check · consumer gates. Green already: Check Changeset, Governed Surface Queue Guard, PR-body guards, Type Check · workspace, Type Check · source gates, Build Core, Lint · PM dispatch-gates. The skill gates (token ratchet, skill-docs, skill-links, skill-examples) had not reported under a finished lint family at read time; the dev's local readings of them are in the report, and the running families are the seat's to wait for before landing.

③ Boundary flags

  • Authoring tier. The claim (6897100433) and the report record that the card thread is served below the contract-review tier and that authoring and the commit ran in an isolated os-dev subagent pinned to it on the same branch. That is declared before the work and repeated in the PR body. I cannot verify the subagent's served tier from the inputs given; it is the seat's to hold with the transcript. It does not change what the tree says.
  • The two removals in filters.md. (a) The case-sensitivity paragraph: its home is SKILL.md, String Operators, which reads "compare CASE-SENSITIVELY; $icontains is the case-INSENSITIVE twin (ASCII folding only). So the user-facing cases want $icontains". Both the rule and the advice survive, the pointer left in filters.md names the section in the form the file already uses for Logical Operators, and SKILL.md is the entry a reader comes through. Lost with no home: the café / CAFÉ illustration and the filter.zod.ts citation; neither is a rule. (b) The second Date example: $between keeps its table row here and its row and example in SKILL.md; a Date as a comparand keeps the $gte: new Date(...) example directly above. No rule lost. Both removals are genuine deletion of restatement in the same file, which is what the ratchet discipline asks for.
  • dashboards.md untouched. Verified: its one mention is the envelope table row "WHERE ($and/$or/$not on the base object) + measure-scoped filters"; it states no evaluation path. Right to leave.
  • Ratchet row. filters.md measures 2473 against a row of 2482 (0 headroom on main). The gate's header says lowering "is always legitimate and encouraged" and its row history re-locks at the measurement; it does not require it. See N3.
  • aggregation.md grows 2096 to 2221 inside its existing row of 2357 with no deletion. The gate accepts it and the headroom is not one of the two reserved rows the header names. Noted, no finding.
  • Open question 1 ($empty): A, as judged in ①. Open question 2 (re-lock): N3.
  • Out-of-scope note in the report (whether a pushed-down measure filter answers $like / $ilike, which filters.md says objectql having and service-analytics refuse): the sentence in filters.md names having and service-analytics, not a measure filter, so this diff leaves no contradiction. Not examined further.

④ Design judgment

No must-fix.

skills/objectstack-query/rules/filters.md. The new section is true (①), sits where the old null advice sat, keeps that advice as its last sentence, and gives the one spelling an author needs. It reads consistently with the rest of the file: "an aggregation's filter and having" is the phrase the Relation Filters section already uses. The heading changed; nothing in skills/** links to the old heading. A grep of skills/** for other statements about empty values and ordering filters, the in-memory path, NOT_IMPLEMENTED and a conditional aggregate finds no contradiction left: the only other hits are the $null / $exists / $empty tables, which agree.

skills/objectstack-query/rules/aggregation.md. The false sentence ("forces the in-memory path, no driver compiles a conditional aggregate") is gone, and what replaces it is true for the call the card describes. One over-statement:

S1 (should-fix): "A driver that declares supports.aggregationFilter ... runs it in the database" is not true of every call on such a driver. The route condition is typeof drv.aggregate === 'function' && allStructuredSupported && !tzRequiresInMemory && (!hasAggregationFilter || aggregationFilterNative), with tzRequiresInMemory = !!tz && tz !== 'UTC' && hasDateBucket. So on driver-sql an aggregate that buckets a date under a non-UTC timezone, or by a granularity the dialect does not bucket, stays on find() plus the in-memory path, measure filters included. On that call the sentence "it answers what the same condition answers there (text by the database collation)" is false: the call's where goes to the database and the measure filter is compared in JS, so on a case-insensitive collation stage: 'won' counts differently in the two positions. A dataset with a date dimension and an organisation time zone is an ordinary shape, not a corner. The same file already teaches the bucketing fallback (Date-Bucketed Grouping: "transparently falls back to in-memory bucketing otherwise"), so the reader has the concept. One clause closes it, for example: "runs it in the database whenever the aggregate itself is pushed down (a date bucket under a non-UTC timezone, or one the dialect cannot bucket, keeps the whole call in memory)". The no-value rule is unaffected either way, as the callout's last sentence says. aggregation.md has 136 tokens of headroom.

N1 (nit): "avg / min / max over no rows is null". The code's condition is no non-null VALUES (the fold keeps only values that are not null, then answers null when none is left), which also covers a group whose rows all lack the field, the case a plain groupBy actually produces (a group always has a row). "over no values" is truer and no longer. The example alias average appears nowhere else in the section; harmless.

skills/objectstack-query/evals/filters-pagination-search.json, case 8. Self-consistent: each of filter, $or, $lte: 0 and $null: true occurs in expected_output (checked by string inclusion on the parsed file); must_not_contain is empty, so no correct answer restating the rule can trip it. The prompt matches the card's scenario ("count where amount $lte 0") and expected_output is correct against the code: count with no field, the per-measure filter, and the $or with $null: true. It follows the file's hand formatting.

N2 (nit): the assertions are loose in one direction and strict in the other. filter matches any answer that uses the word; filter: would bind it to the key. And $or / $null: true fail two answers the engine also answers correctly: $empty: true on the number field, and { $not: { amount: { $gt: 0 } } } (the walker test pins negation keeping the no-value rows). The case tests the taught spelling, which is a fair thing for an eval to do; left as is or tightened in a later pass.

N3 (nit): re-lock the filters.md row at 2473. Leaving 9 tokens gives the next author growth that no deletion paid for, on a file that sat at zero; the gate's own history banks a shrink at the measurement. It is a one-line edit to a governed script and has no effect on what the skill teaches, so it does not hold this head; do it in this PR if S1 is taken, or in the next PR that touches the file.

Sibling skills: no other skill states how a measure filter or having is evaluated; objectstack-ui dashboards.md only lists the capability. No contradiction left elsewhere.

Implemented-by: claude/project-thread-xamcki
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: PASS

… pushed down; re-lock the filters.md ceiling

rules/aggregation.md, Filtered Aggregation: a driver declaring
`supports.aggregationFilter` runs a per-measure `filter` in the database
only when the aggregate itself is pushed down. A date bucket under a
non-UTC `timezone`, or one the driver does not bucket natively, keeps
the whole call in memory, measure filters included. HAVING: `avg` /
`min` / `max` are `null` over no values, not only over no rows.

Token ratchet: the rules/filters.md row is re-locked from 2482 to its
measured 2473 (9892 bytes), zero headroom.

Claude-Session: https://claude.ai/code/session_01ADHkmQokeaWJKGm2S7ZrDA
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: d47493babcaa8ba290719aa97dc1a419d3f5e1f4
Local-runs: none
Scope: skills/objectstack-query/evals/filters-pagination-search.json, skills/objectstack-query/rules/aggregation.md, skills/objectstack-query/rules/filters.md + scripts/check-skills-token-ratchet.mjs

Delta review of record 6897568297, which judged head a7754819 in full (PASS, with S1 open and nits N1, N2, N3). That record stands as written except where this one says otherwise. Read: the commit range a7754819..d47493ba, the net diff against main, the r2 PR body, and the check-runs on this head.

The range is two commits. b87277b6 (single parent a7754819) touches two files, +14/-6: skills/objectstack-query/rules/aggregation.md and scripts/check-skills-token-ratchet.mjs. d47493ba is a merge of b87277b6 with main bc6b7ffd. Verified: git diff --name-only b87277b6 d47493ba lists seven files, all under scripts/pm/** or .claude/** (three in scripts/pm/fleet-write, two in scripts/pm, two in .claude/skills/pm-dispatch/references), so the dev's statement about the merge holds; and git diff --name-only bc6b7ffd d47493ba lists exactly the PR's five files, so the merge brought nothing of its own into the net diff. filters.md, the eval file and the changeset are byte-identical to the head the earlier record judged. The net diff is now 5 files, +54/-22.

Closures, by id:

  • S1: closed.
  • N1: closed.
  • N3: closed.
  • N2: left as is by the dev (stated in the PR body); it was a nit and stays one.

No new must-fix or should-fix. One new nit, N4.

① Derived judgments

  • S1, the pushdown clause. The callout now reads that a declaring driver "runs it in the database whenever the aggregate itself is pushed down (a date bucket under a non-UTC timezone, or one the driver does not bucket natively, keeps the whole call in memory)". Checked against packages/objectql/src/engine-delete-and-aggregate.ts on this head. The first exception is const tzRequiresInMemory = !!tz && tz !== 'UTC' && hasDateBucket;. The second is const granularityCaps = drv?.supports?.queryDateGranularity; and allStructuredSupported, which is structuredItems.every(...) returning granularityCaps?.[g.dateGranularity] === true for each item that carries a dateGranularity. Both sit in the one route condition beside (!hasAggregationFilter || aggregationFilterNative), and when either fails the call takes driver.find() plus applyInMemoryAggregation, measure filters included. The dev's "the driver does not bucket natively" is the more exact reading than my suggested "the dialect cannot bucket": the engine reads a per-granularity bit the DRIVER advertises, and the code's own comment names a driver face that advertises none (the Turso remote transport). "One" reads back to "a date bucket", which is the unit the bit is keyed by. The two exceptions named are the whole set: the remaining conjunct, typeof drv.aggregate === 'function', is true of any driver that can declare the bit usefully. The parity and collation sentences that follow are now scoped to the pushed-down call, where they are true by construction (same where compiler). S1: closed.
  • N1. "avg / min / max over no values is null" matches the fold (values that are not null are kept, and none left answers null) and now covers the group a plain groupBy produces. N1: closed.
  • Every other derived judgment of record 6897568297 rests on text this range does not touch, and holds on this head.

② Semver level

  • The changeset is unchanged: '@objectstack/skills': patch, Clause-②: no, Metadata-protocol: none. The PR body carries the same two lines. A lowered ratchet row in a repo script moves no package and no accept set, so the level and both declarations stay right.
  • Check-runs on d47493ba, read at about 2026-11-15T16:46Z: 49 runs, 29 success, 18 skipped, 0 failed, 2 still running.
  • Final and green on this head: Lint · PM dispatch-gates, Lint · repo & tooling gates, Lint · docs & code guards, Lint · CI, release & engine gates, Lint · ESLint, the three scoped lint families and the Lint & Repo Gates roll-up; Type Check · workspace, · source gates, · consumer gates, · debt ledger and the TypeScript Type Check roll-up; Build Core, Plan Test Core shards, Test Core (1/8), (2/8), (3/8) and the Test Core roll-up (three shards is what the planner scheduled); Test UI, Live E2E UI, Dogfood Regression Gate, Governed Surface Queue Guard, and the first runs of Check Changeset, PR-body guards, Check PR Size and Auto Label. Every lint family that was still running when the earlier record was written has now reported green on the new head, the families the ratchet script's presence adds among them.
  • Not final: a second Check Changeset and a second PR-body guards run, both started 16:45Z by the PR-body replacement. Their first runs on this same head are green; the reruns read the r2 body and are the seat's to see finish. The second Auto Label and Check PR Size runs from that event completed as skipped.

③ Boundary flags

  • The range stays inside the claim's file surface: the claim names "ratchet rows only if they move", and the row moved at the reviewer's request.
  • The PR body says b87277b6 was authored at the contract-review tier like the first commit. As before, I cannot verify that from the inputs given; it is the seat's to hold with the transcript.
  • The r2 body's size table and gate count agree with the tree: filters.md 9892 bytes, aggregation.md 9053 bytes, row 2473 / 2473, row 2264 / 2357. The table's caption still names head a7754819 while its figures are this head's; prose face, the seat's.
  • The body's NOT MEASURED line still says no pin was read for driver-memory's own where. Record 6897568297 named the pin (memory-matcher-null-value-and-comparand.test.ts, driver-memory's reference matcher puts a NULL-VALUED row inside $gt/$gte/$lt/$lte on a NUMERIC column — null coerces to 0, and the live mingo path excludes it #13553). The body understates; nothing in the tree is affected.

④ Design judgment

No must-fix, no should-fix.

skills/objectstack-query/rules/aggregation.md (changed in the range). The callout is now true for every call shape (①), and it agrees with the Date-Bucketed Grouping section of the same file, which already teaches the fallback to in-memory bucketing. The clause costs 43 tokens against 136 of headroom; the file measures 2264 against its unchanged row of 2357. The HAVING sentence reads correctly with "no values". No other line of the file moved.

N4 (nit): the re-wrap left one line of the callout at 87 characters ("a column the object does not declare, INVALID_FILTER / 400. On any other driver the") where the block wraps near 78. No effect on rendering, meaning or the token count; fix it the next time the file is touched.

scripts/check-skills-token-ratchet.mjs (in the diff, enforces the hits files). The row for skills/objectstack-query/rules/filters.md goes from 2482 to 2473 and no other row moves. Judged against the gate's own discipline: lowering is the direction the header calls always legitimate, the new value is pinned AT the measurement, and the arithmetic in the comment is right: the file is 9892 bytes on this head, 9892 / 4 is exactly 2473, headroom 0, which is where the file sat on main. The comment follows the form of the rows around it (what was paid, where each cut's home is, the byte arithmetic) and both homes it names are the ones record 6897568297 verified. The earlier comment block for the 2149 to 2482 raise is kept above it, so the row's history reads in order. The aggregation.md row is correctly left alone: that file grew inside existing headroom and a raise was neither needed nor made. The gate's self-test and the dispatch-gates family the script's presence derives are green in CI on this head (Lint · repo & tooling gates, Lint · PM dispatch-gates). N3: closed.

skills/objectstack-query/rules/filters.md and skills/objectstack-query/evals/filters-pagination-search.json are unchanged since record 6897568297, and its judgments on them hold on this head.

Implemented-by: claude/project-thread-xamcki
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

维护者速读

  • 改了什么:objectstack-query 技能跟上 feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #33854 的语义改动。filters.md 写明空值或缺列在 $gt/$gte/$lt/$lte/$between 下不命中(度量 filter、having、内存 where 一致),null 作排序比较值被拒(INVALID_FILTER/400);aggregation.md 删掉「条件聚合一律走内存、没有驱动能编译」这句错话,改为:声明 supports.aggregationFilter 的驱动在聚合本身下推时在库里算,非 UTC 时区的日期分桶或驱动不原生支持的粒度整次走内存;评测加第 8 例;filters.md 的 token 棘轮行 2482→2473(只降)。+54/−22,changeset @objectstack/skills: patch。
  • 为什么改:feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #33854 改了引擎行为,技能还在教旧说法,建应用的 agent 会照错话写聚合过滤。
  • 风险与回滚:只改技能文字、一个评测用例和一行棘轮上限,不动运行时。回滚 = revert。
  • 先看:aggregation.md 的条件聚合提示框(复审 S1 修的那一句),再看 filters.md 新的「空值与排序运算符」一节。
  • 两分钟验证:对照 packages/objectql/src/engine-delete-and-aggregate.ts 的下推条件(tzRequiresInMemory、allStructuredSupported、aggregationFilterNative),看提示框说的两种例外是否就是全部。
  • 需要你做的:受管面 Tier H。低风险技能臂不适用,因为 diff 含 scripts/check-skills-token-ratchet.mjs(复审 N3 要求把棘轮行降到实测值)。达档(CONTRACT_REVIEW_TIER)复审:首轮 6897568297 PASS(S1 should-fix),delta 6897881498 在本 head PASS、S1 已关。请批准并合并,或批准后由席位落地。
  • 席位意见:可以合。

席位核对

Verdict: ACCEPT, held for the maintainer · head d47493babcaa8ba290719aa97dc1a419d3f5e1f4 · card #33868 · report 6897496261 · at-tier contract review 6897568297 (round 1, PASS with S1) + delta 6897881498 (PASS on this head, S1: closed, N1: closed, N3: closed) · read 2026-11-15T16:48Z.

  • Shape: draft → main, Fixes #33868. skills/objectstack-query/rules/filters.md, rules/aggregation.md, evals/filters-pagination-search.json (case 8), scripts/check-skills-token-ratchet.mjs (one row lowered to the measurement), changeset '@objectstack/skills': patch. GOVERNED, Tier H. Clause-②: no; Metadata-protocol: none.
  • Premise measured: PR feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #33854 (merged 0ac112fc) changed the null ordering semantics this PR teaches; the review checked every taught sentence against main's code.
  • Gates: on this head, none failing. Lint (all families, PM dispatch-gates included), Type Check, Build Core, Test Core, Test UI, Live E2E UI are green. The PR-body guard and Check Changeset re-runs from the body edits are the only ones still finishing at this read. The red Lint & Repo Gates / TypeScript Type Check on b87277b6 were lanes cancelled by the merge push, not failures of this diff. Dev: 63 derived, 63 exit 0, --ran reconciles.
  • Accepted deviations: authoring by a subagent pinned to CONTRACT_REVIEW_TIER inside a lower-tier thread (declared before the work, recorded in the body). S1 wording "the driver does not bucket natively" in place of the review's suggestion, judged more exact by the delta. $empty left unnamed (option A, judged right). Nits N2 and N4 left as they are. The body's two stale prose lines were corrected by the seat.
  • Out of scope: none filed.
  • Landing: Tier H. The seat does not flip this PR ready or enqueue it. It needs the maintainer's merge, or an authorised APPROVED review after which the seat lands it.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 15, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 15, 2026 17:05
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit e71ecc1 Nov 15, 2026
58 of 59 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-xamcki branch November 15, 2026 17:22
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
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/s 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.

skills: teach that a column with no value fails an ordering filter, and the per-measure filter pushdown (follow-up of #33698)

3 participants