Skip to content

Commit b87277b

Browse files
committed
docs(skills): a pushed-down measure filter needs the aggregate itself 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>
1 parent a775481 commit b87277b

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,13 @@ export const CEILINGS = new Map([
10691069
// file restates another). Maintainer ruling 2026-10-27 on the decision card
10701070
// 「skills 修复卡的教学和 eval 都撞 token 天花板,怎么付?」, tap A, verbatim and
10711071
// untranslated: 「A:先削重复,余额按实测提高」.
1072-
['skills/objectstack-query/rules/filters.md', 2482],
1072+
// 2482 -> 2473: re-locked AT the measurement after the no-value ordering
1073+
// rule (a null or absent column fails `$gt` / `$gte` / `$lt` / `$lte` /
1074+
// `$between`) was paid in-file by two restatements: the case-sensitivity
1075+
// paragraph (home: SKILL.md, String Operators) and a second `$between` Date
1076+
// example (home: the operator table's `$between` row). Arithmetic in bytes:
1077+
// 9925 -> 9892 (-33 net) -> ceil(9892 / 4) = 2473; headroom 0 tokens.
1078+
['skills/objectstack-query/rules/filters.md', 2473],
10731079
['skills/objectstack-query/rules/pagination.md', 1382],
10741080

10751081
// objectstack-ui `rules/` — the five files the #14296 item 1 split created.

‎skills/objectstack-query/rules/aggregation.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,20 @@ const rows = await engine.aggregate('order', {
113113

114114
`having` filters *groups*; `where` filters the *input rows* before grouping —
115115
use `where` to shrink the scan, `having` to threshold the aggregates. `avg` /
116-
`min` / `max` over no rows is `null`, and no value fails every ordering test
116+
`min` / `max` over no values is `null`, and no value fails every ordering test
117117
([filter rules](./filters.md)): `having: { average: { $lte: 0 } }` drops it.
118118

119119
## Filtered Aggregation (FILTER WHERE)
120120

121121
> ✅ **Enforced.** A per-aggregation `filter` scopes that one measure, so a
122122
> total and a conditional count share ONE call. A driver that declares
123123
> `supports.aggregationFilter` (`driver-sql`; `driver-turso` outside remote
124-
> mode) runs it in the database, compiled as that datasource's `where` is: it
125-
> answers what the same condition answers there (text by the database
126-
> collation) and is refused where it is — a `{ $field }` comparison on a column
127-
> the object does not declare, `INVALID_FILTER` / 400. On any other driver the
124+
> mode) runs it in the database whenever the aggregate itself is pushed down
125+
> (a date bucket under a non-UTC `timezone`, or one the driver does not bucket
126+
> natively, keeps the whole call in memory), compiled as that datasource's
127+
> `where` is: it answers what the same condition answers there (text by the
128+
> database collation) and is refused where it is — a `{ $field }` comparison on
129+
> a column the object does not declare, `INVALID_FILTER` / 400. On any other driver the
128130
> engine reads the scoped rows and evaluates the filter itself. A column with
129131
> no value fails its ordering tests either way ([filter rules](./filters.md)).
130132

0 commit comments

Comments
 (0)