Skip to content

fix(mcp): record data faces serve the /data door's declaredCode and userMessage - #31405

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-mtu202
Nov 8, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-mtu202

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #31373

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:MCP 的六个记录数据工具、delete_records 的选择读取和记录资源,在按 /api/v1/data 门的回答作答时,把门给出的 declaredCode 和 userMessage 也一并带上(排在 status 之后,门没给就不出现),和 run_action / resume_run 的写法一致。
  • 为什么改:mcp: the record data tools and the record resource serve a declared 5xx refusal's own sentence, where /data withholds it ('Internal server error') #31341 之后,应用自己未注册的码配 5xx(例如 VENDOR_DOWN / 503)在这些面上只剩封闭码 SERVICE_UNAVAILABLE,/data 门却还在 declaredCode 里给出 VENDOR_DOWN;生产者标注的 userMessage 也被丢掉。智能体拿到的比 REST 门少。
  • 风险与回滚:只改 @objectstack/mcp,patch。两个成员都从门的回答体里读,不另写降级规则。声明了 4xx 以下状态的带码拒绝不走门的回答,逐字节不变;元数据工具和 list_actions 的回答不变(新增 CONTROL 钉住)。回滚即还原本 PR。
  • 先看:packages/mcp/src/mcp-http-tools.ts 的 dataDoorAnswerOf 和 metaDoorErrorResult 的返回行;mcp-server-runtime.ts 记录资源的 catch。
  • 两分钟验证:pnpm --filter @objectstack/mcp exec vitest run src/mcp-coded-refusal.test.ts -t 31373,预期 14 个用例全部通过。
  • 需要你做的:无,席位落地。

What changes

dataDoorAnswerOf (packages/mcp/src/mcp-http-tools.ts) reads the /api/v1/data door's answer (mapDataError). It now also reads the door body's declaredCode and userMessage, each only when the door serves a non-empty string. No second demotion rule: the values are the door's.

No export added; dataDoorAnswerOf is not on packages/mcp/src/index.ts, and the @objectstack/types import line is unchanged.

Measured on main (03533d2c): which throws reach the door-answer path with these members

mapDataError(v, 'task') on the built @objectstack/types, and the path the faces take (door answer vs the coded envelope, per dataDoorRefusalEnvelope):

Throw Path /data answer
VENDOR_DOWN / 503 door 503 SERVICE_UNAVAILABLE, declaredCode: VENDOR_DOWN
VENDOR_DOWN / 503, refusal: true door same, plus the sentence
MY_FAULT / 500 door 500 INTERNAL_ERROR, declaredCode: MY_FAULT
any door-path throw with userMessage (coded 5xx, SQLITE_BUSY, bare Error, code-less { status: 409 }, code-less sandboxed abort) door the door's answer plus userMessage
SERVICE_UNAVAILABLE / 503, SQLITE_BUSY, VENDOR_DOWN with no status, bare Error, code-less statuses, sandboxed abort or crash door no declaredCode
LEAVE_EXHAUSTED / 409 (declared below 500) envelope 409 RESOURCE_CONFLICT, declaredCode: LEAVE_EXHAUSTED (out of scope, see below)
PERMISSION_DENIED (no status) with userMessage envelope 403, plus userMessage (out of scope, see below)

So declaredCode reaches these faces for an unregistered code with a declared 5xx, and userMessage for any door-path throw that carries one. A code-less throw never gets a declaredCode from the door (there is no code to demote).

Tests

packages/mcp/src/mcp-coded-refusal.test.ts:

Red first and ablations

Red first on 03533d2c (main), the new pins in place and no fix: mcp-coded-refusal.test.ts gave Tests 11 failed | 154 passed (165): the 7 per-face VENDOR_DOWN rows, the two userMessage tool rows, and the two resource rows. Every CONTROL passed. The metadata CONTROL, added after, passes on main and with the fix (166 passed).

Ablations via node scripts/ablation-replace.mjs on the committed head; each printed ok mutation landed and then ok restored: blob == HEAD (31cfe9000bac) and git diff HEAD is empty:

  1. The declaredCode member deleted from dataDoorAnswerOf. Blob 31cfe9000bac -> 9d6f5ee51eae, Tests 10 failed | 156 passed (166): the 7 per-face rows, the tool userMessage row (it asserts both members), and the two resource rows.
  2. The userMessage member deleted. Blob 31cfe9000bac -> f5974c669fdb, Tests 3 failed | 163 passed (166): the two tool userMessage rows and the resource userMessage row.
  3. metaDoorErrorResult put back to codedErrorResult(door). Blob 31cfe9000bac -> 06f1b65913eb, Tests 1 failed | 165 passed (166): the metadata CONTROL.

A first attempt at ablations 1 and 2 used an empty --replacement, which the tool refused (replacement count moved 0 -> 0) and restored; they were re-run with --delete. The tests import the package's source, so no dist/ is involved.

Acceptance notes

Verification

Base 03533d2c; head 2fbd1084.

  • pnpm --filter @objectstack/mcp test (vitest run, --maxWorkers=2): Test Files 60 passed (60), Tests 895 passed (895).
  • pnpm --filter @objectstack/mcp typecheck: exit 0 (check:test-typecheck: 6 files / 53 errors / 8 pinned signatures held).
  • eslint --no-inline-config packages/mcp: exit 0. @objectstack/mcp has no lint script.
Derived gates (node scripts/pm/dispatch-gates.mjs --commands, 65 commands, all on 2fbd108)
  • node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
  • node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
  • node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
  • node scripts/check-closing-keyword-parity.mjs :: exit 0
  • node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
  • node scripts/check-comment-mask-adoption.mjs :: exit 0
  • node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
  • node scripts/check-comment-mask-corpus.mjs :: exit 0
  • node scripts/check-dts-emitted.mjs --self-test :: exit 0
  • node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
  • node scripts/check-empty-changeset.mjs --self-test :: exit 0
  • node scripts/check-issue-citations.mjs :: exit 0
  • node scripts/check-plugin-teardown-shape.mjs :: exit 0
  • node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
  • node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
  • node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
  • node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
  • node scripts/ci/snapshot-next.mjs --self-test :: exit 0
  • node scripts/docs-audit/check-affected-docs.mjs :: exit 0
  • node scripts/docs-audit/check-drift-comment.mjs :: exit 0
  • node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
  • node scripts/release-pending-publish.mjs --self-test :: exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
  • pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
  • pnpm check:adr-symbol-anchors :: exit 0
  • pnpm check:changeset-gate-self-tests :: exit 0
  • pnpm check:ci-filter-parity :: exit 0
  • pnpm check:closed-ceremony-text :: exit 0
  • pnpm check:cross-package-test-inputs :: exit 0
  • pnpm check:dispatcher-error-vocabulary :: exit 0
  • pnpm check:doc-authoring :: exit 0
  • pnpm check:driver-memory-census :: exit 0
  • pnpm check:dts-closure :: exit 0
  • pnpm check:engine-double-contract :: exit 0
  • pnpm check:error-status-conformance :: exit 0
  • pnpm check:gitlink-declared :: exit 0
  • pnpm check:issue-citations :: exit 0
  • pnpm check:keyed-text-bounds :: exit 0
  • pnpm check:logger-receiver-detach :: exit 0
  • pnpm check:nul-bytes :: exit 0
  • pnpm check:object-def-param-keys :: exit 0
  • pnpm check:objectql-double-limit :: exit 0
  • pnpm check:optional-error-sink :: exit 0
  • pnpm check:org-identifier :: exit 0
  • pnpm check:page-declaration-shape :: exit 0
  • pnpm check:platform-object-tenancy-census :: exit 0
  • pnpm check:published-files :: exit 0
  • pnpm check:query-options-erasure :: exit 0
  • pnpm check:refd-timer-probe :: exit 0
  • pnpm check:registry-log-declared :: exit 0
  • pnpm check:rest-log-spy-declared :: exit 0
  • pnpm check:settings-bind-window :: exit 0
  • pnpm check:slot-lookup :: exit 0
  • pnpm check:sourcemap-no-sources-content :: exit 0
  • pnpm check:system-context-census :: exit 0
  • pnpm check:test-source-alias :: exit 0
  • pnpm check:tier-file-adoption :: exit 0
  • pnpm check:type-check-coverage :: exit 0
  • pnpm check:type-check-debt :: exit 0
  • pnpm check:undeclared-dep-imports :: exit 0
  • pnpm check:vouch-for-reference-callers :: exit 0
  • pnpm check:watch-hint-literal :: exit 0
  • pnpm check:where-matcher :: exit 0
  • pnpm check:lean-entry-closure :: exit 0
  • pnpm check:dual-build-cjs-loads :: exit 0

node scripts/pm/dispatch-gates.mjs --ran: 65 derived famil(ies) accounted for — 65 run, 0 NOT-MEASURED (a DERIVED zero — all 65 recorded an exit code and none of them is 3). Every command exited 0 on its first run; check:lean-entry-closure and check:dual-build-cjs-loads were run last, after check:type-check-debt had built every package, and check-plugin-teardown-shape --self-test after git fetch --depth=1 of its pinned fixture commit. Each command ran with stdin from /dev/null, exit captured before any pipe.

Not run locally (CI's): test:repo, the dogfood shards, the type-check lanes.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint on the package.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5mdwfFCbsFQ62JJ8P5

…serMessage

The six record data tools, delete_records' selection read and the record
resource render the /api/v1/data door's answer for a fault or a code-less
throw, but read only its code, sentence and status. The door also serves
declaredCode (an unregistered code it demoted to the closed code) and a
producer's userMessage. dataDoorAnswerOf now reads both off the door's body,
and these faces render them after status, as run_action does. The metadata
tools keep their answer.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5mdwfFCbsFQ62JJ8P5
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/frontend/plugins/plugin-chatbot.mdx (via userMessage (symbol, a field of interface DataDoorAnswer))
  • content/docs/permissions/system-context.mdx (via describeEffectiveAccess (sdk, the bare tail of client method security.describeEffectiveAccess, bound to GET /api/v1/security/users/:id/effective-access))
  • content/docs/protocol/kernel/error-handling.mdx (via declaredCode (symbol, a field of interface DataDoorAnswer), userMessage (symbol, a field of interface DataDoorAnswer))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-1.mdx (via declaredCode (symbol, a field of interface DataDoorAnswer), userMessage (symbol, a field of interface DataDoorAnswer))
  • content/docs/releases/v17/17-4.mdx (via userMessage (symbol, a field of interface DataDoorAnswer))
  • content/docs/releases/v17/index.mdx (via userMessage (symbol, a field of interface DataDoorAnswer))
  • content/docs/releases/v18/18-1.mdx (via userMessage (symbol, a field of interface DataDoorAnswer))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 64 of 227 client-bound route-ledger rows — the other 163 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 163: 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; 104 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 3a0aa915ae0e3838e93beace25bf14d116f3f596 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 3a0aa915ae0e3838e93beace25bf14d116f3f596

⚠️ 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 3a0aa915ae0e3838e93beace25bf14d116f3f596 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added 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 8, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ

席位核对 · ACCEPT · 2026-11-08T06:44Z · head 2fbd1084f5904f145f4effd8e6effb8ddcd0f98b

Seat domain:server#6 reviewed the diff of its own dispatch (claim 6717847895 on #31373, card thread session_01FEkQ5mdwfFCbsFQ62JJ8P5, report 6718161334). Read against GitHub, not the report.

  1. Shape: 4 files, +225 / -20. dataDoorAnswerOf (mcp-http-tools.ts) now also reads declaredCode and userMessage off mapDataError's body (non-empty strings only), so the six record data tools and delete_records' selection read render { code, message, status, declaredCode?, userMessage? } through the existing codedErrorResult, whose type already declares both members. The record resource catch (mcp-server-runtime.ts) adds the same two after status. No second demotion rule, no new export, no import change. metaDoorErrorResult shares the reader, so it now passes code / message / status explicitly and the metadata tools and list_actions answer exactly as before. Body says Fixes #31373; no other closing keyword.
  2. Premise: red first on main 03533d2c: 11 failed / 154 passed with the new pins and no fix (7 per-face VENDOR_DOWN / 503 rows, 2 tool and 2 resource userMessage rows; every CONTROL green). Ablations, each restored to HEAD: declaredCode deleted, red 10; userMessage deleted, red 3; metaDoorErrorResult back to codedErrorResult(door), red 1 (the new metadata CONTROL). PR fix(mcp): record data faces withhold a declared 5xx's sentence as /data does #31371's VENDOR_DOWN row moved, as the order said.
  3. Measured set (accepted): on the door-answer path declaredCode arrives only for an unregistered code with a declared 5xx; no code-less throw gets one. userMessage arrives for any door-path throw that carries one, a fault's included, which is what /data serves (mapDataError rides a bounded userMessage onto every answer).
  4. Gates / check-runs: dev: mcp 60/60 files (895 tests), typecheck exit 0, eslint exit 0, 65/65 derived gates exit 0 (0 NOT-MEASURED). CI on 2fbd1084: 35 success, 13 skipped, 0 failure. mergeable_state clean, and the head merges cleanly with current main.
  5. Contract review: Clause-②: no (re-declared from measurement: packages/mcp/src/index.ts and the @objectstack/types import line are unchanged; the record faces gain members the MCP tool error already declares and run_action already serves), no packages/spec/src path, and check-owed-reviews lists no owed review for this PR: none owed.
  6. Out of scope: the dev's findings 1 and 2 (an unregistered declared-4xx code such as LEAVE_EXHAUSTED / 409 keeps its own spelling, and a refused status-less code drops its userMessage, on the envelope path, where /data answers the closed code with declaredCode and serves userMessage) are filed as mcp: the record data tools keep an unregistered declared-4xx code and drop a refusal's userMessage, where /data answers the closed code with declaredCode and serves userMessage (LEAVE_EXHAUSTED / 409) #31407. Finding 3 (delete_records' outer catch) is the mcp: the data tools answer an undeclared sandboxed hook abort with no code and the sandbox wrapper text, where /data answers 400 HOOK_ABORTED #31218 / mcp: a CODED sandboxed hook refusal still answers the sandbox wrapper text with the hook's name, where /data answers the body's sentence — and the other MCP tools still render a throw unlike REST #31246 design and is not carried. Metadata-protocol: none; Skills-docs: not owed. Changeset patch for @objectstack/mcp.
  7. Landing: check-governed-merges --pr 31405: not governed, 245 changed lines. Landing on the maintainer's standing words 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z) and 「你应该使用 pm-dispatch 技能审核和落地pr」 (2026-11-07T16:59Z). Relay pr_ready, then automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 8, 2026 06:45
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 8, 2026 06:45
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit e6a0b72 Nov 8, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-mtu202 branch November 8, 2026 07:05
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.

mcp: the record data tools and the record resource drop declaredCode, where /data serves an unregistered code's spelling there (VENDOR_DOWN / 503)

1 participant