Skip to content

feat(mcp): search and read the installed apps' manuals over MCP, with the answer order in initialize - #35564

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-3ozbh4
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-3ozbh4

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

repo:objectstack#5 · os-bill · session_01Utp6CZLCXjj9QDJSWktRrW

Part of #35442 (the card stays open for the cloud carrier and the live acceptance).

Clause-②: yes
Metadata-protocol: none

维护者速读

  • 用户自己的 AI(通过平台 MCP 接入)现在能在已安装应用的手册里查找、阅读篇目,回答末尾给出可点开的手册地址;以前它读不到手册,只能凭通用知识回答。
  • 属于控制台核心业务操作体验专题,解决「问什么是回款、审批流程怎样时,AI 是查了系统还是编的」这个问题。
  • 出错的话,最坏是查不到篇目或给错地址,用户仍能自己打开手册;只读,不改任何数据,可直接撤回。
  • 无。

What changes

  • Two door tools (packages/mcp): search_package_docs({ terms, package? }) and read_package_doc({ name, package?, locale? }), the names the cloud service-ai registry already holds. They register where the bridge carries both new optional members (searchPackageDocs, readPackageDoc) and the grant is the read family's (an API key or session, or data:read). Search is a substring match on title, heading and text. Pages that contain more of the terms come first, then by the sum of where each contained term is found (title 3, heading 2, text 1), then by title; at most 10 results with excerpts. The description states the match rule, the order and the cap. The heading parse is line-based and linear. Read answers the Markdown content, cut at 60,000 characters with a note. An answer carries the page's console address /_console/apps/PACKAGE/docs/BOOK/NAME where the page has one (a page with no package has none), and both descriptions say so.
  • The runtime HTTP bridge (packages/runtime/src/domains/mcp-package-docs.ts, wired in mcp.ts) implements both members over the protocol's /meta list read. It reads the doc and book lists through createMetaListReadGate (the ADR-0046 §6.7 docs-audience gate), with this request's execution context as the caller, and adds no second visibility rule. A page the caller may not read is neither found nor read, and reading it answers RESOURCE_NOT_FOUND. On an OAuth grant the caller is the agent envelope (ADR-0090 D10), so the docs audience is judged on the token's grant (its scope-derived sets), not on the person's own permission sets: a { permissionSet } manual the person holds stays hidden on that connection. This fails closed and is kept on purpose; both tool descriptions, the changeset and the helper header state it. BOOK is the home manual the Console's flat-permalink redirect would pick: the first readable manual of the page's package that claims it, else that package's first readable manual, else its implicit manual (§6.4). The bridge carries the members only where the protocol has getMetaItems.
  • The answer-order rule (mcp-server-runtime.ts, initialize instructions, gated like the mcp: the open door's initialize instructions carry the ask-data selection rule and the skills install line; /mcp/skill renders from the published skill #34686 selection rule): read the manuals first. A concept is answered from the manual, and a general explanation is labelled as one. A process or rule also needs its real definition, which wins where the two differ and the difference is named. The answer ends with page titles and urls. It names only tools the connection lists: describe_metadata, else get_metadata_item, read off the authoring registry under metadata:write. With neither, it says to answer from the manual and state that the configured process was not checked. Host and configured instructions are unchanged. skills/** is untouched.
  • MCP_DOOR_TOOL_NAMES (@objectstack/spec/system) gains the pair. PLATFORM_PROVIDED_TOOL_NAMES is unchanged, since door/cloud overlap is by design (describe_object, query_records, …). scripts/check-route-envelope.mjs declares the new domain-folder file as { handBuilt: 0 } (area-approved, comment 7013028695). README and a changeset are included.

Tests

  • packages/runtime/src/domains/mcp-package-docs.test.ts (item 4) drives the bridge the real /mcp entry builds, over a fixture package with two manual pages. 「什么是回款」 (term 回款) finds 《订单与回款手册》 at /_console/apps/com.example.crm/docs/sales/crm_order_payment. 「商机的审批流程」 (商机, 审批) finds 《商机——阶段、提醒与审批》 first, with both terms matched. A page that only a { permissionSet } manual claims is neither found nor read without the set; the control is that the holder finds and reads it through that manual's address. On the agent envelope an OAuth token produces, the page is neither found nor read even though the delegating person holds the set. The file also covers the implicit-manual address, the package filter, a translation match plus a locale read, the cap and truncated, an ambiguous name, the no-list-read host, a long-whitespace heading (parses fast) and a bare # line followed by text (not a heading).
  • packages/mcp/src/mcp-package-doc-tools-35442.test.ts covers the registration gate (grant and members, each with a control), argument hand-off and cap, the query → terms refusal, the read cut, and coded refusal relay. It also covers the rule's presence and absence with tools/list, the definition-reader naming (describe_metadata > get_metadata_item > none, with a writes-only registry as control), and that host and configured texts stay whole.
  • mcp-file-tools.test.ts adds the pair to the conformance test that holds wireBridgeTools equal to MCP_DOOR_TOOL_NAMES.
Readings (head after the one pre-PR merge of main; fix-round readings last)
  • pnpm --filter @objectstack/mcp test: 79 files, 1439/1439 (before the merge; the merge touched no mcp file). After the merge, the three mcp files above: 77/77.
  • Runtime: every src/**/mcp*.test.ts plus each test that builds the bridge (buildMcpBridge / handleMcp(), 38 files, 1096/1096. After the merge, mcp-package-docs.test.ts and http-dispatcher.mcp.test.ts: 29/29. The full pnpm --filter @objectstack/runtime test exceeds the container's 10-minute foreground cap (exit 124): NOT MEASURED locally, left to CI's Test Core.
  • platform-tool-names.test.ts 11/11; @objectstack/lint validate-ai-tool-references.test.ts 28/28. Typecheck of mcp, runtime and spec passes. spec check:generated: all 14 artifacts up to date after the merge rebuild.
  • Ablation (the gate is what hides a page): node scripts/ablation-replace.mjs replaced await createMetaListReadGate(readGate, 'doc')(…) with the raw list (anchor x1 → x0, marker x0 → x1). Result: 1 failed / 8 passed, with "a page only a permission-set manual claims is neither found nor read without the set" red. It then restored the file (blob == HEAD, git diff HEAD empty). The runtime test imports the source, so no dist leg.
  • Gates: the derived set (dispatch-gates --commands) was run with exit codes, and the record is in the os-dev-report on the card. Two came back red and were fixed in this PR: check:route-envelope (the new file was undeclared) and check:test-source-alias (a module-top import '@objectstack/metadata'). NOT MEASURED locally, all environment prerequisites and not findings: check-plugin-teardown-shape --self-test (shallow clone), check:skill-examples (exit 3, prerequisite), check:dual-build-cjs-loads (exit 3, needs a full build), and pnpm --dir ui exec vitest run scripts/ (@objectstack/client unbuilt here).
  • Fix round (L2 7014988834): mcp-package-docs.test.ts 12/12; the mcp pair (mcp-package-doc-tools-35442.test.ts, mcp-file-tools.test.ts) 65/65; tsc --noEmit of mcp and runtime pass. Ablation of the agent pin: ablation-replace.mjs handed the gate onBehalfOf ?? ec instead of ec in mcp.ts (anchor x1 → x0); result 1 failed / 11 passed, the agent-envelope case red; file restored. The gates the changed files derive were re-run, all exit 0 (record on the card).

Acceptance notes

Verification

Read first, highest risk first:

  1. packages/runtime/src/domains/mcp-package-docs.ts: readableDocsAndBooks, the two gate calls, which are the only visibility rule.
  2. packages/mcp/src/mcp-server-runtime.ts: packageDocAnswerRule / definitionReaderServed, the text every client reads.
  3. packages/mcp/src/mcp-http-tools.ts: registerPackageDocTools, the registration gate.

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --project local src/domains/mcp-package-docs.test.ts should show 12 passed, including the two maintainer questions and the agent-envelope case.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CZLCXjj9QDJSWktRrW

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/mcp, @objectstack/runtime, @objectstack/spec, touching 74 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/mcp/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

38 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 bf69cb41cc1f6351b0b0365ad7842a561611190f.

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

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/mcp/README.md) — pages documenting those are invisible to this run
  • 19 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 184 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 bf69cb41cc1f6351b0b0365ad7842a561611190f → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json bf69cb41cc1f6351b0b0365ad7842a561611190f

⚠️ 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 bf69cb41cc1f6351b0b0365ad7842a561611190f → 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#5 · os-bill · session_01Utp6CY9JfbUzkuca2gUyu6

Final green head for review · 2026-11-19T16:00Z
Head-sha: 1e43fdb1bc52ad397deba3e7735a27a55af3f73c
Check runs at this head: 58 success, 11 skipped, 0 failed, 0 running. Merge state: clean. Size: +1200 / -10.
Reviews owed: L1 (thread L1-a), then L2 at CONTRACT_REVIEW_TIER (Clause-②: yes: two new tools on the published MCP door). Not governed (no skills/**, .claude/**, docs/adr/**, workflows): the area lands after both pass.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:用户自己的 AI 助手(Claude、Cursor 等)通过 MCP 连上后,可以搜索和阅读已安装应用自带的使用手册,回答"什么是回款""商机怎么审批"时先查手册、给出出处。
  • 为什么做:以前外部助手只能凭猜测回答业务概念和流程;手册已经在平台里,只是外部助手拿不到。
  • 出错会怎样:用户只能搜到、读到自己本来有权限看的手册页,无权看的页面一律回答"找不到";若出错,最坏是搜不到或回答没引用手册,不会改动任何数据。
  • 要你做什么:无。席位做合同复审后由区域落地。
  • 席位意见:权限沿用控制台同一道手册可见性检查,没有另起规则,证据充分,可以进入合同复审。

席位核对

L1-a: ACCEPT · head 1e43fdb1bc52ad397deba3e7735a27a55af3f73c · Fixes #35442 · 2026-11-19T16:02Z · reviewed to pm-dispatch text at origin/main fca72dfa32

Readings, my own: check-governed-merges --pr 35564 0 of 11 paths governed, +1200/−10 under the human-merge threshold; merge-tree against main clean; K=5 (no merge owed); CI 58 success / 11 skipped / 0 failed. The claim (7011826298, 14:21Z) predates the 14:38Z p1-only rule, and #35442 is one of the two cards ai-1 finishes after the ai hand-off. All 11 files are inside the claim plus its two amendments: 7012002705 for the runtime bridge, mcp-package-docs*.ts and route A, and 7013028695 for the one check-route-envelope.mjs row, which matches the mcp-authoring.ts precedent. skills/** is untouched, so the PR is not Tier H.

Visibility: one rule, the gate's.

  • mcp-package-docs.ts reads doc and book through createMetaListReadGate(readGate, 'doc' | 'book'), the list gate the /meta doors use (ADR-0046 §6.7), with this request's executionContext as caller.
  • packageDocsReadGate hands it I/O only: resolveSecurityService comes from deps.resolveService(context, 'security'), exactly as mcp-authoring.ts:518 does.
  • Search and read filter only the gated lists, so a page the caller may not read is neither found nor read. The RESOURCE_NOT_FOUND text names no hidden page. The ambiguity refusal lists only packages of readable pages.
  • The home-book slug is picked among readable books only, so no gated manual's slug leaks into a url.
  • Registration is data:read, or no scope list (API key / session), the door's only read scope (packageDocToolsServed), and only where the protocol serves getMetaItems.

Answer order. packageDocAnswerRule goes into the open server's own initialize text only when both doc tools register. It names describe_metadata, else get_metadata_item, only when authoringToolsServed holds and the registry lists it; otherwise it says the configuration was not checked. A host text or a configured instructions is served whole. This follows ruling 6940528935 (the server says what this environment has) and the #34686 placement.

Pins (names grepped).

  • mcp-package-doc-tools-35442.test.ts, 11 cells:
    • registration by grant and bridge;
    • the cap and the match rule in the description;
    • query in place of terms refused before the bridge is called;
    • read pass-through and the 60,000-char cut;
    • coded refusals relayed;
    • four initialize cells (rule follows the tools, no reader, reader order, host text whole).
  • mcp-package-docs.test.ts, 8 cells:
    • the maintainer's two questions (回款; 商机 + 审批);
    • the permission-set manual hidden without the set, plus its CONTROL with the set;
    • the implicit manual and package narrowing;
    • translation-only match;
    • cap + empty terms;
    • same name in two packages;
    • no list read means no members.
  • The ablation (gate call → raw list: 1 red, the permission-set case) is from os-dev-report 7013709981.

Declaration: agreed. Clause-②: yes, a widening: two new tools on the door, and MCP_DOOR_TOOL_NAMES gains the pair, reusing the names cloud service-ai already holds, with PLATFORM_PROVIDED_TOOL_NAMES unchanged. Metadata-protocol: none, patch on mcp, runtime and spec. Changeset sentences checked against the diff:

  • the two tool shapes and the console address;
  • the 10 cap and the 60,000 cut;
  • "a page the caller may not read is neither found nor read";
  • the grant list, and the HTTP-only bridge;
  • the answer-order sentences and the reader order;
  • "a host's own instructions and a configured instructions option are served unchanged".

Nit, non-blocking. The changeset and the search_package_docs description say the results are "ranked title, then heading, then text". The code ranks first by how many terms a page contains (matched.length * 10 + rank), then by where, then by title. The helper's own header says so. Add "by how many terms match, then" to both texts in this PR or a follow-up; it changes no behaviour.

Routing. The diff touches packages/spec/src/system/constants/platform-tool-names.ts, published schema. Per contract-review.md, that sets L2 at CONTRACT_REVIEW_TIER. Scope: that file, plus mcp-http-tools.ts, which registers the named pair. The rest falls under this TIER_DEFAULT ACCEPT. Not governed: ai-1 lands it after the L2.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1e43fdb1bc52ad397deba3e7735a27a55af3f73c
Local-runs: none
Scope: packages/spec/src/system/constants/platform-tool-names.ts + packages/mcp/src/mcp-http-tools.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/mcp-file-tools.test.ts, packages/runtime/src/domains/mcp-package-docs.ts, packages/runtime/src/domains/mcp.ts

PR #35564, card #35442. Read: the card body and its six comments, the PR body and its eleven files, the net diff against main, and the check-runs on this head (69 runs: 58 success, 11 skipped, none failed or pending; of the eleven required contexts ten are success and Lint UI is skipped, the diff holding no ui/ path). The implementing files are named apart from the one hits file because the list's new jsdoc line describes them ("served at the door over the docs-audience gate") and the conformance test enforces it. The tests of the two new behaviours, the README, the changeset and the route-envelope row are the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

  1. MCP_DOOR_TOOL_NAMES grows from 19 to 21 names. Right: it is what wireBridgeTools registers on a bridge carrying every optional member under every scope, and mcp-file-tools.test.ts (both members added to its bridge in this diff) holds the two equal. The list stays sorted and duplicate-free, which platform-tool-names.test.ts pins.
  2. The skill.tools[] accept-set (validateAiToolReferences) does not move. Right: both names were already in PLATFORM_PROVIDED_TOOL_NAMES through the service-ai group, so they resolved for every skill before, a skill with mcpPrompt: false included. No lint finding appears or disappears, so Metadata-protocol: none holds.
  3. The spec's public surface: no export is added or removed; one exported constant's value grows. Right, and the api-surface gate inside TypeScript Type Check is green.
  4. The door's tools/list: the pair is listed for an API key, a session or a data:read grant where the bridge carries both members. The runtime's HTTP bridge carries them where the protocol has getMetaItems; the stdio bridge carries neither. A widening, declared. Right.
  5. initialize: the open server's default text gains one paragraph, under the same predicate that registers the pair (packageDocToolsServed). A host text and a configured instructions are served whole. Right.
  6. prompts/list, which neither the PR body nor the changeset names: registerSkillPrompts offers a skill only where the connection serves every tool it binds (skillBindingServed over the server's registered tools). A skill binding either name was withheld on the HTTP door until now and is offered where the pair registers. Right by that rule. A skill written for the in-product tool's argument names meets the door's own input shape, and the door answers its alias refusal (query to terms), so the difference is loud.
  7. Reuse of two names the cloud registry holds, the item the claim left unmeasured. Right: overlap is the list's stated design, and platform-tool-names.test.ts pins shared names. On the long-lived server a native name takes its name back from a bridged one (yieldBridgedTool), and the stdio bridge carries no doc member, so nothing moves there. On HTTP a host authoring registry that held either name would now meet the native registration and the SDK would throw for that request, which is the host duty registerAuthoringTools documents; the card's own reading of a cloud connection lists neither name. The cloud half of that conformance lives in the cloud repository.
  8. McpDataBridge gains two optional members. Additive for every host. Right.
  9. scripts/check-route-envelope.mjs declares mcp-package-docs.ts as { handBuilt: 0 }. Right: the file builds no response, and the gate is green.

② Semver level

Clause-②: yes — agreed. Two tools on the published door and two names on one exported list widen the surface; the line stands on the PR body and in the changeset, with no arm written, which the rule allows.

The changeset is patch on @objectstack/mcp, @objectstack/runtime and @objectstack/spec. It matches what the diff publishes: each of the three has published source in the diff, Metadata-protocol: none holds by ① item 2, and a non-protocol widening ships patch. @objectstack/rest and @objectstack/lint are read by the diff and not changed, so they are rightly absent. Check Changeset is success. Two of the changeset's sentences are the subject of S1 (the ranking) and S2 ("as the caller").

③ Boundary flags

The dev report's open_questions is empty. Its flags, and the PR's acceptance notes:

  • No definition reader on a data-only connection (carrier Decision: open-source MCP — the client thinks locally, the server keeps a thin door (a metadata draft write entry for building; the data door for 问数), plus policy, version skew and the 问数 eval #34659 M-2, on hold). Answered. definitionReaderServed reads the request's own authoring registry under the predicate that registers it, so the rule never names a tool the connection does not list, and otherwise says the configuration was not checked. That is route A of claim amendment 7012002705. The card's second acceptance line (manual plus the opportunity_approval definition) can therefore be met only on a metadata:write connection whose registry lists describe_metadata or get_metadata_item.
  • stdio carries no doc member ("carrier: none"). Answered. The README says so, and the list's jsdoc already qualifies itself as "on a bridge carrying every optional member". Whether stdio should carry the pair is a new card, the seat's call.
  • Book labels are served as authored. Answered: an accepted deviation. The slug in the address is unaffected.
  • Host instructions win. Escalated to the seat. The tree's own comments name the cloud build door as a host that injects instructions and dataOnlyInstructions, and a request answered by either text gets no rule appended. So card item 2 lands on open hosts only, and the environment the card's acceptance names receives the tools without the order text until that host adds it. Appending to a host text would break the rule that such a text is its author's whole. This needs a named carrier in the cloud repository before the card is read as accepted.
  • Live acceptance is after merge, and the PR body says Fixes objectstack-ai/objectstack#35442, so the merge closes the card before its two acceptance lines have run. Escalated to the seat: reopen-or-carry is the seat's to decide.
  • S2 below names two ways to close it, and choosing between them is a visibility decision: whose holdings a docs audience is asked about on a delegated token. Escalated to the seat; if no ruling of record covers it, it is the maintainer's.

SQL push-down: the diff adds no SQL and no id materialisation. The search is an in-app scan of the merged /meta doc list, and the helper's header gives the reason: no server-side doc search exists. Docs are metadata items the protocol's list read serves, not rows a driver query could filter, and ADR-0046 defers book-level search. No finding. The list read's own names narrowing, which read_package_doc does not use, is N3.

④ Design judgment

packages/spec/src/system/constants/platform-tool-names.ts (the hits file). Holds. The two entries are the names the service-ai group holds on main, and the new jsdoc clause is true of the tree: registerPackageDocTools registers them, and mcp-package-docs.ts reads doc and book through createMetaListReadGate. Tried against it: the lint accept-set (unchanged, ① item 2), a second registration under either name on each transport (① item 7), the stdio qualifier (the jsdoc's "every optional member"), and the conformance pin (both members added, so the equality is read from the registration site). The maintenance contract in the jsdoc is kept.

packages/mcp/src/mcp-http-tools.ts. The registration gate agrees with its text: both members present, and either no scope list or one holding data:read, the predicate initialize reads too. Inputs are strict, with alias refusals. The read cut and its note agree with the changeset. Two sentences do not agree with the code: S1, and N1.

packages/mcp/src/mcp-server-runtime.ts. Holds against card item 2, sentence by sentence: a concept from the manual, and a general explanation labelled as one; a process from the manual and from its definition, the definition winning with the difference named; sources at the end. The rule is sent exactly where both tools register, and the reader it names is one the request registers.

packages/runtime/src/domains/mcp-package-docs.ts and packages/runtime/src/domains/mcp.ts. Read for who can call and what an answer can show. Both lists pass the shared gate before anything else reads them, with no second rule. An unreadable gate input rejects; it is never an empty list. Results, their order, the cap and truncated are computed on the gated list only. A page that does not exist and a page the caller may not read answer the same RESOURCE_NOT_FOUND sentence. The ambiguity refusal names only packages of readable pages. The address is built from readable manuals alone, so no withheld manual's slug or label reaches a url, and its three segments are encoded. A name is compared by equality against the listed items: no path is read. The protocol is resolved for the request's environment as the bridge's other metadata reads resolve it. The domain opens with its anonymous deny, and the dispatcher's auth-policy gate sits above it. The home-manual pick agrees with the Console's (homeBook, bookSlug, sortBooks in ui/apps/console/src/pages/book-nav.ts). For a session or a key I found no page, package or manual served that the /meta/doc list would not serve the same caller. S2 is the one place the caller is not who the text says.

packages/mcp/src/mcp-file-tools.test.ts. Holds: the every-member bridge carries both new members, so the pin fails the day the list and the door differ.

S1 (should-fix) — the stated ranking is not the implemented one. The search_package_docs description, the jsdoc of registerPackageDocTools and the changeset say results are "ranked title, then heading, then text". searchPackageDocs sorts by matched.length * 10 + rank, where rank adds the place of every matched term (title 3, heading 2, text 1), and then by title. With two terms, a page holding both in its text scores 22 and outranks a page holding one in its title, 13. A title-and-text page ties a heading-and-heading page at 24, and the alphabet decides. The card's second question is the two-term case, and its pin (the opportunity manual first, both terms matched) passes on the rule the description leaves out. matchedOn reports the best place, which is not what the order used. The helper's header does state the term count, and its "then by where" is the sum, not the best place. Close it by stating the real order in the description, the jsdoc and the changeset, or by making the sort the stated one.

S2 (should-fix) — on an OAuth grant the audience is asked about the token's envelope, not the person. mcp.ts hands packageDocsReadGate the request's executionContext. For an OAuth token that is the agent envelope (assemble-execution-context.ts: principalKind: 'agent', permissions replaced by the scope's ceiling set, the person kept as onBehalfOf), and the gate's resolveAudienceCaller asks resolvePermissionSetNames of it, which answers that ceiling set alone (security-plugin-permission-sets.ts). So a page only a { permissionSet } manual claims is neither found nor read on a data:read token, whether or not the person holds the set. It fails closed, and default-audience manuals are unaffected. Three places in the diff say otherwise or leave it unsaid:

  • The header says the module "hands the gate I/O only, as mcp-authoring.ts does for the open draft door's reads". That door hands the gate the person's own grants (resolveHumanReader: "never the agent envelope's"). On one connection get_metadata_item can then serve a page that read_package_doc answers as not found.
  • The PR's control, "the holder finds and reads it", is pinned for a session-shaped context only.
  • The registration gate reads data:read, the one grant this happens on, and no case drives an agent envelope through the bridge.

Close it one of two ways: ask the gate about the delegator's own holdings on an agent envelope, with a pin for that case; or keep the envelope, say so in the two descriptions, the changeset and the header, and pin the agent case as the stated limit. ③ escalates the choice.

N1 (nit) — both descriptions promise a url to cite. A page with no _packageId answers its name and title only (addressOf). The type declares url optional, so the type is right and the two sentences are wide. The Console's portal route would address such a page. Follow-up, or left.

N2 (nit) — CONSOLE_BASE_PATH = '/_console' is one more literal of the Console mount, beside the CLI's CONSOLE_PATH and the default of uiBasePath. A host that mounts the Console elsewhere answers a url that does not open. The card names the literal. Follow-up.

N3 (nit) — each call makes three list reads (the doc list, the book list inside the doc arm, the book list again), and read_package_doc reads every page's body to return one. The list read takes names, which the /meta list door hands down, and the gate's verdict for a page does not depend on which other pages are listed. No effect on the answer. Follow-up.

Implemented-by: claude/project-thread-3ozbh4
Reviewed-by: isolated-l2-35564

VERDICT: PASS

- search_package_docs: the description, the registerPackageDocTools jsdoc,
  the runtime helper header and the changeset state the real order: pages
  with more of the terms first, then the sum of where each is found (title,
  heading, text), then title.
- Both doc tools say that on an OAuth connection the docs audience is judged
  on the connection's grant, not the person's own permission sets; the helper
  header drops its parity claim. A runtime test pins it: on the agent
  envelope a permission-set manual is neither found nor read, though the
  delegating person holds the set.
- Both descriptions promise a url only where the page has one.
- The heading parse is line-based and linear, with tests for a
  long-whitespace heading and a bare '#' line followed by text.

Claude-Session: https://claude.ai/code/session_01Utp6CZLCXjj9QDJSWktRrW
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CY9JfbUzkuca2gUyu6

Final green head for review (fix round 1, from L2 7014988834 and the seat's routing) · 2026-11-19T17:18Z
Head-sha: 3bbf1a9817cfeb7b09d0a60b34eb78fbcf58747a
Check runs at this head: 59 success, 13 skipped, 0 failed; one PR-body guards run cancelled by the body edit, superseded by its own success run (135719131823). Merge state: clean, no main merge. Size: +1328 / -10.
Owed: L2 delta at CONTRACT_REVIEW_TIER over S1, S2, N1, the heading-parse change and the body's Part of objectstack-ai/objectstack#35442. Dev delta: issuecomment-7016521809. Follow-ups nested under #35442: #35584, objectstack-ai/cloud#4905. Not governed: the area lands after the delta passes.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 3bbf1a9817cfeb7b09d0a60b34eb78fbcf58747a
Local-runs: none
Scope: packages/spec/src/system/constants/platform-tool-names.ts + packages/mcp/src/mcp-http-tools.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/mcp-file-tools.test.ts, packages/runtime/src/domains/mcp-package-docs.ts, packages/runtime/src/domains/mcp.ts

Delta d1 on PR #35564, card #35442, over the record in comment 7014988834 (head 1e43fdb1bc52ad397deba3e7735a27a55af3f73c). Read: the one commit between the two heads, the PR body as it now stands, the dev delta (card comment 7016521809), the final-head comment 7016546315, and the check-runs on this head.

What moved: one commit, 3bbf1a9817, whose only parent is the reviewed head. No merge of main is on the branch. It changes five files: the changeset, packages/mcp/README.md, packages/mcp/src/mcp-http-tools.ts, packages/runtime/src/domains/mcp-package-docs.ts and its test. The hits file, mcp-server-runtime.ts, mcp.ts, mcp-file-tools.test.ts, the mcp tool-layer test and the route-envelope row are byte-identical to the reviewed head, so the first record's reading of them stands. main has moved 14 commits since the branch's merge base; none touches a path of this PR or a file the first record read to judge it, and GitHub reports the PR mergeable and clean.

Check-runs on this head: 73 runs, 59 success, 13 skipped, none failed, one cancelled. The cancelled one is a PR-body guards run the body edit superseded; its rerun is success. Of the eleven required contexts ten are success and Lint UI is skipped, the diff holding no ui/ path.

① Derived judgments

  1. No accept-set and no public-surface change in the delta. Right: the two tool names, their input schemas, the registration gate and MCP_DOOR_TOOL_NAMES are untouched. What changed on the door is two description strings.
  2. The sort is unchanged; the texts moved to it. Right: searchPackageDocs still orders by matched.length * 10 + the place sum, then title.
  3. Heading recognition changed with the parse. Right, and narrower in one way and wider in another, both stated below in ④: a bare # line no longer takes the next line as its text, and a # line counts at any indentation. Either can move a hit's matchedOn, its heading and a label-less page's title against the reviewed head. Nothing on main is compared, the feature being new.
  4. The caller the gate is asked about is unchanged. Right: mcp.ts is untouched, and the texts now say whose holdings are read.

② Semver level

Clause-②: yes — agreed, unchanged. The line stands on the PR body and in the changeset.

The changeset's frontmatter is untouched: patch on @objectstack/mcp, @objectstack/runtime and @objectstack/spec, which still matches what the diff publishes. Metadata-protocol: none still holds. Its three rewritten bullets agree with the tree: the order, the url "where the page has one", and the OAuth limit. Check Changeset is success on both of its runs.

③ Boundary flags

The dev delta raises no open question. The three items the first record escalated:

  • Host instructions win. Answered: the cloud carrier is filed as objectstack-ai/cloud#4905, nested under the card.
  • Live acceptance after merge. Answered: the body now reads Part of objectstack-ai/objectstack#35442, and says the card stays open for the cloud carrier and the live acceptance. The card is open.
  • Whose holdings a docs audience is asked about on a delegated token. Answered by the seat: the envelope is kept, which is the stricter of the two arms and widens nothing. The other arm, the delegating person's own sets, is carried as mcp: on an OAuth grant, read the docs audience against the delegating person's own permission sets, not the token's ceiling #35584 for its own decision.

SQL push-down: the delta adds no SQL and no id materialisation. No finding.

④ Design judgment

packages/spec/src/system/constants/platform-tool-names.ts (the hits file). Unchanged; holds as recorded.

packages/mcp/src/mcp-http-tools.ts. Both descriptions and the registerPackageDocTools jsdoc now agree with the code, sentence by sentence: more of the terms first, then where the terms sit, then title; a url only where the page has one; and, on an OAuth connection, the connection's grant and not the person's own permission sets. The McpDataBridge jsdoc says the same of the principal.

packages/runtime/src/domains/mcp-package-docs.ts. The header states the order as it runs (the count, then the sum of title 3, heading 2, text 1, then title), names the caller as the request's execution context, says what that is on an OAuth grant and that it fails closed, and no longer claims parity with mcp-authoring.ts. The heading parse is now one pass over the page's lines (headingsOf), each line read by index (headingTextOf): one to six #, a space or tab on the same line, the text, a closing run dropped when a space precedes it. It agrees with its jsdoc and with the header's "line-based and linear". A line holding only # is no heading, and a heading can no longer take its text from the next line. Headings are computed once per page text and reused for the title, the heading match and the heading above a text match.

packages/runtime/src/domains/mcp-package-docs.test.ts, read as the pin of the stated limit. The agent case hands the dispatcher an envelope with principalKind: 'agent', the person as onBehalfOf and a ceiling set as permissions, over a security fake that keeps the resolver's agent arm, and holds that the permission-set page is neither found nor read though the delegator holds the set. It would go red if the bridge handed the gate the delegator, which is the ablation the dev delta reports. Two more cases pin the parse: a very long heading line, and a bare # line followed by text.

packages/mcp/src/mcp-server-runtime.ts, packages/runtime/src/domains/mcp.ts, packages/mcp/src/mcp-file-tools.test.ts. Unchanged; hold as recorded.

S1: closed
S2: closed
N1: closed

N2 and N3 are untouched and stay as nits, left or for a follow-up.

No must-fix, no should-fix.

N4 (nit) — the agent case's ceiling set is spelled mcp_agent_read; the spec's constant is mcp_agent_data_read (MCP_AGENT_PERMISSION_SET_READ). The fake answers whatever the envelope carries, so the verdict does not depend on the spelling. Left, or the constant imported in a follow-up.

N5 (nit) — headingTextOf trims the line first, so a # line counts at any indentation, an indented code line included; the form it replaces counted only at column 0. It can move matchedOn and the title fallback for such a line and nothing else. Left.

N6 (nit) — the stated order (the count before the place sum) holds for up to six distinct terms, since one score carries both. The door caps terms at five; the bridge member itself sets no cap. Left.

Implemented-by: claude/project-thread-3ozbh4
Reviewed-by: isolated-l2-35564

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CY9JfbUzkuca2gUyu6

Landing · ACCEPT (L1-a) → PR #35564 comment 7014557265 · L2 PASS 7014988834 + delta PASS 7016747283 · head 3bbf1a98 · 2026-11-19T17:28Z

Probe Reading
check-governed-merges --pr 35564 0 of 11 paths governed; 1338 lines ≤ 3000 → ordinary queue landing
check-runs on 3bbf1a98 59 success, 13 skipped, 0 failure (one body-guards run cancelled by the body edit, superseded by its own success); mergeable_state clean

Area ai-1 landing armed (ready + auto-merge). The PR is Part of objectstack-ai/objectstack#35442: the card stays open for objectstack-ai/cloud#4905 (cloud carrier) and the live acceptance; #35584 is its other follow-up.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 17:29
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 53c9575 Nov 19, 2026
73 of 74 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-3ozbh4 branch November 19, 2026 18:03
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…person's own permission sets (objectstack-ai#35888)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDxdrYJq965rUfrZBso8FS3)_
Fixes objectstack-ai#35584
Clause-②: yes — widening: on a delegated agent token whose scope reaches
the docs tools, a permission-set-gated package doc is now found and read
when the delegating person holds that set (ADR-0090 D10, ceiling ∩
delegator); nothing served today is refused, a non-holder and a token
without docs-tool access still see nothing. Seat runs a contract read
before ready; security#2 checks the head read-only before merge.
Metadata-protocol: none

## 维护者速读
- 用户能看到什么变化:用户通过自己的 AI
助手授权登录后,助手能搜到、读到只给某个权限集看的应用手册——前提是本人持有这个权限集,且这次授权包含读数据的范围;其他人和其他手册不变。
- 为什么做:外部 AI 助手接入平台这条线上的遗留问题(应用手册查询的后续);本人在控制台能看的手册,在自己的助手里却搜不到。
- 出错会怎样:碰到的是通过授权登录使用 AI
助手查手册的人;最坏是该看的手册仍看不到,或权限集手册多给了不持有的人看;改动只在一处读权限的地方,可直接撤回。
- 要你做什么:无。

## What changes

On an OAuth MCP connection the request is an agent acting on behalf of
the person who consented (ADR-0090 D10). `search_package_docs` and
`read_package_doc` read every page through the `/meta/doc` docs-audience
gate; for a manual whose audience is `{ permissionSet }`, the gate asks
the security service for the caller's permission-set names. Until now
that caller was the agent envelope, whose sets are the token's
scope-derived ceiling, so a manual restricted to a set the person holds
was neither found nor read on that connection.

- `packages/runtime/src/domains/mcp-package-docs.ts`:
`packageDocsReadGate` takes the data engine. On a delegated agent
envelope (`principalKind: 'agent'` with `onBehalfOf.userId`), the
holdings the audience reads are the person's own:
`resolveUserAuthzGrants` in the request's organization (`tenantId`), the
grant resolution the open draft door uses, without that door's
`manage_metadata` admission. It fails closed the way the security
plugin's delegator resolution does: no `sys_user` row, no current
membership in the organization (`vetOrganizationClaim`), or a read that
throws leaves the person with no set, so permission-set audiences stay
closed. The envelope's ceiling sets are never read for the audience and
never unioned in. Holdings are resolved once per gate, and only when a
permission-set audience is in play. A non-delegated principal (session,
API key, AI service account) is unchanged.
- `packages/runtime/src/domains/mcp.ts`: the docs seam rides the bridge
only where the grant reaches the docs tools (no grant, or `data:read`).
`packageDocToolsServed` in `@objectstack/mcp` stays the authority on
listing; the runtime reads the same condition so a token that cannot
reach the tools never has the person's holdings read. The bridge call
site hands the gate this request's data engine.
- PR objectstack-ai#35564's stated limit: the helper header (`mcp-package-docs.ts`) no
longer says the envelope's ceiling is the caller, and the test header
and the pin are rewritten to match. The pending objectstack-ai#35442 changeset is
corrected (below).
- `packages/mcp/src/mcp-http-tools.ts`, text only (commit 3dae06c,
under the amended claim): the `registerPackageDocTools` docblock, the
`searchPackageDocs` bridge-member docblock and both tool descriptions
now say that on an OAuth connection whose grant reaches the docs tools,
the docs audience is the delegating person's own permission sets, never
wider. Each description is shorter than before (`tools/list` weight,
objectstack-ai#34689): `search_package_docs` -25 bytes (100 to 75 for the changed
sentence), `read_package_doc` -29 bytes (93 to 64). No behaviour
changes; no test pins either string.
- Changeset `.changeset/35584-delegated-docs-audience.md`
(`@objectstack/mcp` and `@objectstack/runtime`, patch).

**DELIBERATE CORRECTION** of a pending release note:
`.changeset/35442-mcp-app-docs-tools.md` (unreleased). Its sentence
about OAuth grants now reads: "On an OAuth grant the request is an agent
acting for the person who consented, and a permission-set audience is
read against that person's own permission sets (ADR-0090 D10), never the
token's scope-derived sets." The dropped sentence ("Both tool
descriptions say so.") no longer holds. `check-empty-changeset` is red
on this by design; the dispatching seat's record confirms it.

**Pin flipped in place** (`mcp-package-docs.test.ts`): "on an OAuth
grant the caller is the agent: the page is neither found nor read though
the delegator holds the set" answered CLOSED for a holder; it is
replaced by "the holder of the set finds and reads the page", which
answers OPEN. Card objectstack-ai#35584, maintainer ruling A.

## Ruling conditions

| Condition (ruling A) | Pin in
`packages/runtime/src/domains/mcp-package-docs.test.ts` |
|:--|:--|
| 1. The token's scope must still reach the docs tools. | `a token whose
scope does not reach the docs tools is carried no docs member, whatever
the person holds` (person holds the set; token `metadata:write` +
`actions:execute`; both members absent, scopes passed unchanged to the
MCP runtime) |
| 2. Delegator's own holdings by grant resolution; fails closed for a
missing person or one outside the organization; never a union; AI
service accounts keep their own sets. | `the holder of the set finds and
reads the page…`; `fails closed: a person with no user row, or with no
membership in the request's organization, holds no set`; `no union: a
manual whose audience is a set only the token's ceiling carries stays
closed`; `an AI service account keeps its own sets` |
| 3. Keep the non-holder control; a token that cannot reach the docs
tools finds and reads nothing. | `control: a person who does not hold
the set in the token's organization neither finds nor reads it` (new,
OAuth); the session pair `a page only a permission-set manual claims is
neither found nor read without the set` / `control: the holder…` kept;
the scope pin above |
| 4. security#2 does a read-only check of the head before merge. | Not a
code pin: security#2 checks this PR's head read-only before merge. |

Default-audience pages are unchanged: every OAuth pin asserts the
default page `crm_order_payment` is still found, including the
fail-closed and no-union cases.

## Clause-② reading

Widening only. Nothing served today is refused: the change opens
permission-set manuals to a delegated token whose person holds the set
and whose scope already reaches the tools. Every answer that was CLOSED
for a non-holder stays CLOSED, and a token without `data:read` was
already listed neither tool by the MCP runtime, so dropping the seam
from its bridge changes nothing it is served.

## Verification

- Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2 src/domains/mcp-package-docs.test.ts` — 18 tests pass.
- Files to read first, by risk: `mcp-package-docs.ts`
(`packageDocsReadGate`, `delegatorHoldingsCaller`), `mcp.ts` (the
`packageDocs` scope condition), the new describe block in the test.

<details><summary>Ablation (each leg mutated on disk through
scripts/ablation-replace.mjs, then restored; HEAD blob hashes
re-matched)</summary>

- A1 user-row check removed: red on `fails closed…` (1 failed / 17
passed).
- A2 membership vet removed: red on `fails closed…` (1 / 17).
- A3 delegated person not resolved (the old envelope behaviour): red on
`the holder…` and `no union…` (2 / 16).
- A4 union of the person's sets with the envelope's ceiling: red on `no
union…` (1 / 17).
- A5 scope condition removed in `mcp.ts`: red on `a token whose scope
does not reach the docs tools…` (1 / 17).
- After restore: `git diff HEAD` empty; `mcp-package-docs.ts` 2334108
and `mcp.ts` f101e59 equal their HEAD blobs.
</details>

<details><summary>Local runs at head 3dae06c (origin/main 8145424
merged in, then the mcp text commit)</summary>

- Closure build `pnpm --workspace-concurrency=2 --filter
'@objectstack/mcp^...' --filter '@objectstack/runtime^...' build`:
VERDICT command-exit 0.
- `vitest run src/domains/mcp-package-docs.test.ts` (runtime): 18 passed
(18). `vitest run` of the mcp doc-tool, tools-list weight and initialize
selection-rule files: 3 files, 26 passed (26).
- `pnpm --filter @objectstack/mcp test`: Test Files 82 passed (82),
Tests 1452 passed (1452). `pnpm --filter @objectstack/mcp typecheck` and
`pnpm --filter @objectstack/runtime typecheck`: VERDICT command-exit 0
(`check:test-typecheck: OK` for both).
- `dispatch-gates --commands` (68 families, change set vs merge base
8145424), exit codes captured before any pipe: 66 exit 0;
`check-empty-changeset --base origin/main` exit 1 (only
`.changeset/35442-mcp-app-docs-tools.md`, the DELIBERATE CORRECTION, red
by design); `check:dual-build-cjs-loads` exit 3 PREREQUISITE NOT MET
(needs a whole-repo build), NOT MEASURED. `--ran` reconciliation: 68
derived, 67 run, 1 NOT-MEASURED. After the changeset line for
`@objectstack/mcp` was added, the changeset, nul-byte, citation,
closing-keyword and affected-docs gates were re-run on the final head:
same answers.
- `overlap-check --branch=claude/area-a4C-35584`: exit 1, the only
overlap the bot's Version Packages PR objectstack-ai#35129 on
`.changeset/35442-mcp-app-docs-tools.md`; `origin/main` merges cleanly.
- Full runtime suite not re-run this round (runtime code unchanged since
942869d); CI runs it.
</details>

<details><summary>Earlier local runs (head 942869d; code identical to
ea97649, the commit after which only a changeset changed)</summary>

- Closure build `pnpm --workspace-concurrency=2 --filter
'@objectstack/runtime^...' build`: VERDICT command-exit 0.
- `pnpm --filter @objectstack/runtime typecheck`: exit 0
(`check:test-typecheck: OK`).
- `pnpm --filter @objectstack/runtime test` (code tree ea97649): Test
Files 634 passed (634); Tests 11712 passed, 25 skipped (11737); VERDICT
command-exit 0.
- `dispatch-gates --commands` (68 families), each run with its exit code
captured: 65 exit 0; `check-empty-changeset --base origin/main` exit 1
(the DELIBERATE CORRECTION above, red by design); NOT MEASURED, exit 3
PREREQUISITE NOT MET: `check-plugin-teardown-shape --self-test` (shallow
clone cannot reach its pinned fixture commit) and
`check:dual-build-cjs-loads` (needs a whole-repo build). `--ran`
reconciliation: 68 derived, 66 run, 2 NOT-MEASURED, 0 UNRUN.
- `overlap-check --branch=claude/area-a4C-35584`: exit 1, the only
overlap being the bot's standing Version Packages PR (objectstack-ai#35129), which
consumes `.changeset/35442-mcp-app-docs-tools.md`; it is regenerated
from `main`.
</details>

## Round 3 (seat S1/S2)

Head `183bed4d56`, text only, two files:

- **S1** `packages/mcp/README.md`: the bridge paragraph now says that on
an OAuth connection whose grant reaches the docs tools, a permission-set
audience is read against the delegating person's own permission sets,
never wider. A search of the head for the old sentence ("judged on the
token's grant", "caller is the agent", "person's own permission sets")
outside CHANGELOGs found no other stale copy.
- **S2** `.changeset/35584-delegated-docs-audience.md`, second bullet:
the organization sentences use the seat's wording verbatim (the
organization the request runs in: the one the token's consent bound,
while the membership there is current; no user row holds no set; an
ended membership is read with no active organization, so no grant stored
in an organization applies). No `Regen-provenance:` line is added to the
changeset: that line is a seat-posted thread pointer
(`scripts/pm/record-recognisers.mjs`), not changeset text.
- Nits: nit a (a second membership pin through `oauthEnvelope`) was
drafted but not verified before the handover stop, so it is not in this
head. Nit b was not done: `packageDocsReadGate` has no logger, so it
would take more than one line per arm. Nit c skipped, as the order says.
- Not re-run this round: the closure build was stopped for the handover,
so the runtime and mcp tests, typecheck and derived gates are NOT
MEASURED on this head. No code changed; CI runs them. `check-nul-bytes`:
OK. `overlap-check`: exit 1, the same Version Packages PR objectstack-ai#35129 overlap
on `.changeset/35442-mcp-app-docs-tools.md` as before; `origin/main`
merges cleanly.

## Acceptance notes

- Holdings are resolved through `resolveUserAuthzGrants` directly in
`mcp-package-docs.ts` rather than via a helper shared with
`mcp-authoring.ts`: that file is outside this PR's claimed surface, and
its reader is admitted on `manage_metadata`, which the ruling says must
not apply here. The two readers now share the grant call, not the
admission.
- The scope condition (`data:read`, or no grant) is spelled once more in
the runtime beside `packageDocToolsServed`, as the draft door reads
`metadata:write` beside `grantsAuthoringTools`. If the MCP runtime's
docs family ever changes, both must move.

Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#4 · os-elon-musk ·
session_016WV4d1k1GRsQbF3vCPKxhz -->

---------

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 protocol:system size/xl 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