Repository navigation
docs(skills): teach that a column with no value fails an ordering filter, and where a per-measure filter runs - #34014
Conversation
…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>
|
domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv Contract reviewServed-tier: 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 ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix.
S1 (should-fix): "A driver that declares N1 (nit): "
N2 (nit): the assertions are loose in one direction and strict in the other. N3 (nit): re-lock the Sibling skills: no other skill states how a measure filter or Implemented-by: 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>
|
domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv Contract reviewServed-tier: Delta review of record 6897568297, which judged head The range is two commits. Closures, by id:
No new must-fix or should-fix. One new nit, N4. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
N4 (nit): the re-wrap left one line of the callout at 87 characters ("a column the object does not declare,
Implemented-by: VERDICT: PASS |
|
domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv 维护者速读
席位核对Verdict: ACCEPT, held for the maintainer · head
|
Requested by Steve · project thread
Fixes #33868
Clause-②: no
Metadata-protocol: none
维护者速读
$gt/$gte/$lt/$lte/$between)」,并改正了「带 filter 的度量一定走内存」这句已过时的话(声明aggregationFilter的驱动在数据库里算),另加一条评测用例。amount $lte 0也会把没填金额的记录算进去,仪表盘上的数字会被误读,且技能还在说一句已经不成立的话。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。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):$nullto a barenullcomparand", whose rule is kept as its last sentence):$gt/$gte/$lt/$lte/$betweennever match a row whose column is null or absent, inwhere, an aggregation'sfilterandhavingalike;{ amount: { $lte: 0 } }skips the rows with no amount, and an$orwith{ amount: { $null: true } }keeps them.nullis not an ordering comparand ({ $gte: null }is refusedINVALID_FILTER/ 400).SKILL.md§ String Operators carries ("compare CASE-SENSITIVELY;$icontainsis the case-INSENSITIVE twin (ASCII folding only)"), now a one-line pointer; and the second Date example ($betweenover twoDates), whose home is the operator table's$betweenrow plus the$gte: new Date(…)example kept directly above it. Lost with no home: thecafé/CAFÉillustration of ASCII-only folding (the rule survives in SKILL.md).skills/objectstack-query/rules/aggregation.md:NOT_IMPLEMENTED". A driver that declaressupports.aggregationFilter(driver-sql;driver-tursooutside remote mode) runs the filter in the database whenever the aggregate itself is pushed down (a date bucket under a non-UTCtimezone, or a granularity the driver does not bucket natively, keeps the whole call in memory:tzRequiresInMemoryandallStructuredSupportedsit in the same route condition), compiled as that datasource'swhereis: 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.avg/min/maxover no values isnull, sohaving: { 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 whoseamountis zero or less, where a deal with no amount must count.must_contain:filter,$or,$lte: 0,$null: true;must_not_containis 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.mdis 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']); incheckCondition,if (value === undefined && !NO_VALUE_ANSWERED_BY_OPERATOR.has(op)) return false;thenif (value === null && NULL_IS_NOT_ORDERED_OPERATORS.has(op) && !orderingComparandHoldsNull(op, target)) return false;. Pinned byhaving-filter-null-ordering.test.ts(each face, and the empty-grouphaving) andpackages/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") andfilter-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: falsein remote mode);packages/spec/src/data/driver.zod.ts(the bit's describe text: text compares by the backend collation as inwhere).packages/rest/src/aggregation-filter-where-doors.test.ts: thewheretwin 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)
rules/filters.mdlines / bytes / tokensrules/aggregation.mdlines / bytes / tokensevals/filters-pagination-search.jsonlines / bytes / tokensskills/*/SKILL.mdlinesscripts/check-skills-token-ratchet.mjs: thefilters.mdrow 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
dispatch-gates --tierputsskills/**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.$ne/$nin/$notContainsanswer 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.{ nope: 1 }) answersINVALID_FIELD, notINVALID_FILTER, on both positions (row 4 ofaggregation-filter-where-doors.test.ts), so "undeclared column ⇒INVALID_FILTER" is not written bare.driver-mongodbownwhereon a null column with$lte(no pin read; it rests on BSON type bracketing).driver-memoryownfindis pinned bymemory-matcher-null-value-and-comparand.test.ts(driver-memory's reference matcher puts a NULL-VALUED row inside$gt/$gte/$lt/$lteon a NUMERIC column —nullcoerces to0, and the live mingo path excludes it #13553), per review 6897568297.b87277b6, authored at the contract-review tier like the first; N2 left as is.a7754819,d47493ba) so the derivation read a current tree.Verification
All readings are at head
d47493ba(git rev-parse --short HEADafter the last commit), tree objectstack-ai/objectstack.turbo run build --concurrency=2 --filter='./packages/**'underos-verify-lock.sh,VERDICT command-exit 0(held 5m35s, after the first merge; the second merge touched onlyscripts/pm/**and.claude/**, nothing built).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", rows2473 / 2473and2264 / 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 andcheck:pm-dispatch-gatesare derived). Three extra runs are recorded outside the derivation (check:skill-docs,check:skill-refs,check:skill-examples).Derived gate list, 63 + 3, exit codes captured before any pipe
Generated by Claude Code