Skip to content

feat(mcp): aggregate_records returns select groups in declared option order and names a fixed amount's currency - #35186

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35138-aggregate-order-currency
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35138-aggregate-order-currency

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Refs #35138 (items select order, currency)
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:MCP 的 aggregate_records 工具在调用方未指定排序时,按 select/radio 字段声明的选项顺序返回分组(未声明的值排最后),排序发生在 50 行截断之前;对 sum/avg/min/max 这类金额列,若字段是固定币种(currencyConfig.currencyMode: 'fixed'),结果多出 currencies 成员,按列别名给出 ISO 4217 币种代码。HTTP 和 stdio 两个入口走同一个处理函数。
  • 为什么改:mcp: the result members the hosted ask tools add over the framework tools are either moved into the framework or stated as hosted-only, one by one #35138 第二个 PR(W0 决定表的「select 选项顺序」「金额币种」两行):托管问数工具发现模型照搬工具返回的东西,分组顺序乱、金额不带币种时答案会错;这两项从托管层挪进框架,开源 MCP 客户端也能拿到。
  • 风险与回滚:只读调用方能看到的对象定义(servedObjectDefinitionOf),看不到的字段不排序也不报币种;读不到定义时返回与之前完全相同。已有成员 rows/totalGroups/truncated 不变,currencies 只在有固定币种金额时出现。回滚即 revert 本 PR。
  • 先看:① packages/mcp/src/mcp-http-tools.ts 的 inDeclaredOptionOrder:多个分组键时只按前导的 select 键排序,遇到第一个非 select 键即停;② 同文件 aggregate_records 处理函数里排序在截断之前;③ fixedAmountCurrencies 只认 fixed 模式。
  • 两分钟验证:pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-http-tools.aggregation-entry.test.ts,预期 19 个测试全绿,其中 10 个是本 PR 新增的 mcp: the result members the hosted ask tools add over the framework tools are either moved into the framework or stated as hosted-only, one by one #35138 用例。
  • 需要你做的:无,席位落地。

What changes

aggregate_records (packages/mcp/src/mcp-http-tools.ts, one handler serving both the HTTP and the stdio door) now reads two facts off the object as the caller is served it, through the existing optional bridge member servedObjectDefinitionOf (both bridges implement it, each answering the caller-masked definition):

  • Select option order. When the call sends no ordering, groups keyed by a select or radio field come back in the order the field declares its options. A value no option declares, such as a null, sorts last. The group keys are read in groupBy order while each is such a field: the first key that is not one ends the reading, and the groups under it keep the driver's order. The sort is stable and runs over every group before the tool's cap, so the cap keeps the first declared groups. A group key's alias is honoured. multiselect is not ordered, because its group value is a combination.
  • Currency. A new present-only result member currencies maps an amount column's alias to its ISO 4217 code, when the column is sum/avg/min/max over a field whose currencyConfig is currencyMode: 'fixed'. count and count_distinct carry none.
  • The tool description gains two sentences saying both, plus that a record-currency amount is answered only grouped by its currency code field.

The bridge read is skipped when the call has no group key and no amount column. If the bridge does not have the member, finds no object or throws, the tool answers exactly as before, and the aggregate itself is never failed by it. A field the caller's served schema does not show is never ordered or named.

currencies is typed locally in packages/mcp. The aggregate_records result has no type in packages/spec: git grep aggregate_records -- packages/spec/src finds two comments in data/query.zod.ts about the input entry, and no result schema. No guidance text enters the spec (ADR-0149 M1).

Record mode, re-measured and unchanged: the engine already refuses sum/avg/min/max over a record-mode amount unless it is grouped by the amount's code field (packages/objectql/src/record-currency-aggregate-door.ts, ADR-0144 D6), so each group's code is in its row. packages/objectql/src/record-currency-guards.test.ts -t "raw aggregate over a record-mode amount" on this branch reads Tests 4 passed | 70 skipped (74): ungrouped is refused INVALID_FIELD, grouped by another field is refused, and grouped by the code it answers { USD: 100, EUR: 100 }.

Tests

New pins: top-level describe in packages/mcp/src/mcp-http-tools.aggregation-entry.test.ts (the shared aggregate_records harness)
  • groups of a select field come back in the declared option order, with a value no option declares last
  • order read by the group key's alias, and a second select key orders within the first
  • order taken before the cap: 60 groups in reverse order come back as o00..o49, truncated: true, totalGroups: 60
  • CONTROL: a non-select leading key keeps the driver's order, and so do the keys after it
  • CONTROL: a select field the served schema does not show is not ordered
  • a fixed-currency sum and avg name { total: 'USD', mean: 'USD' }
  • CONTROL: count, count_distinct over the fixed amount, a non-currency number measure, and a record-mode and a dynamic-mode amount carry no currencies
  • CONTROL: a fixed-currency field the served schema does not show names no currency
  • CONTROL: a bridge without the member, or one that throws, answers byte-for-byte as before
  • a call with no group key and no amount column does not read the served schema
Ablations (one per pin, through scripts/ablation-replace.mjs; each restored to the HEAD blob)

Each mutation landed (anchor count 1 then 0) and the test file went red. Every restore was confirmed by blob 0ed787fe6949 against HEAD:

  • A: const groups = rows; in place of the option-order call. Red: 3 failed, 16 passed (the three order pins).
  • B: the currency assignment replaced by void defaultCurrency;. Red: 1 failed (the fixed-currency pin).
  • C: the amount-function gate deleted. Red: 1 failed (the CONTROL for count, non-currency, record and dynamic).
  • D: if (!rank) break; changed to continue. Red: 1 failed (the CONTROL for a non-select leading key).

Acceptance notes

  • Explicit order overrides option order (CONTROL): NOT MEASURED, reason: origin/main has no ordering argument on aggregate_records. Without one, strictToolInput refuses an orderBy key as unknown. mcp: aggregate_records can order and cut its groups and says how many groups there were #35144 adds orderBy/limit on its branch (claude/issue-35144-aggregate-order-cut, no PR yet). That path returns before the default path, so option order never reaches an explicit order. The control pin is owed when the second of the two PRs merges main. git merge-tree of this head with that branch conflicts in one place, the rows: line of the default path's result; the resolution keeps groups and adds groupCount. On that branch, a call with limit but no orderBy takes the database path with an empty order, so option order does not apply there.
  • currencies is added on the default path only. mcp: aggregate_records can order and cut its groups and says how many groups there were #35144's order-and-cut path builds its own result, so whoever merges second should add currencies there as well.
  • dynamic mode carries no currency. The served schema does not hold the tenant's localization.currency, so this PR does not invent a value.
  • The option sort runs in the application over the list the driver already returned in full (the existing default path loads every group, then caps). It runs no second query, so this is not a slower path built only for parity (Prime Directive 5).

Verification

All readings below are at head 4582c20e07, the final commit.

Local subset
  • pnpm --filter @objectstack/mcp typecheck, then vitest run --maxWorkers=2 over the whole package, run under the shared verify lock. Lock line: VERDICT command-exit 0. Result: Test Files 71 passed (71), Tests 1280 passed (1280). The typecheck ran tsc --noEmit and check:test-typecheck.
  • src/mcp-http-tools.aggregation-entry.test.ts: Tests 19 passed (19).
  • Re-measured the record-mode door: packages/objectql/src/record-currency-guards.test.ts -t "raw aggregate over a record-mode amount" gives Tests 4 passed | 70 skipped (74).
  • dispatch-gates --commands: 68 derived families, run with each exit code captured before any pipe. --ran reconciliation: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.
  • NOT MEASURED: check:dual-build-cjs-loads, exit 3, PREREQUISITE NOT MET (it reads every package's dist, and only the mcp closure was built). CI runs it.
  • node scripts/check-nul-bytes.mjs: OK.
  • overlap-check.mjs: VERDICT clean exit 0, against origin/main 7d8dcf693a and 0 open PR heads.

The families CI runs (Lint & Repo Gates, Test Core, Build Core, the type-check lanes) are left to this PR's check-runs.


Generated by Claude Code

… and names a fixed amount's currency (wip)

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/mcp, touching 10 documentable anchor(s).

17 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3.

⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 062e521fc96c9983e8ecedeea27284420c527bfe — the merge of head 4582c20e076360cfe76027bb27a266063e2a61da into base 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 062e521fc96c9983e8ecedeea27284420c527bfe && git checkout 062e521fc96c9983e8ecedeea27284420c527bfe
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 4582c20e076360cfe76027bb27a266063e2a61da && git checkout -B drift-repro 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 && git merge --no-ff 4582c20e076360cfe76027bb27a266063e2a61da

node scripts/docs-audit/affected-docs.mjs --json 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Contract review brief handed to the isolated reviewer (TIER_DEFAULT, declaration face), posted beside its record:

Contract review brief — PR #35186 @ 4582c20e076360cfe76027bb27a266063e2a61da (card #35138, PR 2)

You review at TIER_DEFAULT. Render ONE ## Contract review record on this head (shape: node scripts/pm/record-recognisers.mjs --template --face declaration) with a PASS or FAIL verdict.

  • Face: the Clause-②: yes (widening) declaration (claim 6975089907, amendment 6975318215). Confirm from the committed file list that no packages/spec/src/** or governed path is touched; if one is, stop and say so.
  • Read: card mcp: the result members the hosted ask tools add over the framework tools are either moved into the framework or stated as hosted-only, one by one #35138 and its comments (W0 decisions in 6975318215, os-dev report 6976835443, area note 6976885282), the PR body, the full diff against its merge-base, the changeset, and the head's check-runs. Code outside the diff is read at origin/main only.
  • ① Judge aggregate_records after the diff on both doors: the default group order for select/radio keys (declared option order, before the cap), the new present-only currencies member (fixed mode only; record and dynamic modes unchanged), that everything is read from the caller's served definition and names nothing the caller cannot see, the tool description text, what the built entry of @objectstack/mcp reaches; anything removed, renamed or narrowed (totalGroups must be untouched); the SQL push-down check (the sort happens in-app before the cut: judge whether that is reasoned).
  • ② Changeset level and the line-initial Clause-② / Metadata-protocol lines in PR body and changeset; changeset prose against the diff.
  • ③ Every dev deviation, NOT-MEASURED gate, open question (answered A/A in 6976885282) and out-of-scope note answered or escalated.
  • Implemented-by: claude/issue-35138-aggregate-order-currency · Reviewed-by: session_01JQwxbYRqkDAGuse5Wqbohi.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 4582c20e076360cfe76027bb27a266063e2a61da
Local-runs: none

Inputs: brief 6976909080; card #35138 (body and all 10 comments, among them the claim 6975089907, the W0 decisions in amendment 6975318215, os-dev report 6976835443 and area note 6976885282); card #35144 (claim 6974958437 and every comment after it); PR #35186 (body and comments); the full diff against merge-base 7d8dcf693a (3 files, +330/−3, 2 commits); the changeset; and the check-runs on this head. Code outside the diff was read at origin/main only. origin/main has no commit touching packages/mcp since the merge-base.

Face: the committed file list is .changeset/35138-aggregate-option-order-currency.md, packages/mcp/src/mcp-http-tools.ts and packages/mcp/src/mcp-http-tools.aggregation-entry.test.ts. No packages/spec/src/** path and no governed path is touched. record-recognisers.mjs --paths decides no face from the two code paths, and Governed Surface Queue Guard succeeded on this head. So this is the declaration face at TIER_DEFAULT, owed by the Clause-②: yes (widening) line, with no ④.

① Derived judgments

  • CI on this head is still running. 52 check-runs: 29 success, 16 skipped, 7 in progress, 0 failure. Still running: Test Core shards 1 to 7 of 10. Complete and green: Build Core, Check Changeset, Governed Surface Queue Guard, PR-body guards, every Type Check · lane, every Lint · lane (among them Lint · repo & tooling gates, which carries the dev's NOT-MEASURED check:dual-build-cjs-loads), Test Core shards 8 to 10, Test UI, Live E2E UI and Dogfood Regression Gate. I judge on what is complete. The seat must see the 7 running shards finish green on this head before landing.
  • One handler, both doors: right. aggregate_records is registered once, in registerObjectTools, which both the HTTP door and the stdio door call. Both bridges already implement servedObjectDefinitionOf at origin/main (stdio-data-bridge.ts:1338, runtime/src/domains/mcp.ts:1179), and each answers the object as that caller is served it, the same read describe_object projects.
  • Default group order: right. inDeclaredOptionOrder reads the groupBy keys in order while each is a select or radio field the served definition declares options for. A date-bucketed key, a field the served definition does not show, or any other type ends the reading, and the groups under it keep the driver's order. A key's alias names the row column it reads. A value no option declares ranks after every declared one. Array.prototype.sort is stable, so groups the declared order does not tell apart keep the driver's order. The sort runs on a copy of the whole list, before the cap: truncated and the slice are now taken from the sorted list, and totalGroups is still rows.length, unchanged. The pins cover declared order with the null last, the alias and a second select key, the cap keeping o00 to o49 of 60 groups, the non-select leading key, and the field the served schema does not show. Grouping by a multi-value field is refused by the engine before any driver is asked (group-by-structured-json-door.ts, [finding] two more JSON-stored columns as a group or distinct key answer 500 on PostgreSQL: groupBy on a multiple: true select, and count_distinct on a json field #20808), so no multi-value key reaches this sort.
  • currencies: right. The member is present only when at least one column has a currency. fixedAmountCurrencies names a column only when its function is sum, avg, min or max (the set the engine's record-currency door judges) and its field, read from the served definition, has currencyConfig.currencyMode fixed with a non-empty defaultCurrency. count, count_distinct, a non-currency field, a record-mode amount and a dynamic-mode amount add nothing, and a field with no currencyConfig is dynamic by the spec's default. Record mode is unchanged: the engine still refuses those four functions over a record-mode amount unless it is grouped by that amount's code field (ADR-0144 D6, record-currency-aggregate-door.ts at origin/main). Dynamic mode is unchanged and names nothing. The fixed-currency pin and the four CONTROLs cover this.
  • Read only from the caller's served definition: right, at rule level. Both facts come only from the definition the caller is served. A field that view does not show is neither ordered nor named, and a CONTROL pins each half. Only option values the rows already carry decide the order, and the only new text in the answer is an ISO 4217 code keyed by the caller's own alias. If the bridge has no member, finds no object, answers a non-object or throws, the tool answers exactly as before, and the CONTROL checks byte equality for both a bare and a throwing bridge. The read is skipped when the call has no group key and no amount column, and a pin counts zero reads there.
  • Tool description: right, with N1. Three sentences are added. The record-mode sentence is true at the engine door. The select-order sentence is stated more broadly than the rule (N1).
  • Built entry of @objectstack/mcp: nothing removed, renamed or narrowed. The exports map has only .. The list of export lines in mcp-http-tools.ts is identical before and after. The four new functions and the two new sets are module-private. McpDataBridge.servedObjectDefinitionOf changes only its jsdoc, so the .d.ts changes doc text only. The aggregate answer is untyped JSON text, with no output schema and no spec type (the two aggregate_records mentions in packages/spec/src/data/query.zod.ts are about the input node). Before this PR, the order of the groups in an answer to a call that sent no order was whatever the driver returned. No input that was accepted is now refused, and no member that was present is now absent.
  • SQL push-down: no finding, and the in-app sort is reasoned. The diff adds no data query, no id materialisation and no in-app join. The default path already loaded every group and capped in the application before this PR (totalGroups needs the whole list). The sort reorders that same in-memory list before the existing cap, and the only new read is one metadata read per call. The PR's Acceptance notes give this reason. For the database order-and-cut path that mcp: aggregate_records can order and cut its groups and says how many groups there were #35144 adds, the area's answer to Q2 (A, 6976885282) pushes the declared order into the driver statement. That keeps the SQL-first rule where SQL does the cut.

Findings:

② Semver level

  • Changeset .changeset/35138-aggregate-option-order-currency.md: right. It bumps @objectstack/mcp at patch. That is the only published package the diff changes, and the test file is not published. AGENTS.md Post-Task Checklist item 3 says that Metadata-protocol: none takes patch, and that a widening outside the protocol also ships as patch. CI Check Changeset succeeded on this head.
  • Clause-②: yes (widening): right. It starts its line in both the PR body and the changeset, and the arm is one of the two allowed values. A new answer member that is present only when it has a value, and a defined order where none was promised, are widenings. Claim 6975089907 and amendment 6975318215 declared Clause-②: yes for PR 2 from the start.
  • Metadata-protocol: none: right. No spec key, accepted value or metadata type is added. The PR reads the existing options and currencyConfig keys with their declared meaning, and currencies is a local answer member of an untyped tool result (ADR-0149 M1 is respected: no guidance text enters the spec).
  • Changeset prose against the diff: right.
    • "on both the HTTP and the stdio door": one handler, two bridges (①).
    • "A value no option declares, such as a null, sorts last": the rank falls back to rank.size.
    • "applied to the leading select keys. From the first key that is not a select field onward, the driver's order stays": matches inDeclaredOptionOrder and its CONTROL.
    • "sorted before the tool's row cap": truncated and the slice read the sorted list.
    • "count, count_distinct, non-currency fields and dynamic-mode amounts carry none. A record-mode amount is still answered only when it is grouped by its currency code field": true (①).
    • "A field the caller's served schema does not show is never ordered by its options or named. A host whose bridge cannot serve the definition answers exactly as before": true, and pinned.
    • "Existing members (rows, totalGroups, truncated) are unchanged": true for their names and meaning. The order inside rows is the stated change.

③ Boundary flags

  • Open question 1 (dynamic-mode amounts): answered A in 6976885282. No currency is named, the served schema does not carry the tenant's currency, and B goes to its own card only if the daily ask round shows a need. The code matches A.
  • Open question 2 (after mcp: aggregate_records can order and cut its groups and says how many groups there were #35144, a limit without orderBy cuts in driver order): answered A in 6976885282 and owned by mcp: aggregate_records can order and cut its groups and says how many groups there were #35144. It is not yet written on mcp: aggregate_records can order and cut its groups and says how many groups there were #35144: S1.
  • NOT-MEASURED gate check:dual-build-cjs-loads (exit 3, needs every package's dist): answered. CI Lint · repo & tooling gates carries it, and it succeeded on this head.
  • NOT-MEASURED explicit-order CONTROL pin: answered. origin/main has no ordering argument on aggregate_records, and strictToolInput refuses an orderBy key, so the case cannot arise on this head. The pin is owed by whichever PR merges main second: S1.
  • Out-of-scope note (carrier mcp: aggregate_records can order and cut its groups and says how many groups there were #35144: the CONTROL pin, currencies on the order-and-cut result, the one-line rows: conflict): escalated in name, but not written where the carrier reads it: S1.
  • Deviation, shared scratchpad overwritten by the PR 1 dev and all 68 gates re-run in a separate directory: process only. Only the re-run's readings are cited. Accepted.
  • Deviation, overlap-check first run after the WIP pushes: process only. It was clean again before PR creation, and origin/main has not moved under packages/mcp since. Accepted.
  • Deviation, commit trailers use the model-free pair: process only.
  • Ablations A to D each turned the pin file red and were restored to the HEAD blob 0ed787fe69, the blob this head carries for mcp-http-tools.ts. Two branches of the rule have no ablation: the date-bucket stop and the min/max members of the amount set. Each is a one-token rule that the jsdoc states. No finding.
  • Docs: content/docs/ai/natural-language-queries.mdx and connect-mcp.mdx name aggregate_records but do not list its result members, so no page becomes untrue. No page is owed.
  • Process notes: the PR is a draft. Author: objectstack-fleet[bot] (relay), assignee os-warren, so no extra author note is owed. S1 is closed by a comment on mcp: aggregate_records can order and cut its groups and says how many groups there were #35144, with no new head. The seat must still see the running Test Core shards finish green before landing (①).

Implemented-by: claude/issue-35138-aggregate-order-currency
Reviewed-by: session_01JQwxbYRqkDAGuse5Wqbohi

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Contract review delta on head 4582c20e076360cfe76027bb27a266063e2a61da (same head as record 6977026565):

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Final head for L1 · 2026-11-18T11:33Z

Head-sha: 4582c20e07 · all check-runs success or skipped (37 success, 16 skipped, 0 red; all ten Test Core shards green) · NOT governed, +330 / −3. Delivers #35138 PR 2 (select groups in declared option order; a fixed amount names its currency), so the PR says Refs #35138, not Fixes.
Owed: L1 (first read; area o1-B requests it from L1-a). Clause-②: yes (widening), Metadata-protocol: none: the TIER_DEFAULT contract record 6977026565 at this head is PASS (declaration face), with S1 closed by delta 6977058863 (the Q2-A carrier is recorded on #35144 in 6977042103); nits N1/N2 stay nits. Inputs: claim 6975089907, amendments 6975318215 and 6976973578, dev report 6976835443, area read 6976885282.
Landing order: #35185 (PR 1) lands first; whichever of #35185 / #35186 lands second merges main if K or the tree asks.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 review (#35138, PR 2) · 2026-11-18T11:37Z

L1: ACCEPT
Head-sha: 4582c20
Read: the full diff at this head against merge base 7d8dcf6 (3 files, +330/−3), with claim 6975089907, amendment 1 6975318215 (W0 decisions and PR 2's surface), amendment 2 6976973578, os-dev report 6976835443, the final-head note 6977360328, contract record 6977026565 and its delta 6977058863.

Fixes vs Part of. This is PR 2 of the W0 plan, so it does not close the card. The body says Refs #35138, and no closing keyword appears in the body or the changeset, so a merge does not close #35138. See N1 for the form.

Claim file surface. Amendment 1 gives PR 2 packages/mcp/src/mcp-http-tools.ts (the aggregate_records handler), its tests and one changeset. The three paths are exactly that. The non-handler hunks in mcp-http-tools.ts are a docblock line on McpDataBridge.servedObjectDefinitionOf and module-private helpers the handler calls.

Each changeset sentence against the diff. The changeset is new, and main has no .changeset/*35138*. It bumps @objectstack/mcp at patch.

  • "On both the HTTP and the stdio door": the handler lives in the shared registerObjectTools. Both bridges implement servedObjectDefinitionOf from the caller's served view: runtime/src/domains/mcp.ts:1179 (readObjectForCaller) and stdio-data-bridge.ts:1338 (servedView.getObject).
  • "select or radio … in declared option order, an undeclared value last": OPTION_ORDERED_GROUP_TYPES is select and radio, and an absent value ranks rank.size. Both are real spec types (field.zod.ts:77).
  • "Applied to the leading select keys; from the first non-select key the driver's order stays": the key loop breaks on the first key that has no rank and on a date-bucketed key. The sort is stable and compares keys in order.
  • "Sorted before the cap": truncated and the slice now read groups, and totalGroups stays rows.length.
  • "currencies … alias to ISO 4217 code, present only when a column has one": fixedAmountCurrencies reads only sum, avg, min and max over currencyMode: 'fixed' with a non-empty defaultCurrency. The spread happens only when the map is non-empty.
  • "record-mode is still answered only grouped by its currency code field": that is the engine's door (record-currency-aggregate-door.ts, ADR-0144 D6), which is unchanged here. The report re-measured it.
  • "A field the served schema does not show is never ordered or named; a host that cannot serve the definition answers exactly as before": servedFieldOf reads only own keys of the served map, and servedFieldsOf returns undefined on a missing member, no object or a throw. Pins cover each case.
  • "Existing members unchanged": rows, totalGroups and truncated keep their spelling and meaning.

Tests. There are ten new cases in mcp-http-tools.aggregation-entry.test.ts.

  • They cover order, the alias plus second key, order before cap (60 groups, 50 kept, o00…o49), and the currencies by alias.
  • CONTROL cases cover a non-select leading key, a hidden select, the count, non-currency, record-mode and dynamic-mode columns, a hidden fixed field, a bridge that lacks or throws, and a call with nothing to read (0 schema reads).
  • Ablations A to D each turned the file red and were restored to the HEAD blob (report). The contract record names the two branches without an ablation: the date-bucket stop and min/max. I agree they are one-token rules, and I add no ask.

Clause-②: yes (widening). TIER_DEFAULT record 6977026565 is PASS on this same head, and delta 6977058863 closes S1 through 6977042103 on #35144. N1 and N2 of that record stay nits.

Governance. check-governed-merges.mjs --pr 35186: NOT governed, 0 of 3 paths on the register, 333 changed lines. This is not Tier H.

CI at this head, from check-runs: 37 success and 16 skipped, with none failed or in progress (all ten Test Core shards included). The PR is mergeable clean.

Must-fix

None.

Should-fix

None.

Notes

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Landing · 2026-11-18T12:05Z

Probe Reading
check-governed-merges.mjs --pr 35186 NOT governed · +330 / −3, 0 of 3 paths on the register, Clause-②: yes (widening) (claim 6975089907, amendments 6975318215 and 6976973578)
Contract review (条款②) TIER_DEFAULT record 6977026565 at 4582c20e07: PASS (declaration face); S1 closed by delta 6977058863 through 6977042103 on #35144; nits N1, N2 only
Head / review 4582c20e07 · L1-a ACCEPT 6977440192 at this head (first L1; no must-fix, no should-fix), the review of record · all check-runs success or skipped (37 success, 16 skipped, 0 red)
Freshness K = 6 after #35185 merged (c787255a49), merges cleanly into origin/main; no main merge taken, so the L1 head stands. overlap-check.mjs: origin/main and #35179 clean; #35193 (#35144's carrier, area o1-C) conflicts in mcp-http-tools.ts and its aggregation test, as planned: under the Q2-A rule in 6977042103, the second to merge main wires the push-down order, keeps groups, adds groupCount, keeps the explicit-order CONTROL pin and carries currencies

Open findings: record nits N1, N2; L1 notes N1 (Refs in place of Part of, same no-close effect), N2 (bridge comments still hold, read only).

State: ready + auto-merge armed by area o1-B (lease o1-B, claim 6975089907). This is #35138 PR 2 and says Refs #35138, so the card stays open with pm:dispatched until its last row lands. #35185 (PR 1) merged first, as ordered.

Dev-effort: medium · Rounds: 1

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 18, 2026 12:05
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit ba6556c Nov 18, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35138-aggregate-order-currency branch November 18, 2026 12:28
os-warren pushed a commit that referenced this pull request Nov 18, 2026
…ate order and cut

Resolves the two conflicts in packages/mcp (mcp-http-tools.ts and the
aggregation-entry test) and carries the agreed items as the second PR to
merge main:

- A limit with no orderBy hands the database the declared option order of
  the leading select/radio group keys, each as an order key's rank, derived
  by the uncut path's own declaredOptionRank (the leading-key reading is
  now one helper, declaredOptionOrderKeys, used by both paths).
- The cut result carries currencies (fixedAmountCurrencies) like the uncut
  one, and keeps groups on the uncut path.
- Seat ruling: the result keeps totalGroups and adds no groupCount; on the
  cut path totalGroups is the statement's count of the groups before the
  cut. The engine outcome, the bridge member and the driver directive spell
  it totalGroups too.
- Pins: the limit-only push-down (tool and stdio engine), the explicit-order
  CONTROL, currencies on the cut result, and no groupCount in a served
  result.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
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/m tests 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.

2 participants