Skip to content

feat(mcp): aggregate_records names a lookup group's record beside its id, read as the caller - #35202

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

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35138-lookup-names

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Refs #35138 (item lookup group name)
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:MCP 的 aggregate_records 按 lookup / master_detail 字段分组时,每个分组在键旁多出 KEY__label,值为被引用记录的名称(被引用对象的名称字段,按 ADR-0079 解析);工具描述要求模型用 __label 称呼该分组、永不写出 id,没有 __label 时说明该记录无法命名。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 W0 决定表「lookup 分组名称」一行:托管问数工具发现分组只给 id 时模型会把 id 当答案念出来;这一项从托管层挪进框架,开源 MCP 客户端也能拿到,拼写与托管 aggregate_data 相同。
  • 风险与回滚:名称以调用方身份、经同一个 bridge 读取(一次批量读),不以任何其他权限读;读不到的记录与已删除的记录同样没有标签,答案里没有任何东西区分二者;对象、名称字段或 lookup 字段对调用方不可见、目标是工具不读的系统对象、或读取失败时,结果与之前完全一致。已有成员 rows/totalGroups/truncated/currencies 不变。回滚即 revert 本 PR。
  • 先看:① packages/mcp/src/mcp-http-tools.ts 的 recordNamesAsCaller(读取走 bridge.query、可见性检查与失败即无标签);② 同文件 withLookupGroupLabels(只对截断后实际返回的分组读名称,非 lookup 键不加标签);③ aggregate_records 处理函数里传入的 readGuard 谓词。
  • 两分钟验证:pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-http-tools.aggregation-entry.test.ts,预期 27 个测试全绿,其中 8 个是本 PR 新增的 lookup 名称用例。
  • 需要你做的:无,席位落地。

What changes

aggregate_records (packages/mcp/src/mcp-http-tools.ts, one handler serving both the HTTP and the stdio door) now names the record behind each lookup group key:

  • A group key is a lookup key when the caller's served schema (servedObjectDefinitionOf, the member feat(mcp): aggregate_records returns select groups in declared option order and names a fixed amount's currency #35186 reads) shows it as a lookup or master_detail field with a reference. A date-bucketed key is never one.
  • Beside each such key the group carries KEY__label, where KEY is the group column (the key's alias when the call gives one). Its value is the referenced record's value of the referenced object's name field, resolved with resolveDisplayField from @objectstack/spec/data (ADR-0079: nameField, then displayNameField, then the derived title field) over the referenced object as the caller is served it.
  • The names are read as the caller: one bridge.query per referenced object, where: { id: { $in: ids } }, fields: ['id', NAME_FIELD], limit: ids.length, for the groups the tool serves (after the row cap), through the same bridge and context as the aggregate. Two lookup keys on the same referenced object share that one read. This is the read shape delete_records already uses for an id list.
  • A label is present only for a key whose record that read returns with a non-blank name. Every other key carries no label and nothing else in the answer changes.
  • No label is added, and the result is exactly as before, when: the lookup field is not served to the caller; the referenced object or its name field is not served to the caller; the referenced object is one this tool does not read (the same readGuard the read tools apply, so a sys_ object without the AI read opt-in is never read for a name); or the read throws or answers no records list. A name read never fails the aggregate.
  • A column the aggregate already answers under the label's name is never overwritten.
  • The tool description gains: a lookup group carries KEY__label beside the id, read with the caller's own permissions; name such a group by its __label, never by the id; where a group has no __label, its record cannot be named, so say that rather than quoting the id.

The type stays local to packages/mcp; the aggregate_records result has no schema in packages/spec, and no guidance text enters the spec (ADR-0149 M1). No existing member is renamed or removed.

Tests

New pins: top-level describe in packages/mcp/src/mcp-http-tools.aggregation-entry.test.ts (the shared aggregate_records harness)
  • a lookup and a master-detail group carry KEY__label: the referenced record's name field (nameField: 'title'), placed right after the key; an aliased key is labelled by its alias
  • CONTROL: a second key that is not a lookup carries no label, even where its value is a record id
  • CONTROL: a record the caller's read does not return and a deleted record answer the same, with no label (the two answers compared whole and as JSON text)
  • CONTROL: a record whose name is blank, and a null key, carry no label
  • CONTROL: a referenced object, a name field or a lookup field the caller is not served, or a system object the tool does not read, answers exactly as before and makes no name read
  • CONTROL: a name read that throws, or answers no records list, answers exactly as before
  • the names are one batched read of the referenced object, for the groups served (60 groups, cap 50: one read, 52 ids, two keys on one object), as the caller
  • the stdio door: through createStdioDataBridge and a real MCP client, the name read reaches the engine as one find under the principal's own context, and only the record that read returns is labelled
Ablations (one or more per pin, through scripts/ablation-replace.mjs; each restored to the HEAD blob a3381bff9791)

Each mutation landed (anchor 1 then 0, blob changed) and the file went red; every restore read ok restored: blob == HEAD (a3381bff9791) and git diff HEAD is empty.

  • A, the label never set: 5 failed (the label pin, both CONTROLs that also expect a label, the batched-read pin, the stdio pin).
  • B, names applied to any column: 1 failed (the non-lookup CONTROL).
  • C, a placeholder label for a key with no name: 3 failed (the unreadable/deleted CONTROL, the batched-read pin, the stdio pin).
  • D1, the name field's served check removed: 1 failed (the not-served CONTROL).
  • D2, the referenced object's read guard replaced by true: 1 failed (the not-served CONTROL, its system-object half).
  • D3, the lookup-type check replaced by a field-name match: 1 failed (the not-served CONTROL, its lookup-field half).
  • E, the read's catch rethrows: 1 failed (the throwing-read CONTROL).
  • F1, one read per id: 2 failed (the batched-read pin, the stdio pin).
  • F2, names read for every group before the cap: 2 failed (the batched-read pin, and feat(mcp): aggregate_records returns select groups in declared option order and names a fixed amount's currency #35186's cap pin).

The unreadable/deleted CONTROL is red under C on its shape half. Its comparison half cannot be turned red by a mutation inside the handler, because the handler sees only what the caller's read returns.

Acceptance notes

  • feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 (mcp: aggregate_records can order and cut its groups and says how many groups there were #35144, area o1-C) shares this handler and is still open. overlap-check reports conflicts with it in mcp-http-tools.ts and mcp-http-tools.aggregation-entry.test.ts, both adjacent insertions. Whichever PR merges main second keeps both behaviours: the cut path's result (aggregateGroups) gets its served rows labelled the same way, through withLookupGroupLabels(bridge, ROWS, groupBy, FIELDS, READ_GUARD_PREDICATE) over servedFieldsOf(bridge, objectName); the default path keeps groupCount from feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 and the labels from here.
  • Aliased keys. The label member is named after the group column, which is the alias when the call gives one ({ field: 'parent', alias: 'p' } gives p__label), so the label always sits beside the key it names.
  • Name values. A non-blank string is a name; a finite number (an explicit numeric name field) is served as its string. Anything else is no name.
  • Stdio query cost. The stdio bridge's query counts the match when a limit is passed, so the one name read there is a find plus a count of the same filter, both as the caller. The limit is kept because it is the read shape delete_records uses and it bounds the read on any host page size.

Verification

All readings below are at head 90e185aa5b, the final commit.

Local subset
  • pnpm --filter @objectstack/mcp typecheck, then vitest run --maxWorkers=2 over the whole package, under the shared verify lock: VERDICT command-exit 0; Test Files 72 passed (72), Tests 1299 passed (1299); check:test-typecheck: OK.
  • src/mcp-http-tools.aggregation-entry.test.ts: Tests 27 passed (27).
  • dispatch-gates --commands: 68 derived families, 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 overlap exit 1, against origin/main ba6556c617 (merges cleanly) and two open PR heads: feat(mcp): query_records and get_record name the fields field-level security withheld from the caller #35179 merges cleanly; feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 conflicts as described above.
  • test:repo not run locally: the diff touches no repo-project test and the derivation names none; CI's Test Core runs it.

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

@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 9 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 9c29d732a191496cf2069da9419c251eaba557c2.

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

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: master_detail (literal, 45 pages)
  • 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 9c29d732a191496cf2069da9419c251eaba557c2 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b068f346a1de395c18a39ca3e28e6d4d787bf927 — the merge of head 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa into base 9c29d732a191496cf2069da9419c251eaba557c2, 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 b068f346a1de395c18a39ca3e28e6d4d787bf927 && git checkout b068f346a1de395c18a39ca3e28e6d4d787bf927
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9c29d732a191496cf2069da9419c251eaba557c2 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa && git checkout -B drift-repro 9c29d732a191496cf2069da9419c251eaba557c2 && git merge --no-ff 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa

node scripts/docs-audit/affected-docs.mjs --json 9c29d732a191496cf2069da9419c251eaba557c2

⚠️ 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 9c29d732a191496cf2069da9419c251eaba557c2 → 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 #35202 @ 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa (card #35138, PR 4)

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 3 6978597356). 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 (amendment 3, os-dev report 6980131954, area note on that report), 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 present-only KEY__label member beside a lookup or master-detail group key; that the name is read as the caller, through the same bridge and context, in one batched read per referenced object, after the cap; that a label appears only for a record the caller's read returns with a non-blank name, and nothing distinguishes a record the caller cannot read from one that no longer exists; that an unserved field, object or name field, a guarded object, or a failing read leaves the result exactly as before; the tool description text; what the built entry of @objectstack/mcp reaches; anything removed, renamed or narrowed (rows, groups, totalGroups, truncated, currencies untouched).
  • ② 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 and the feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 merge note (corrected by the area note: totalGroups, no groupCount) answered or escalated.
  • Implemented-by: claude/issue-35138-lookup-names · 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: 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa
Local-runs: none

Inputs: brief 6980194000; card #35138 (claim 6975089907, claim amendment 3 6978597356, os-dev report 6980131954 and area note 6980179875); card #35144 (every comment, among them the hand-on 6977042103 and the seat ruling 6978086158); PR #35193 (body and the mcp-http-tools.ts on its head f766f5dcc0); PR #35202 (body and comments); the full diff against merge-base ba6556c617 (3 files, +383/−7, 2 commits); the changeset; and the check-runs on this head. Code outside the diff was read at origin/main only. origin/main has 2 commits since the merge-base, and neither touches packages/mcp, packages/runtime/src/domains/mcp.ts or packages/spec/src/data/display-name.ts.

Face: the committed file list is .changeset/mcp-aggregate-lookup-group-labels.md, packages/mcp/src/mcp-http-tools.ts and packages/mcp/src/mcp-http-tools.aggregation-entry.test.ts. It touches no packages/spec/src/** path and no governed path. record-recognisers.mjs --paths decides no face from the paths and defers to the changeset's Clause-②: line, which carries yes (widening). Governed Surface Queue Guard succeeded on this head. So this is the declaration face at TIER_DEFAULT, with no ④. Every file is inside the file surface of amendment 3, and stdio-data-bridge.ts was not needed.

① Derived judgments

  • CI on this head is still running. 52 check-runs: 30 success, 16 skipped, 6 in progress, 0 failure. Still running: Test Core shards 1 to 6 of 10. Complete and green: Build Core, Check Changeset, Check PR Size, Governed Surface Queue Guard, PR-body guards, every Type Check · lane, every Lint · lane (among them Lint · repo & tooling gates, which carries the NOT-MEASURED check:dual-build-cjs-loads), Lint & Repo Gates, Test Core shards 7 to 10, Test UI, Live E2E UI and Dogfood Regression Gate. I judge on what is complete. The seat must see the 6 running shards finish green on this head before landing.
  • One handler, both doors: right. aggregate_records is registered once, in registerObjectTools, which the HTTP door and the stdio door both call. The name read is bridge.query on the same bridge object the aggregate used. On the HTTP door that is the per-request bridge with the request's context (callData('query', ...) at origin/main). On the stdio door it is resolvePrincipal() and engine.find with that context, after the same exposure gates query_records passes. The stdio pin drives the real stdio bridge through a real MCP client and checks the engine read is one find with the principal's own context.
  • When a key is a lookup key, and the member's name: right. A key counts only when the caller's served schema shows it as lookup or master_detail with a non-empty reference. A date-bucketed key is skipped, and a field the served view does not show is skipped. The member is KEY__label, where KEY is the group column: the alias when the call gives one, else the field name. It is inserted right after its key, so the order of the existing columns does not change. A column the aggregate already answers under that name is never overwritten (unpinned: N3).
  • The read: as the caller, batched, after the cap: right. Labels are read only for served, the slice after maxLimit, so truncated and totalGroups are computed exactly as before. Keys that reference the same object are grouped, and their ids (deduplicated, non-empty strings only) go into one bridge.query per referenced object: where: { id: { $in: ids } }, fields: ['id', NAME_FIELD], limit: ids.length. The batched-read pin covers 60 groups with a cap of 50 and two keys on one object: one read, 52 ids, no id from past the cap. The name field is resolveDisplayField (ADR-0079) over the referenced object as the caller is served it. If that pointer names a field the served view does not show, no labels are added for that object. The code does not fall back to another field.
  • Present only for a returned record with a non-blank name: right, at rule level. A label is set only for an id the caller's read returns, where that id was asked for and the name is a non-blank string or a finite number. Every other key, including a null key, keeps exactly the columns it had. So the answer is built only from what the caller's own read returns, and a record the caller cannot read gives the same answer as one that no longer exists. The CONTROL compares the two answers whole and as JSON text. The dev's ablation note is right: the comparison half cannot be turned red from inside the handler, because the handler sees only the read's answer. That is the rule working as designed.
  • Nothing added when the name cannot be read: right. No label is added, and no read is made, when the bridge has no servedObjectDefinitionOf, when the lookup field, the referenced object or its name field is not served, or when the referenced object fails the read tools' readGuard (a sys_ object without the AI-read opt-in). A read that throws, or answers no records list, is caught and adds nothing. A name read never fails the aggregate. The CONTROLs pin each of these with the answer compared whole. servedFieldsOf is split into servedDefinitionOf and fieldMapOf with the same result for every input: no member, a null answer, a throw and a non-map fields all still give undefined.
  • Tool description: right, with N1. Three sentences are added. They say a lookup or master-detail group carries the label beside the record id, read with the caller's own permissions; tell the model to name such a group by its label and never by the id; and tell it to say that a group with no label cannot be named. This matches the code. For a null key, the wording is looser than it should be (N1).
  • Built entry of @objectstack/mcp: nothing removed, renamed or narrowed. The exports map is unchanged. No export line is added or removed. The two new functions, the two new constants and the two split-out helpers are module-private. resolveDisplayField comes from @objectstack/spec/data, which already exports display-name and is already a workspace:* dependency. The answer is untyped JSON text with no output schema in packages/spec. rows, totalGroups, truncated and currencies keep their names, their meaning and the conditions under which they appear. The only change to rows is the new member that appears only when it has a value. No input accepted before is now refused.
  • SQL push-down: no finding, the second read is reasoned. This adds an in-app id collection and a second read, which is a finding unless a reason is given. Here it is reasoned. Amendment 3's rule asks for the name as the caller's own read of the referenced object, so that object's own object, field and record permissions apply to the name. The aggregate itself stays one database GROUP BY. The name read is one statement per referenced object. Its $in runs in the database, and it is bounded by the cap (at most 50 ids per key by default). It is the same read shape delete_records uses for an id list.

Findings:

② Semver level

  • Changeset .changeset/mcp-aggregate-lookup-group-labels.md: right. It bumps @objectstack/mcp at patch. That is the only published package whose source 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 from the closed pair. A new answer member that is present only when it has a value is a widening. Nothing is removed, renamed or newly refused. Claim 6975089907 and amendment 3 declared Clause-②: yes.
  • Metadata-protocol: none: right. No spec key, accepted value or metadata type is added. The code reads the existing reference, nameField and displayNameField keys with their declared meaning, and no guidance text enters the spec (ADR-0149 M1).
  • Changeset prose against the diff: right.
    • "groups by a lookup or master_detail field ... a new member ... beside the key": true (①).
    • "from the referenced object's name field (nameField, as ADR-0079 resolves it)": resolveDisplayField over the served definition.
    • "the key's alias when the call gives one": true, and pinned.
    • "The same spelling is used by the hosted ask tools": read from amendment 3 (cloud#4795). It is not checked in this repo.
    • "on both the HTTP and the stdio door": one handler, two bridges (①).
    • "read as the caller, through the same bridge and context as the aggregate, in one batched read of the referenced object for the groups the tool serves": true, and pinned on both the recording bridge and the stdio bridge.
    • "A label is present only for a key whose record the caller's read returns with a non-blank name. Any other key carries no label, and nothing else in the answer changes": true.
    • "No label is added, and the answer is exactly as before, when ... not served ... a system object the tool does not read, or when the read fails. A failed name read never fails the aggregate": true, and pinned.
    • "Existing members (rows, totalGroups, truncated, currencies) are unchanged": true for their names and meaning. The new member inside rows is the stated change.

③ Boundary flags

  • Open questions: none in the report.
  • Deviation, two single-file vitest runs outside the verify lock: process only. Every package run and every ablation ran under it. Accepted in 6980179875.
  • Deviation, model-free commit trailers and the AGENTS.md footer form: process only.
  • Deviation, test:repo left to CI: answered. No repo-project test is touched. CI Test Core carries it, and 6 of its shards are still running (①).
  • NOT-MEASURED check:dual-build-cjs-loads: answered. CI Lint · repo & tooling gates carries it, and it succeeded on this head.
  • The feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 merge note: answered by area note 6980179875 (totalGroups, no groupCount). It is not yet written on the carrier's card or PR: S1. The PR body still carries the old wording: N2.
  • security_findings: none: I agree. Nothing in this diff reads with rights the caller does not have.
  • Ablations A to F2: each mutation landed and turned the pin file red, and each was restored to the HEAD blob a3381bff9791, the blob this head carries for mcp-http-tools.ts. The ablation limit on the unreadable-versus-deleted comparison is accepted (①). No ablation covers the date-bucket skip (one token, stated in the jsdoc) or the never-overwrite check (N3).
  • Docs: content/docs/ai/natural-language-queries.mdx and connect-mcp.mdx name aggregate_records but do not list its result members. The sentence "It does not join across objects" stays true of the GROUP BY. No page becomes untrue, and no page is owed. skills/objectstack-ask/SKILL.md does not teach the label. The tool description carries it, so a skill sentence would be a follow-up, not owed here.
  • 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 or feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193, with no new head. Before landing, the seat must see the 6 running Test Core shards finish green on the final head (①).

Implemented-by: claude/issue-35138-lookup-names
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 90e185aa5bc64a04b7cdf4f047c7bd1e31a11afa (same head as record 6980323967):

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Final head for L1 · 2026-11-18T13:58Z

Head-sha: 90e185aa5b · all check-runs success or skipped (37 success, 16 skipped, 0 red; all ten Test Core shards green, and Lint · repo & tooling gates carries the locally NOT-MEASURED check:dual-build-cjs-loads) · NOT governed, +383 / −7. Delivers #35138 PR 4 (a lookup group key names its record as KEY__label, read as the caller), 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 6980323967 at this head is PASS (declaration face). S1 is closed by delta 6980364931 through 6980343159 on #35144 (the cut path labels its served rows the same way, whichever of #35193 / #35202 merges main second). Nits N1 to N3 stay nits. Inputs: claim 6975089907, amendment 3 6978597356, dev report 6980131954, area note 6980179875 (which corrects the body's groupCount wording to totalGroups).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 review (#35138, PR 4) · 2026-11-18T13:59Z

L1: ACCEPT
Head-sha: 90e185a
Read: the full diff at this head against merge base ba6556c (3 files, +383/−7), with claim amendment 3 6978597356, contract record 6980323967 and its delta 6980364931, and the carry note 6980343159 on #35144.

Fixes vs Part of. This is PR 4 of the W0 plan. The body says Refs #35138, and no closing keyword appears in the body or the changeset, so a merge does not close #35138. As on #35185 and #35186, the checklist's form is Part of, and Refs has the same effect.

Claim file surface. Amendment 3 gives PR 4 three things: mcp-http-tools.ts (the aggregate_records handler, its module-private helpers and its description), its tests, and one changeset. The diff is exactly that. servedFieldsOf is split into servedDefinitionOf and fieldMapOf, both module-private and with the same behaviour. stdio-data-bridge.ts is not touched, because the stdio door reads the name through its existing query and servedObjectDefinitionOf.

Each changeset sentence against the diff. The changeset is new and is not on main. It bumps @objectstack/mcp at patch.

  • "lookup or master_detail … <key>__label … the alias when the call gives one": LOOKUP_GROUP_TYPES holds the two types, and a key needs a served field with a non-empty reference. A date-bucketed key is skipped. The column is the alias, else the field.
  • "The referenced object's name field (ADR-0079)": resolveDisplayField reads the served definition of the target, and the name field must itself be served.
  • "Read as the caller … one batched read … for the groups served":
    • It runs after the cut, over served only.
    • It makes one bridge.query(target, { where: { id: { $in: ids } }, fields: ['id', nameField], limit: ids.length }) per referenced object, through the same bridge, so the caller's object, field and record rules apply.
    • The target first passes the tool's own readGuard.
  • "Present only for a key whose record the caller's read returns with a non-blank name": names are kept only for asked ids, as a non-blank string or a finite number. A missing record and an unreadable one leave the same absence, so the answer never says which. A column the aggregate itself answers as <key>__label is never overwritten.
  • "No label … the answer exactly as before … a failed name read never fails the aggregate": in recordNamesAsCaller, every exit is undefined inside a try. An unserved target, name field or lookup field, a refused system object, a throw, and a non-records answer each return the rows unchanged.
  • "The tool description now tells a model …": the three sentences are added as stated.
  • "Existing members unchanged": rows now carries the labelled copies, and totalGroups, truncated and currencies are unchanged.

Tests. The aggregation-entry file has 8 new cases.

  • Lookup and master-detail labels by key and by alias.
  • CONTROL cases: a non-lookup key that holds a record id, an unreturned or deleted record, a blank name and a null key, the unserved target, name field or lookup field and the system object, and a read that throws or answers no list.
  • The one batched read as the caller, for served groups only.
  • The stdio door under the caller's own context.

Clause-②: yes (widening). TIER_DEFAULT record 6980323967 is PASS on this same head. Delta 6980364931 closes S1 through 6980343159, the carry to #35193: the cut path labels its served rows through the same helper. N1 to N3 stay nits.

Governance. check-governed-merges.mjs --pr 35202: NOT governed, 0 of 3 paths on the register, 390 changed lines.

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-18T14:01Z

Probe Reading
check-governed-merges.mjs --pr 35202 NOT governed · +383 / −7, 0 of 3 paths on the register, Clause-②: yes (widening) (claim 6975089907, amendment 3 6978597356)
Contract review (条款②) TIER_DEFAULT record 6980323967 at 90e185aa5b: PASS (declaration face); S1 closed by delta 6980364931 through 6980343159 on #35144; nits N1 to N3 only
Head / review 90e185aa5b · L1-a ACCEPT 6980763357 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 = 2, merges cleanly into origin/main 756aba29a0; no main merge taken, so the L1 head stands. overlap-check.mjs: origin/main, #35179, #35198 and #35199 clean; #35193 (#35144's carrier, area o1-C) conflicts in the aggregation test, as planned: #35193 merges main second and labels the cut path's served rows with one pin (6980343159; o1-C acknowledged)

Open findings: record nits N1 (the no-label sentence also covers the null-key group), N2 (the body's groupCount wording, superseded by 6980179875), N3 (no pin for the never-overwrite rule); L1 notes N1 (one name read plus one count per referenced object, bounded), N2 (merge order with #35193).

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

Dev-effort: medium · Rounds: 1

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 18, 2026 14:01
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 084156d Nov 18, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35138-lookup-names branch November 18, 2026 14:22
os-warren pushed a commit that referenced this pull request Nov 18, 2026
… the aggregate order and cut

Five adjacent-insertion conflicts, each resolved keeping both sides: the
engine exports and the runtime imports of AGGREGATE_ORDER_CUT beside
LATEST_PER (objectql index, runtime action-execution and domains/mcp), the
two Symbol.for read options in the stdio bridge, and the aggregation-entry
test, where the order-and-cut describe block and #35202's lookup-label
block both land after the served-schema block. mcp-http-tools.ts merged
without conflict.

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