Skip to content

objectql: the engine's aggregate door answers a sum over a formula with "count the rows", not the VIRTUAL_FIELD_AGGREGATE_REMEDY of ruling B #34414

Closed
1 of 1 issue completed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

Filing gate: ② out-of-scope finding (class b, named producer) from the os-dev report on #32598 (comment 6918859900, cloud PR #4743). Reader: the domain:server lane (packages/objectql). Dedupe, open and closed: aggregate-field-type-door remedy (1 hit, #32598 itself) and VIRTUAL_FIELD_AGGREGATE_REMEDY (hits #32506, #32443, #32532, #32614, #24426, all closed, none about this door).

维护者速读

  1. 问题:对「公式」字段求和时,引擎直接拒绝,给的建议是「换一个能求和的字段,或者改成计数」。这和 [Decision] How should an app total a computed value (e.g. leave days = end − start + 1), when a formula field cannot be summed? #32443 的裁决 B 相反:正确做法是把它改成带同一表达式、按返回值类型存储的字段。
  2. 影响:通过 MCP 用 aggregate_records 的 AI(例如客户本地的 Claude Code)会按这句话把「销售额合计」改成「记录条数」。cloud 的问数工具已经在 cloud PR 哨兵拆掉之后:#4441 的 readonly 收窄与 #4551 的巡检跳过还需要吗?——注释已过期,跳过范围值得收窄 #4743 里先拦下并给出正确建议;其他入口仍会走到这里。
  3. 修法:引擎拒绝「对公式求和 / 平均 / 最大 / 最小」时,打印 spec 现成的那一句 VIRTUAL_FIELD_AGGREGATE_REMEDY,不再建议计数。
  4. 验收:一个对公式字段求和的查询被拒,拒绝消息里含 VIRTUAL_FIELD_AGGREGATE_REMEDY 原句。
  5. 范围:只改这一处拒绝消息,不改哪些组合被拒。
  6. 需要你做的:无。

What happens

Expected

When virtualFieldAggregateRemedy(fn, fieldType) holds for the first refused aggregation, the door's route is VIRTUAL_FIELD_AGGREGATE_REMEDY, not the count fallback. The route still comes first so it fits in the 500 characters the REST door keeps. Other refused pairs (text, select, JSON-stored) keep today's wording. One test: a sum over a formula is refused and the message contains the remedy sentence verbatim.

Related: #32443 (ruling B), #32598, cloud PR #4743, #32506.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    pm:queue
    domain:server
    on Nov 16, 2026
  2. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p3 (kept) · out of focus · 2026-11-16T14:48Z

    ⛔ Not a claim.

    A sum over a formula field is refused with "count the rows" instead of the VIRTUAL_FIELD_AGGREGATE_REMEDY text that ruling B prescribes. The refusal itself is correct; only its hint is wrong. This is an out-of-scope finding of the #32598 work: p3 as filed, kept under the p3 standard because an author reads the hint.

  3. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#1 · os-warren · session_01JQwxbabAdcWyApSTGBYJNY

    Ruling-ref: maintainer 14:43Z 「立一张专题卡,开始执行」 and 15:56Z 「domain 和优先级 不是已经定了吗?为什么现在不能改卡」 · regrade v3 under epic #35205

    Grade: p2 (was p3) · area:data · Bug · misleading × rare · the aggregate refusal for a sum over a formula suggests a count, which an AI follows

  4. added
    priority:p2
    and removed on Nov 18, 2026
  5. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb

    Claim: PM loop round 1 · area data-1 (lease:data-1; the maintainer, verbatim, 2026-11-19T04:35Z project chat: 「再开 area:data」; standing 「暂时都只派 p1 p2 的卡」) · 2026-11-19T04:44Z
    Session: session_01Utp6Ca1jJvsA1dHsPwMiQb
    Account: os-bill
    Branch: claude/issue-34414-formula-aggregate-remedy
    Worktree: objectstack-issue-34414 (os-dev worktree in the data-1 container)
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/objectql/src/aggregate-field-type-door.ts (routeAndReason, the sum / avg / min / max route), a new test file named for this card beside the door's tests, root .changeset/. ⛔ packages/spec/** (the remedy is imported as is). Stop on breach and report.
    Container & model: S, mode:subagent, model: default — no path-derived mandate, effort: high
    Clause-②: no (refusal wording only; which pairs are refused does not change)
    Metadata-protocol: none
    Responsibility: platform — packages/objectql/src/aggregate-field-type-door.ts routeAndReason prints "…or count the rows with count." for a refused sum / avg / min / max over a formula, where ruling B on #32443 (VIRTUAL_FIELD_AGGREGATE_REMEDY, virtualFieldAggregateRemedy) prescribes the stored-field remedy; every MCP / REST caller of the engine aggregate door.
    Thread-read: 6984392096
    Premise: holds — on origin/main de8d5497: aggregate-field-type-door.ts:220-221 builds the count fallback route for every refused non-count_distinct pair; packages/objectql/src has no reference to virtualFieldAggregateRemedy / VIRTUAL_FIELD_AGGREGATE_REMEDY.
    Serial constraints cleared: none — overlap-check.mjs on a probe branch touching the door: 0 open PR heads share the file, base merges cleanly.
    Pre-claim lane: domain:server (packages/objectql/**)
    Pre-claim deps: none named; #32598 / cloud PR #4743 landed.
    Prior rulings read: ruling B on #32443 (the remedy sentence; governs this card); check-prior-rulings 221 hits — ADR-0061 D2, ADR-0148 D1, ADR-0139 D2/D3, ADR-0144 D6, ADR-0155 D1, ADR-0071 §1, ADR-0076 D4–D8 (term noise, none on point); thread: none
    Lease: lease:data-1

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  7. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb
    os-dev-report

    {
      "issue": 34414,
      "status": "done",
      "branch": "claude/issue-34414-formula-aggregate-remedy",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35338",
      "head": "9838a438",
      "session": "session_01Utp6Ca1jJvsA1dHsPwMiQb",
      "premise_still_valid": true,
      "summary": "routeAndReason in packages/objectql/src/aggregate-field-type-door.ts now asks virtualFieldAggregateRemedy(first.fn, first.type) (from @objectstack/spec/data) before it builds the count-fallback route. A refused sum/avg/min/max over a formula now has VIRTUAL_FIELD_AGGREGATE_REMEDY verbatim as its route, straight after 'The query was NOT run.' (353 chars in total on the probe; the REST 400 body carries it inside its 500-char cut). The generic table reason is dropped for this pair because the remedy carries its own reason. Every other refused pair (text, select, JSON-stored, count_distinct) keeps today's wording, and which pairs are refused does not change. The draft PR is open (assignee os-bill; card assignee not touched).",
      "A1": "holds — at de8d5497, aggregate-field-type-door.ts:220-221 built 'FN accepts a field of type ...: aggregate a field of one of those types, or count the rows with count.' for every refused pair that is not count_distinct, the formula included. The objectql test file pinned that wording for sum over the formula ('expected' in the sum case list, :196), and so did packages/rest/src/data-aggregate-field-type-door.test.ts (:239).",
      "A2": "holds — packages/spec/src/data/aggregate-field-type-compatibility.ts:296 VIRTUAL_FIELD_AGGREGATE_REMEDY and :309 virtualFieldAggregateRemedy, re-exported by data/index.ts:368 (export *). packages/objectql/package.json:46 already has @objectstack/spec workspace:* in dependencies, and this file already imported from @objectstack/spec/data. No new dependency.",
      "A3": "holds — RefusedAggregation carries readonly type: string (aggregate-field-type-door.ts:135), the declared FieldType. SEARCH_VIRTUAL_TYPES = {formula} (spec search-fields.ts:115), and formula is not multi-capable, so no multiValue guard is needed.",
      "tests": "At head 9838a438. (1) 'pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-aggregate-field-type-door.test.ts' gave 'Test Files 1 passed (1) · Tests 11 passed (11)'. (2) 'pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/data-aggregate-field-type-door.test.ts' gave 'Tests 4 passed | 8 skipped (12)'; the sqlite cell ran the formula remedy row, and the pg/mysql cells skip without URLs, as on main. (3) The full objectql local suite gave 'Test Files 614 passed (614) · Tests 13878 passed (13878)'. (4) 'pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/rest typecheck' gave check:test-typecheck OK for both. All four ran under os-verify-lock with 'VERDICT command-exit 0'. Ablation, on the committed head via scripts/ablation-replace.mjs, deleted 'if (remedy !== undefined) return remedy;': anchor 1->0, blob 239bae77d4e0->9da8fc2ef51f. Result 'Tests 1 failed | 10 passed (11)': the new pin received the old '...or count the rows with count. The aggregate x field-type table accepts only...' message. Restored: blob == HEAD 239bae77d4e0 and git diff HEAD is empty. The objectql suite imports the door from src by a relative path, so no build is involved. The rest leg resolves objectql through dist, which was rebuilt with the fix before it ran (dist/index.mjs carries virtualFieldAggregateRemedy).",
      "gates": "Local: dispatch-gates --commands (66 families at 9838a438, --repo objectstack-ai/objectstack). 64 exit 0. Two exit 3, NOT MEASURED. (a) 'node scripts/check-plugin-teardown-shape.mjs --self-test' :: exit 3: its positive control is pinned at commit 621a4876, which the shallow clone cannot reach; it was not deepened because .git is shared with a sibling worktree. (b) 'pnpm check:dual-build-cjs-loads' :: exit 3: the self-test passed, but the scan has PREREQUISITE NOT MET (49 packages have no dist; only the rest^... closure was built). The --ran reconciliation with exit codes recorded gave '66 derived famil(ies) accounted for — 64 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)'. 'node scripts/check-platform-checklist.mjs --changed-from origin/main' answered 0 anchored files, nothing judged. The control-byte grep over the 4 changed files: no hits. overlap-check --branch=HEAD before each push: 'VERDICT clean exit 0' (0 PR heads, merges cleanly). PR check-runs at report time, head 9838a43853: everything in_progress (Check Changeset, Lint x8, Type Check x4, Governed Surface Queue Guard, PR-body guards, Check PR Size); the opt-in and queue checks were skipped. No verdict is waited for, per os-dev.md.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "line_budget": "n/a — no skills/** or ratcheted ledger touched; diff +76 / -13 over 4 files",
      "files_changed": [
        ".changeset/34414-formula-aggregate-remedy.md (+12)",
        "packages/objectql/src/aggregate-field-type-door.ts (+9)",
        "packages/objectql/src/engine-aggregate-field-type-door.test.ts (+43 -2)",
        "packages/rest/src/data-aggregate-field-type-door.test.ts (+12 -11)"
      ],
      "deviations": [
        "File surface: the fence named a new test file. Instead, two existing pin files were edited: packages/objectql/src/engine-aggregate-field-type-door.test.ts and packages/rest/src/data-aggregate-field-type-door.test.ts. Both pinned the count wording for the formula row, so they go red under the ruled change whatever is done; no in-fence version of this card exists. The new pins went into the objectql harness file as a top-level describe, as AGENTS.md requires (a new pin for a component with a shared harness file goes into that file, ruling record 6583487846). That rule outranks the dispatch's 'new test file'. overlap-check was clean before each push. The work did not stop for this breach. I judged that the claim's surface missed a forced consequence rather than a collision risk. The seat may want to amend the claim's file surface.",
        "Remedy route only: the generic table-reason sentence was dropped for the formula pair, because the remedy sentence carries its own reason. The suggested route allowed this (keep the reason only if it fits). With the reason kept, the message would still fit at about 465 chars, but the reason would duplicate the remedy.",
        "Environment: the first 'pnpm install --frozen-lockfile' exited 1 because the better-sqlite3 node-gyp build hit 'Permission denied' on gyp_main.py in pnpm's tmp tool dir. An immediate retry exited 0, and the sqlite cell of the rest test ran.",
        "Not run locally: the full @objectstack/rest suite (only the edited test file ran) and test:repo for both packages. They are declared to CI Test Core.",
        "Commit trailers use the model-free pair (Claude-Session + 'Co-authored-by: Claude'), as AGENTS.md requires, over the harness reminder's model-named trailer."
      ],
      "mcp_calls": "0 — no MCP GitHub calls",
      "api_writes": "2 — relay (fleet-write dispatch): pr_create, which created #35338 (draft, assignees [os-bill]); post-stamped comment on #34414 (this os-dev-report). git push x3 (empty branch, WIP, changeset) is not a REST write.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted in the PR's Acceptance notes, not filed (read-only inference, no public-door measurement): packages/services/service-analytics/src/cube-measure-field-type-door.ts ~:205-209 builds the same '...or count the rows with count.' route for a refused cube measure and does not ask virtualFieldAggregateRemedy. Whether a cube measure can name a formula column was not measured. Dedupe words: cube-measure-field-type-door remedy, VIRTUAL_FIELD_AGGREGATE_REMEDY cube, count the rows formula measure",
        "carrier: none · noted, not filed (spec prose, fenced): the TSDoc of VIRTUAL_FIELD_AGGREGATE_REMEDY (packages/spec/src/data/aggregate-field-type-compatibility.ts ~:288-293) lists only the dataset compile and lint legs as readers. The engine aggregate door is now a third reader."
      ]
    }
  8. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb

    Claim: amended by the area after the dev's measurement (os-dev-report 7000701790, deviation 1) · 2026-11-19T05:32Z
    Session: session_01Utp6Ca1jJvsA1dHsPwMiQb
    Account: os-bill
    Branch: claude/issue-34414-formula-aggregate-remedy
    File surface: as claimed, plus the two existing pin files that pinned the old count wording for the formula row and go red under the card's change whatever is done: packages/objectql/src/engine-aggregate-field-type-door.test.ts (the new pins sit there as a top-level describe, per AGENTS.md's shared-harness rule, instead of a new file) and packages/rest/src/data-aggregate-field-type-door.test.ts. No other path. PR: #35338.
    Clause-②: no
    Metadata-protocol: none

  9. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb

    Close-out 2026-11-19T06:29Z: PR #35338 MERGED as e6e52241c; Fixes closed this card. Delivered: the engine aggregate door's refusal of a sum / avg / min / max over a formula now routes with VIRTUAL_FIELD_AGGREGATE_REMEDY verbatim (ruling B on #32443), inside the 500 characters the REST door keeps; every other refused pair keeps its wording and which pairs are refused is unchanged (pins + ablation; L1-a ACCEPT 7001168986). Follow-up owed by the ACCEPT, filed and nested here: #35353 (service-analytics cube-measure door builds the same count route; reachability past the dataset-compile refusal unmeasured). pm:dispatched off.

  10. removed
    pm:dispatched
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions