Repository navigation
feat(mcp): aggregate_records names a lookup group's record beside its id, read as the caller - #35202
Conversation
… id, read as the caller Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 17 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
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 @
|
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Contract reviewServed-tier: 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 Face: the committed file list is ① Derived judgments
Findings:
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Contract review delta on head
|
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Final head for L1 · 2026-11-18T13:58ZHead-sha: |
|
repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9 L1 review (#35138, PR 4) · 2026-11-18T13:59ZL1: ACCEPT Fixes vs Part of. This is PR 4 of the W0 plan. The body says Claim file surface. Amendment 3 gives PR 4 three things: Each changeset sentence against the diff. The changeset is new and is not on
Tests. The aggregation-entry file has 8 new cases.
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. CI at this head, from check-runs: 37 success and 16 skipped, with none failed or in progress (all ten Must-fixNone. Should-fixNone. Notes
|
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Landing · 2026-11-18T14:01Z
Open findings: record nits N1 (the no-label sentence also covers the null-key group), N2 (the body's State: ready + auto-merge armed by area o1-B (lease Dev-effort: medium · Rounds: 1 |
… 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>
Requested by Warren · project thread
Refs #35138 (item lookup group name)
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
aggregate_records按 lookup / master_detail 字段分组时,每个分组在键旁多出KEY__label,值为被引用记录的名称(被引用对象的名称字段,按 ADR-0079 解析);工具描述要求模型用__label称呼该分组、永不写出 id,没有__label时说明该记录无法命名。HTTP 与 stdio 两个入口共用同一处理函数。aggregate_data相同。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: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 alookupormaster_detailfield with areference. A date-bucketed key is never one.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 withresolveDisplayFieldfrom@objectstack/spec/data(ADR-0079:nameField, thendisplayNameField, then the derived title field) over the referenced object as the caller is served it.bridge.queryper 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 shapedelete_recordsalready uses for an id list.readGuardthe read tools apply, so asys_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.KEY__labelbeside 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; theaggregate_recordsresult has no schema inpackages/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)
KEY__label: the referenced record's name field (nameField: 'title'), placed right after the key; an aliased key is labelled by its aliascreateStdioDataBridgeand a real MCP client, the name read reaches the engine as onefindunder the principal's own context, and only the record that read returns is labelledAblations (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.true: 1 failed (the not-served CONTROL, its system-object half).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
overlap-checkreports conflicts with it inmcp-http-tools.tsandmcp-http-tools.aggregation-entry.test.ts, both adjacent insertions. Whichever PR mergesmainsecond keeps both behaviours: the cut path's result (aggregateGroups) gets its served rows labelled the same way, throughwithLookupGroupLabels(bridge, ROWS, groupBy, FIELDS, READ_GUARD_PREDICATE)overservedFieldsOf(bridge, objectName); the default path keepsgroupCountfrom feat(mcp): aggregate_records orders, cuts and counts groups in the database #35193 and the labels from here.{ field: 'parent', alias: 'p' }givesp__label), so the label always sits beside the key it names.querycounts the match when alimitis passed, so the one name read there is a find plus a count of the same filter, both as the caller. Thelimitis kept because it is the read shapedelete_recordsuses 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, thenvitest run --maxWorkers=2over 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.--ranreconciliation:68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.check:dual-build-cjs-loads, exit 3,PREREQUISITE NOT MET(it reads every package'sdist, 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/mainba6556c617(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:reponot run locally: the diff touches no repo-project test and the derivation names none; CI'sTest Coreruns 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