Skip to content

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

Closed

Description

@objectstack-fleet

domain:server#5 · os-elon-musk · session_016WV4cztR1A2CZoxSZyuoGP

Filing gate: ④ child of epic #33631 (SQL performance). Item R1 of the M0 ranked list (#33633): #33631 (comment) (corrected 6889939163). Maintainer's pick (seat decision card, 2026-11-15T06:44Z): 「R1 R7 R12 各一张+测量卡」.

Today

A per-measure aggregation filter forces the in-memory aggregate: every row of the scoped set is fetched into the app (engine-delete-and-aggregate.ts ~1341, ~1392).

Measured (aggregate_measure_filter, p50)

SQLite 383 ms (100k) / 6.2 s (1M); PG 768 ms / 7.3 s (1M).

Target

Conditional aggregate in the GROUP BY (sum(case when … end); PG FILTER (WHERE …) measures the same, ~144 ms): SQLite 5.10 s → 0.53 s, PG 5.09 s → 0.14 s (10x–36x). A driver-sql capability flag decides; analytics measures (A3) consume it.

Business reason

Any dashboard measure with its own filter ("won amount", "open count") fetches the whole set into the app; at 1M rows a single tile takes 6–7 s.

Reader

domain:server#5 area A4 (engine + driver-sql), A3 consumer; next account; size M.

Epic rules

Activity

  1. added
    enhancement
    priority:p2
    pm:queue
    domain:server
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ

    Claim: PM loop round 1 (area S2, #33751 §2)
    Session: session_01QsR2jRmmALkM1ftZxdVatQ
    Account: zhuangjianguo
    Branch: claude/area-A4-33698
    Worktree: /home/claude/wt/area-A4-33698
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/objectql/src/engine-delete-and-aggregate.ts · packages/drivers/driver-sql/src/** · packages/services/service-analytics/** (measure consumer only, if needed) · tests beside them (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: TIER_DEFAULT (dispatch-gates --tier at bd96ec9: no path-derived mandate), effort: high (M, epic #33631 child)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: none
    Premise: holds (M0 bench, merged PR #33662; ranked list 6889544281, corrected 6889939163; no commit on the seam since)
    Serial constraints cleared: #33652 (os-elon-musk, objectql relation semi-join files) — not touched; #33664 (this area, in flight) may edit driver-sql aggregate compile: later lander resolves

  3. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ
    os-dev-report

    {
      "issue": 33698,
      "status": "needs_decision",
      "branch": "claude/area-A4-33698",
      "pr": null,
      "session": "session_01QsR2jRmmALkM1ftZxdVatQ",
      "premise_still_valid": true,
      "summary": "Stopped before any edit under dispatch hypothesis H2: the clean route needs a new @objectstack/spec key, which changes the claim's Clause-② and Metadata-protocol lines. H1 holds at origin/main d7e1a5aa: engine-delete-and-aggregate.ts:1336-1341 computes hasAggregationFilter and sends any non-empty aggregations[].filter to driver.find plus applyInMemoryAggregation (:1392-1393); the driver is never offered it. No existing DriverCapabilities key fits: the schema declares four live bits only (queryDateGranularity, autonumber, batchSchemaSync, transactionsUnsupported), packages/spec/src/data/driver.zod.ts:175. Every supports key the engine, analytics, core and runtime read today is a declared one (autonumber 16, transactionsUnsupported 9, queryDateGranularity 8, batchSchemaSync 3 reads). The in-file rules point to the spec: the DriverCapabilities TSDoc says a new bit arrives with its engine reader in the same change, turso-driver.ts:1871 says a real dispatch point goes in the spec first, and the engine's own #10576 note says a driver that grows native support must advertise a capability flag. A new key lands in packages/spec/authorable-surface/data.json, where data/DriverCapabilities:transactionsUnsupported already sits, so it reads as Metadata-protocol added, a minor changeset and Clause-② yes (widening). The surface also has to grow: TursoDriver extends SqlDriver and spreads super.supports, and its remote transport refuses a per-aggregation filter with NOT_IMPLEMENTED/501 (remote-transport.ts:1554). So any bit SqlDriver advertises needs a remote-mode override in packages/drivers/driver-turso/src/turso-driver.ts, the way queryDateGranularity is overridden at :1918, and that file is outside the claim. Nothing was committed. The claim branch is on origin as an empty landing probe at d7e1a5aa, and the worktree at /home/claude/wt/area-A4-33698 is left in place for a re-claim to reuse.",
      "tests": "none run: nothing was edited. Readings only, all on origin/main d7e1a5aa (worktree HEAD, shallow clone): source reads of the seam and of the driver-sql, driver-turso, driver-memory and driver-mongodb aggregate faces, plus a grep count of the supports keys read in packages/objectql/src, packages/services/service-analytics/src, packages/core/src and packages/runtime/src.",
      "gates": "NOT MEASURED: every gate family, because there is no diff (stopped before the first edit)",
      "dogfood_battery": "n/a — no PR, no `!` in a title, no (narrowing) arm",
      "line_budget": "n/a — no diff",
      "deviations": "none. The landing probe push of the empty claim branch is the only write to the repository.",
      "files_changed": [],
      "mcp_calls": "0",
      "api_writes": "1 — this os-dev-report comment via post-stamped (POST /repos/objectstack-ai/objectstack/issues/33698/comments); plus 1 git push of the empty branch, which is not a REST write",
      "open_questions": [
        {
          "question": "Which route carries the driver-sql capability that lets engine.aggregate push a per-measure filter down as a conditional aggregate?",
          "options": [
            "A — declare one optional boolean in DriverCapabilitiesSchema (working name aggregationFilter), with its engine reader in engine-delete-and-aggregate.ts in the same change. SqlDriver advertises it, TursoDriver turns it off in remote mode, and memory/mongodb/odata leave it absent, so they keep today's in-memory path. Re-claim with Clause-② yes (widening), Metadata-protocol added and a minor changeset on @objectstack/spec. Add packages/spec/src/data/driver.zod.ts plus its regenerated artifacts (gen:schema, gen:docs) and packages/drivers/driver-turso/src/turso-driver.ts to the surface. Four axes. Business: a measured real need: the bench aggregate_measure_filter at 1M takes 6.2 s SQLite / 7.3 s PG, and service-analytics' ObjectQL strategy already lowers every measure filter onto aggregations[].filter (objectql-strategy.ts:554-573), so dashboards consume it with no analytics change. Long-term: the route the contract's own text prescribes (DriverCapabilities TSDoc; turso-driver.ts:1871; the #10576 engine note); contract-first. AI-error: declared and dispatched on in one change, so a driver author or an AI discovers it from the spec, and a driver that does not declare it keeps the correct in-memory path. Scope: one optional bit and one reader, no new gate. Cost: spec regeneration and a contract-tier declaration. The size stays M.",
            "B — a bit on SqlDriver.supports that is not declared in the spec, read by the engine through the existing `as any`. The claim lines stay as they are. Four axes. Business: same gain. Long-term: a private dialect between objectql and driver-sql; it contradicts the DriverCapabilities TSDoc and turso-driver.ts:1871, and no undeclared supports key is read anywhere today. AI-error: worse: the key cannot be discovered from the contract, so a third-party SQL driver never opts in and a subclass inherits it blindly. Scope: barely smaller, because driver-turso still needs the remote-mode override (its spread would otherwise claim the bit and turn a working in-memory answer into a 501).",
            "C — no flag: the engine offers every filtered aggregate to driver.aggregate and falls back to memory when the driver gives its NOT_IMPLEMENTED refusal. The claim lines stay as they are. Four axes. Long-term: control flow keyed on an error code; the refusals in driver-memory, driver-mongodb, driver-sql and driver-turso are documented as unreachable through engine.aggregate and aimed at direct callers. It goes against prefer-failing-to-falling-back. AI-error: a driver that drops the key silently instead of refusing yields wrong numbers with a 200, the #10413 defect. Scope: smallest diff, the worst contract."
          ],
          "recommendation": "A, because it is the only route that keeps the dispatch point in the contract that every other supports reader uses. It needs a re-claim: lines Clause-② yes (widening) and Metadata-protocol added, a minor changeset on @objectstack/spec, and a file surface adding packages/spec/src/data/driver.zod.ts with its generated artifacts plus packages/drivers/driver-turso/src/turso-driver.ts. B and C keep the claim lines, but B still needs driver-turso, and both trade the contract for a smaller diff. Owed in the implementing round, not yet measured: whether any operator the in-memory aggregation evaluator accepts is refused or answered differently by driver-sql's where compiler (H3). If one exists, a static bit cannot express a per-query decline, and the engine would also need a per-query pushability test. H4 and H5 are not measured."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRmmALkM1ftZxdVatQ

    Release: claim 6892269948 (session session_01QsR2jRmmALkM1ftZxdVatQ, branch claude/area-A4-33698) is withdrawn. Nothing landed: the branch is empty at origin/main d7e1a5a, no PR. All of the card remains.
    Why: the measured route needs a new published spec bit, so the card is Clause-② yes (widening) and spec-lane work (seat domain:server#5 routing, 2026-11-15T09:31Z). The bit and its engine reader must land in one change (DriverCapabilities TSDoc), so the whole card moves.
    Report: os-dev-report 6892358189 (four-axis options A/B/C).
    Seat recommendation: option A — one optional boolean in DriverCapabilitiesSchema (working name aggregationFilter) with its reader in engine.aggregate, in the same PR. SqlDriver advertises it; TursoDriver turns it off in remote mode (its remote transport answers NOT_IMPLEMENTED/501 on a per-aggregation filter, remote-transport.ts:1554); memory / mongodb / odata leave it absent and keep today's in-memory path.
    Measured file surface (origin/main d7e1a5a): packages/spec/src/data/driver.zod.ts (+ gen:schema / gen:docs outputs, incl. packages/spec/authorable-surface/data.json) · packages/objectql/src/engine-delete-and-aggregate.ts (reader; today :1336-1341 / :1392-1393 send any aggregations[].filter to the in-memory aggregate) · packages/drivers/driver-sql/src/** (advertise + CASE WHEN / FILTER compile) · packages/drivers/driver-turso/src/turso-driver.ts (remote-mode override, like queryDateGranularity at :1918). Declaration lines for the next claim: Clause-②: yes (widening), Metadata-protocol: added, minor on @objectstack/spec.
    Owed in the implementing round (not measured): H3 — any operator the in-memory aggregation evaluator accepts that driver-sql's where compiler refuses or answers differently (then a per-query pushability test is needed beside the static bit); H4 count/avg/min/max/count_distinct CASE shapes.
    Resume-from: none

  6. added
    pm:queue
    pm:retriage
    and removed
    pm:dispatched
    on Nov 15, 2026
  7. 8 remaining items

  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment to 6892526787 (same session, same branch claude/project-thread-4qnc25): one new test file.

    File surface (added): packages/rest/src/aggregate-measure-filter-pushdown.test.ts, test only. It holds the security parity test (real ObjectQL engine + real SqlDriver + real SecurityPlugin: read scope and tenant wall, bit on vs today's in-memory path, same rows and numbers) and the per-function SQL-vs-in-memory comparison (engine with the bit vs a SqlDriver subclass with the bit off). Why there: objectql and driver-sql do not depend on each other, and packages/rest already has all three as workspace dependencies (the data-nested-relation-permission.test.ts harness). ⛔ no packages/rest/src source change, ⛔ no package.json change. driver-sql keeps its own per-function unit tests against hand-computed fixture answers.

    Open-PR re-read by the dev at a557fa3: no open PR edits the surface (#33652 touches engine-find / query-lowering only; its semi-join leaf rides where, which the pushed-down statement keeps).

  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#4 · os-project-manager · session_01FEkQ5nSNBMzF8jj9quUkjf
    os-dev-report
    {
    "issue": 33698,
    "status": "needs_decision",
    "branch": "claude/project-thread-4qnc25",
    "pr": null,
    "session": "session_01FEkQ5nSNBMzF8jj9quUkjf",
    "premise_still_valid": true,
    "summary": "Stopped before the engine edit under the order's H3 rule: the in-memory measure-filter evaluator and driver-sql's where compiler answer some accepted filters differently. Measured at origin/main a557fa3 through the real engine on a real SqlDriver, 119 filters per cell: each filter as a per-aggregation filter on today's in-memory path vs the same filter as a where. SQLite 106 same, PostgreSQL 16 (C collation) 106 same, PostgreSQL 16 (ICU en-US) 101 same; 4 of the differences are refusals on both sides with the same INVALID_FILTER/400 envelope (wording only). Divergence 1, every SQL cell: a row whose compared column is NULL passes an ordering comparison in memory. checkCondition (objectql having-filter.ts:2435) exits false for a value-less column only when the value is undefined; driver.find hands SQL NULL as null, which reaches the JS comparison: null coerces to 0 (amount lte 0, lt 1, gte 0, gt -5, a numeric between that spans 0) and between fails neither bound test for any comparand type (text, date, time). driver-sql never selects those rows, which is what the spec says (null is not ordered) and what the exit's own docblock intends (a positive test can never be satisfied by a column with no value). So driver-sql is right and the walker is wrong: today a measure such as count where amount lte 0 counts every row with no amount. Divergence 2, PostgreSQL with a non-C collation only: ordering non-temporal text follows the database collation in SQL and UTF-16 code units in memory; the spec declares that order permitted but not promised. MySQL not measured (no server here); a case-insensitive column collation would likely add equality-family rows to divergence 2. Everything else agreed on all cells. Nothing is committed; no spec, engine or driver edit yet. Full table and the probe: /mnt/project-files/pm-orders/spec/33698-h3-measurement.md and 33698-h3-probe.mjs.",
    "tests": "H3 probe (throwaway, outside the repo, run against the worktree's built dist of objectql and driver-sql at a557fa3): node 33698-h3-probe.mjs sqlite → filters=119 same=106 diff=13; node … pg postgres (PG 16, C.UTF-8) → same=106 diff=13; node … pg h3icu (PG 16, ICU en-US) → same=101 diff=18. Every non-refusal difference listed in the measurement file with the row ids on each side. No repo test was added or run: there is no diff.",
    "gates": "NOT MEASURED: every family, because there is no diff (stopped before the engine edit, as the order requires).",
    "dogfood_battery": "n/a — no PR",
    "mcp_calls": "10 — mcp__github__issue_read x4 (card 33698 body and comments x2, epic 33631), mcp__github__pull_request_read get_files x6 (33652, 33703, 33621, 33746, 33725, 33613); all reads, no write tool",
    "api_writes": "1 — this os-dev-report comment via post-stamped (POST /repos//issues/33698/comments). No git push yet.",
    "open_questions": [
    {
    "question": "H3 found filters the in-memory measure evaluator answers differently from driver-sql's where compiler (NULL in an ordering comparison or between, on every SQL cell; non-temporal text ordering on a non-C PostgreSQL collation). How does the pushdown treat them?",
    "options": [
    "A — a per-query pushability test in the engine: engine.aggregate pushes a filtered aggregate down only when no measure filter holds an ordering operator or between (and, if divergence 2 is in scope, no ordering on a non-temporal text field); otherwise it keeps today's in-memory path. Business: the most common dashboard measures (amount gt 0, closed between two days) are exactly the shapes that would stay slow, so most of the 10x-36x gain is lost. Long-term: a second operator walker in the engine whose only job is to route around a wrong answer; the in-memory NULL defect stays and the route keeps it. AI-error: the number a measure answers depends on the filter's shape, invisible to the author. Scope: one walker plus its pins; size stays M.",
    "B — driver-sql refuses those shapes so the engine falls back to the in-memory path. Business: the same lost gain as A. Long-term: the fallback is keyed on a refusal code, the shape the order ruled out as route C, and driver-sql would refuse a filter it answers correctly. AI-error: a direct driver.aggregate caller gets a refusal for a correct query. Scope: smaller than A, worse contract.",
    "C (not one of the order's two; offered because the measurement points at it) — fix the walker to the contract first: a NULL value fails every ordering comparison and between, as the exit at having-filter.ts:2435 already intends for undefined. That is a separate defect card (class a; reach: POST /api/v1/data/:object/query with aggregations[].filter on SQLite or PostgreSQL counts the rows with no value; it also reaches having, where an empty group's avg/min/max is null, and matchesDriverWhere, the in-memory where for plugin drivers), and this card becomes Blocked-by it or carries it by a seat amendment of the surface to having-filter.ts plus its tests. After it, every accepted operator answers the same on SQLite and PostgreSQL (C), and the static bit is enough. Divergence 2 is then left as the spec already declares it (the order of non-temporal text is the backend collation's, not promised), and pushdown makes a measure filter answer exactly as the same datasource's where does. Business: the full measured gain. Long-term: one rule for null in ordering on every face, contract-first. AI-error: fewer wrong numbers, not more. Scope: a small walker change plus pins, and a BREAKING-free correction of an answer that contradicts the spec (a measure or having that counted NULL rows stops counting them; Clause-② for that card is the seat's call)."
    ],
    "recommendation": "C, because driver-sql's answer is the contract's and the walker's is a measured defect against its own docblock: routing around it (A) or refusing the correct answer (B) keeps the wrong number and gives up most of the speed-up on the commonest measure filters. Divergence 2 is contract-declared not promised, so I would not gate the bit on it; if the decider wants it gated, A narrowed to ordering on non-temporal text fields only is the cheap form. MySQL stays NOT MEASURED either way. Ready to continue at once: the spec bit, the driver-sql CASE WHEN compile and the turso remote override are the same under A, B and C, and I can do them while the decision is made; only the engine edit waits."
    }
    ],
    "security_findings": "none",
    "out_of_scope_findings": [
    "class: a · reach: POST /api/v1/data/:object/query (engine.aggregate) with aggregations[].filter { amount: { $lte: 0 } } on SQLite and PostgreSQL counts rows whose amount is NULL (measured: in-memory r02,r03,r04 vs where r02,r03); the same walker serves having and matchesDriverWhere · evidence: objectql having-filter.ts:2435 exits only on undefined; spec says null is not ordered; NO_VALUE_ANSWERED_BY_OPERATOR docblock at :1064 states the intent · dedupe words: having-filter null ordering, aggregation filter null lte, between null row, checkCondition undefined null, matchesAggregationFilter NULL"
    ]
    }


    Generated by Claude Code

  10. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Seat decision on report 6892601944 (H3) and claim amendment 2 to 6892526787 · 2026-11-15T09:54Z

    ⛔ Not a new claim. Same session, same branch claude/project-thread-4qnc25.

    Decision: option C, carried on this card. The walker is fixed to the contract first, in the same PR as its own commit, and then the static bit is enough. This is a lane decision and stays inside the order's goal (pushdown of the per-measure filter). Driver-sql's answer is the one the spec states: null is not ordered. The walker's answer contradicts its own docblock at having-filter.ts (NO_VALUE_ANSWERED_BY_OPERATOR, #5905: a positive test can never be satisfied by a column with no value). Options A and B would keep a wrong number and give up most of the measured gain on the commonest measure filters.

    Why carry it here instead of on a separate card: the parity test this card owes cannot pass until the walker is fixed. The change is small. No open PR edits having-filter.ts (all 43 open PRs read at 09:55Z). One PR keeps the bit and the rule it depends on together, which matches triage 6892421993.

    Scope of the walker fix (narrow):

    • A column whose value is null fails $gt, $gte, $lt, $lte and $between, exactly as undefined already does.
    • ⛔ The operators in NO_VALUE_ANSWERED_BY_OPERATOR ($exists, $null, $ne, $nin, $notContains, and any others listed there) keep today's answers (非否定路径上的 $ne / $nin / $notContains:driver-sql 排除 NULL 行,driver-memory / formula 返回它们(#5146 只裁定了 $not) #5298 ruling A).
    • ⛔ The equality family and $in keep today's answers.
    • Measure and pin that a null comparand (for example { $eq: null }) answers as before.
    • Pin the fix on all three faces the walker serves: a measure filter, having (an empty group's avg/min/max is null), and matchesDriverWhere.
    • Ablate the fix: show red, then restore.

    Divergence 2 (ordering of non-temporal text under a non-C PostgreSQL collation) is not gated. The spec declares that order permitted but not promised, so pushdown answers as the same datasource's where does. Say so in the PR body and in the bit's TSDoc. MySQL stays NOT MEASURED and is named as such.

    File surface (added): packages/objectql/src/having-filter.ts (only the null exit for ordering and $between) and its tests.

    Declarations:

    • The claim lines stay Clause-②: yes (widening: the bit) and Metadata-protocol: added.
    • The walker correction is a patch-level fix to an answer that contradicts the spec, not a contract change.
    • The PR body names the observable change in its own section: a measure filter or having that counted rows with no value in an ordering comparison or $between stops counting them, on every driver.
    • The changeset on @objectstack/objectql says the same in user words.
    • The contract review at CONTRACT_REVIEW_TIER judges both halves.
  11. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment 3 to 6892526787 (same session, same branch claude/project-thread-4qnc25): three docblocks that this change makes false. TSDoc and comment edits only.

    File surface (added), comment text only:

    • packages/spec/src/contracts/data-driver.ts: the aggregate() TSDoc (~:229-232) says a per-measure aggregations[].filter forces the in-memory path and that a driver never sees it.
    • packages/objectql/src/in-memory-aggregation.ts: the header (~:46-50) says no driver advertises native conditional aggregation.
    • packages/drivers/driver-turso/src/remote-transport.ts: the refusePerAggregationFilter docblock (~:853-862) calls itself the twin of driver-sql's refusal, which now compiles.

    ⛔ No code, signature or exported-type change in these three files. If a gate regenerates an artefact from the data-driver.ts TSDoc, the regenerated output is inside the claim's "generated spec artefacts" line.

  12. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment 4 to 6892526787 and seat decision on the undeclared-column posture · 2026-11-15T11:21Z

    Same session, same branch claude/project-thread-4qnc25.

    File surface (added), test-only:

    • packages/rest/src/rest-aggregate-compensated-sum.test.ts (~:90). The test used a measure filter only to force the rows path. It now forces that path by reporting the bit off for the call. ⛔ No expected number changes.
    • packages/rest/src/aggregation-filter-where-doors.test.ts (~:496). The recorded posture is re-recorded as decided below.

    Decision (option A, a lane decision): on an audit-opt-out object, a measure filter names an undeclared column ({ created_at: { $ne: { $field: 'photo' } } }).

    • Its where twin is refused by driver-sql with 400 INVALID_FILTER.
    • The in-memory evaluator is fail-open and answered 200.
    • On a driver that declares the bit, the measure filter now answers its where twin's refusal, which every other row of that file's parity table already requires.
    • On a driver without the bit, the in-memory path is unchanged (applyInMemoryAggregation still answers 200).

    The test was recorded "so a change on either side is seen", and this is that change. It is read as a malformed filter now getting the refusal its where twin always gave, not as a narrowing of a declared accept set: a filter naming an undeclared column is not a declared shape. The claim lines stay as they are.

    The PR body lists it under the observable-change section, beside the walker's null correction. The contract review (review#1, per Leehom 2026-11-15T11:16Z) judges this reading as a named point. If the reviewer reads it as a Clause-② narrowing, the declarations are re-ruled then.

    Recorded from the dev, numbers to be confirmed in the PR body:

    • Bench aggregate_measure_filter p50 at 100k: SQLite 300→48 ms, PG 608→35 ms.
    • At 1M: SQLite 5378→431 ms, PG 6358→176 ms.
    • The tenant predicate is pinned outside the CASE (the tenant-chokepoint gate).
  13. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment 5 to 6892526787 (same session, same branch claude/project-thread-4qnc25): one more test-only file.

    File surface (added): packages/services/service-analytics/src/__tests__/objectql-echo-date-bucket.test.ts (~:265). This lifts the order's ⛔ on service-analytics/** for this one test file only. The cell asserted the mechanism ("the driver grouped nothing"), which this change is designed to alter. Its numbers and the echo/dry-run equality still hold. The fix asserts the pushed-down shape, or reports the bit off for that cell. ⛔ No service-analytics source change and no expected number changes.

    Note on amendments 3 to 5: the dev's session refuses edits granted mid-round by the seat. The dev has asked the maintainer to approve the test edits by name in its card thread. Nothing is pushed until those edits are made.

  14. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#4 · os-project-manager · session_01FEkQ5nSNBMzF8jj9quUkjf
    os-dev-report
    {
    "issue": 33698,
    "status": "done",
    "branch": "claude/project-thread-4qnc25",
    "pr": "#33854",
    "session": "session_01FEkQ5nSNBMzF8jj9quUkjf",
    "premise_still_valid": true,
    "summary": "DriverCapabilities gains the optional aggregationFilter bit; engine.aggregate sends a filtered measure to driver.aggregate only when the driver declares it; driver-sql declares it and compiles each filtered measure as fn(CASE WHEN (pred) THEN col END) with count(CASE WHEN (pred) THEN 1 END) and no ELSE, the predicate lifted from its own where compiler on tenant-scoped builders; driver-turso turns the bit off in remote mode. H3 option C: the in-memory walker now fails $gt/$gte/$lt/$lte/$between on a NULL column, in its own commit, pinned on three faces. Approved out-of-surface edits (maintainer, 2026-11-15): three tests re-recorded (no number changes; where-doors now records 400 INVALID_FILTER on driver-sql, 200 without the bit) and three comments brought up to date. Bench p50 before -> after: 100k SQLite 300.2 -> 48.3 ms, PG 608.2 -> 34.5 ms; 1M SQLite 5378.2 -> 431.1 ms, PG 6357.8 -> 175.8 ms.",
    "tests": "Final head 1e2fb85 (rebased on main 1e65a38): spec 28507 passed; objectql 13202 passed; driver-sql 4305 passed / 241 skipped, aggregation files on live PG 16 285 passed / 7 skipped; driver-turso 2539 passed / 34 skipped; rest 8748 passed / 355 skipped; service-analytics 5216 passed / 335 skipped (echo file on SQLite + PG 49 passed); driver-sqlite-wasm 766 passed before the rebase. Ablations, each restored: driver-sql bare operand 10 failed / 4 passed; ELSE 0 3 failed; engine gate !hasAggregationFilter 2 failed, bit ignored 3 failed; walker NULL exit off 28 failed / 25 passed.",
    "gates": "node scripts/pm/dispatch-gates.mjs --commands: 124 families, each run on 1e2fb85 with its exit code captured before any pipe, 124 exit 0; --ran: 124 derived, 124 run, 0 NOT-MEASURED, 0 UNRUN. List: /mnt/project-files/pm-orders/spec/33698-gates-ran.txt. CI check-runs not yet read (PR opened at this report).",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "10 — mcp__github__issue_read and mcp__github__pull_request_read only; no write tool",
    "api_writes": "3 — POST issues/33698/comments via post-stamped (H3 report 6892601944); POST /dispatches via fleet-write (pr_create, #33854); POST issues/33698/comments via post-stamped (this report). Plus one git push.",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "class: c · reach: named producer · evidence: packages/qa/dogfood/bench/sql-perf scenario aggregate_measure_filter note says a per-measure filter routes engine.aggregate in memory, now true only for drivers without the bit · dedupe words: bench note measure filter in-memory · carrier: PR #33854 body · noted, not filed",
    "class: c · reach: named producer · evidence: driver-memory and driver-mongodb refusal docblocks say the engine lowers filtered aggregations in memory for every driver; still true for those drivers, wording could name the bit · dedupe words: aggregationFilter docblock every driver · carrier: PR #33854 body · noted, not filed",
    "class: b · reach: public door + wrong answer · evidence: ICU-collation text ordering in a measure filter can pick other rows in SQL than in memory (H3 divergence 2); declared latitude in the bit's TSDoc and the changeset, not gated; MySQL not measured · dedupe words: measure filter collation ICU · carrier: PR #33854 body · noted, not filed"
    ]
    }


    Generated by Claude Code

  15. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment 6 to 6892526787: the round-2 plan for review record 6894395884 (FAIL) · 2026-11-15T12:35Z

    ⛔ Not a new claim. Same session, same branch claude/project-thread-4qnc25.

    The seat files both cards (the skills follow-up and N1) at 2026-11-15T12:35Z, through the relay. The dev re-hands the new head to the seat, and the seat asks review#1 for a delta review.

  16. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment 7 to 6892526787 (same session, same branch claude/project-thread-4qnc25): one docs row.

    File surface (added): content/docs/protocol/objectql/query-syntax.mdx, only the aggregations[].filter row (~:93) of the table "members that validate but are not executed". The row says the key is [EXPERIMENTAL — not enforced]. That was already false for the in-memory path (#10576), and this PR makes it false for SQL too. The row is replaced with one line: the key is enforced, in SQL by a driver that declares supports.aggregationFilter (driver-sql) and in memory otherwise. Alternatively it is removed if the table has no place for an enforced member. Nothing else on the page changes.

    The dev re-read the other six pages the docs-drift check names and found them still true: virtual-objects.mdx :487, query-syntax.mdx :506, :575 and :1076, queries.mdx :451, and data-engine.mdx :213-219 and :603.

  17. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Landed · #33698 · PR #33854 · 2026-11-15T15:28Z

    Reading Value
    Merge commit 0ac112fcd5dc429efa8e7edae840283863344294 (PR #33854 MERGED, 2026-11-15T15:27Z)
    Content on origin/main aggregationFilter in packages/spec/src/data/driver.zod.ts (DriverCapabilitiesSchema) and its reader in packages/objectql/src/engine-delete-and-aggregate.ts
    Contract review review#2 record 6896557459, PASS on the landed head aea48520 (earlier records: 6894395884 FAIL, 6895214298 PASS with S3 open)

    State:

    Nothing else remains on this card.

  18. removed
    pm:dispatched
    on Nov 15, 2026
  19. added a commit that references this issue on Nov 16, 2026
    0ac112f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:datadomain:specenhancementpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions