Skip to content

fix(types): /actions answers a driver string code as the /data door's fault - #31397

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-2n2fmy
Nov 8, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-2n2fmy

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

domain:server#3 · os-project-manager · session_01FEkQ5nBSzc6ktJyjdFcDb3

Fixes #31317

Clause-②: no (a driver fault inside an action body moves from 400 VALIDATION_ERROR to the 5xx fault /data already answers: a status/code correction on an error answer, not a widening; measured from the real diff, no accepted input and no success shape changes)
Metadata-protocol: none

维护者速读

  • 改了什么:动作体里抛出带驱动自身字符串 code 的错误(如 SQLITE_BUSY、ECONNREFUSED)且没有声明 HTTP 状态时,POST /api/v1/actions 现在回 /api/v1/data 同样的服务器故障(SQLITE_BUSY 是 500 DATABASE_ERROR / Internal data error),不再回 400 VALIDATION_ERROR 并把驱动 code 放进 declaredCode。MCP 的 run_action / resume_run 跟着 /actions 一起变。
  • 为什么改:同一个数据库故障在两个门上一个说「客户端请求错了」、一个说「服务器出错」,而且 /actions 把驱动名和驱动原文暴露给了调用方;重试、告警、网关错误率都看不到这类故障。
  • 风险与回滚:只动「没声明状态、code 不在 ADR-0112 封闭词表里、且 /data 判为 5xx」这一类;封闭 code(RECORD_LOCKED 等)、裸 Error、带状态的抛错、沙箱动作体的带 code 拒绝都照旧是 400(有对照 pin)。代价:进程内动作处理器抛自造 code 且不带状态,会变成 500 并丢 code([Decision] Is ADR-0112's declaredCode channel in scope for 5xx sanitisation at all — and the answer must be applied to all three doors at once #12509 裁决的既定代价,带上状态即可保留)。runtime 559 个测试文件、mcp 60 个、types 38 个全绿。回滚即还原本 PR。
  • 先看:packages/types/src/actions-door-answer.ts 新增的 Arm 6(判定只用 demotedDeclaredCode + /data 的 mapDataError,不另抄一份),packages/runtime/src/domains/actions-driver-code-fault-parity.test.ts,packages/mcp/src/mcp-coded-refusal.test.ts 改动的那一行。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/domains/actions-driver-code-fault-parity.test.ts(先 build @objectstack/types),预期 7 条全绿;其中 3 条在 main 上是红的(expected 400 to be 500)。
  • 需要你做的:无,席位落地。

What changes

  • @objectstack/types actionsDoorAnswerOf: a new arm between the unexpected-fault arm and the 400 rejection. When a throw that declared no status spells a .code that is not a closed ADR-0112 code, it asks the /data door's own classifier, mapDataError(err, objectName), and when that door answers a server fault (isServerFault), /actions answers that door's status, code and sentence. Nothing the throw carried rides along (no declaredCode, no details); the full text is logged as a driver fault (CODE): … operator line.
    • The predicate that tells the two classes apart, and where it already lives: demotedDeclaredCode(resolveThrownHttpError(err, 400)) !== undefined (@objectstack/types thrown-http-error.ts). It is the read that put the driver spelling into /actions' declaredCode, and it is present exactly when the code is not a closed vocabulary member. A closed code (RECORD_LOCKED, PERMISSION_DENIED) is not demoted, so it stays the rejection. The fault/refusal decision itself is mapDataError (data-error-classification.ts) plus isServerFault (server-fault-log.ts), the reads /data answers with. ⛔ No copy of either.
    • The module note's arm list gains the new arm (the rejection becomes arm 7), and the ⚠️ paragraph that recorded the /actions-vs-/data difference is removed, since the difference is gone.
  • @objectstack/mcp: comment only. errorResultFromThrown's ⚠️ paragraph about the driver-code difference now says the two doors agree. No code change: the MCP action tools already answer through actionsDoorAnswerOf.
Thrown inside an action body /actions and MCP run_action before after (= /data)
{ code: 'SQLITE_BUSY' }, text SQLITE_BUSY: database is locked 400 VALIDATION_ERROR, the driver text, declaredCode: SQLITE_BUSY 500 DATABASE_ERROR, Internal data error
the same from SqliteError same same
{ code: 'ECONNREFUSED' }, text connect ECONNREFUSED 127.0.0.1:5432 400 VALIDATION_ERROR, the text, declaredCode: ECONNREFUSED 500 INTERNAL_ERROR, Internal server error
CONTROL: closed code, no status (RECORD_LOCKED) 400 RECORD_LOCKED unchanged
CONTROL: bare Error 400 VALIDATION_ERROR, its sentence unchanged
CONTROL: unregistered code with a declared 409 409 RESOURCE_CONFLICT, declaredCode unchanged
CONTROL: sandboxed body, unregistered code, no status 400 VALIDATION_ERROR, declaredCode (/data answers 400 too) unchanged

Tests

  • New packages/runtime/src/domains/actions-driver-code-fault-parity.test.ts (7 rows): §1 three driver rows, one row per door. Each asserts the literal /actions wire answer through the real HttpDispatcher.handleActions, its equality with mapDataError on a fresh copy of the throw, no driver spelling or text anywhere in the body, and the operator line. §2 the four controls above.
  • packages/types/src/actions-door-answer.test.ts: the driver-string-code row moved from the old 400 answer to the fault answer with its operator line.
  • packages/mcp/src/mcp-coded-refusal.test.ts: the mcp: run_action and resume_run answer a code-less sandboxed action-body throw with the wrapper naming the body, where /actions answers 400 HOOK_ABORTED with the sentence #31271 SQLITE_BUSY case on run_action / resume_run moved to 500 DATABASE_ERROR with one operator log line; its block comment updated. The row still asserts equality with actionsDoorAnswerOf on a fresh copy.

Acceptance notes

  • Stated cost. An in-process (not sandboxed) action handler that throws its own unregistered code with no status, which /data also answers as a fault, now gets the fault here and loses the code: the 2026-08-27 ruling on [Decision] Is ADR-0112's declaredCode channel in scope for 5xx sanitisation at all — and the answer must be applied to all three doors at once #12509 (the discriminator is the status channel, never the code's spelling). It keeps its code by declaring the status it means. Measured for real callers: the runtime (559 files), mcp (60) and types (38) suites are green with no pin edited beyond the two above; SANDBOX_AUTHORED_LIMB (DUPLICATE, sandboxed) is untouched because /data answers sandboxed coded refusals 400; the sister repo hotcrm's coded refusals all declare a status (src/sales/objects/_refusal.ts). No caller found for whom the 400 reading is load-bearing.
  • Not moved: closed codes with no status. /data answers several of these as 500 (VALIDATION_ERROR, RECORD_LOCKED, CONFLICT with no status), /actions keeps its 400 with the code, per the order (only the driver-fault class moves). That remaining difference is noted, not filed.
  • Sibling runtime: MCP run_action answers an action with no handler 400 VALIDATION_ERROR, where /actions answers 404 — the bridge throws it uncoded #31330 (seat 6, thread oiz4q5) changes the uncoded No handler registered throw in action-execution.ts. That throw has no code, so the new arm never reads it; whoever lands second merges main and re-reads the other's pins.
  • Superseded changeset line. The pending 31271 changeset says the driver-code difference between /actions and /data is not changed; this PR's changeset supersedes that sentence and does not edit it.

Verification

Head 0b36be09 (base f4b4c8ae, origin/main eff90af6 merged once before opening).

Red first, fix, suites
  • Probe on base f4b4c8ae (mapDataError vs actionsDoorAnswerOf, scratch, not committed): SQLITE_BUSY: database is locked answered /data 500 DATABASE_ERROR and /actions 400 VALIDATION_ERROR + declaredCode: SQLITE_BUSY; ECONNREFUSED and 57P01 the same split with /data 500 INTERNAL_ERROR. Closed codes with no status (RECORD_LOCKED, PERMISSION_DENIED, VALIDATION_ERROR), a bare Error and a sandboxed CREDIT_LIMIT answered /actions 400 with their own code.
  • Red first, the new pin on base: actions-driver-code-fault-parity.test.ts Tests 3 failed | 4 passed (7), AssertionError: expected 400 to be 500 (the three §1 rows; §2 controls green). With the fix: 7 passed.
  • @objectstack/types vitest: Test Files 38 passed (38), Tests 881 passed (881).
  • @objectstack/runtime vitest (types from the rebuilt dist): Test Files 559 passed (559), Tests 10316 passed, 19 skipped. No runtime /actions pin edited.
  • @objectstack/mcp vitest: Test Files 60 passed (60), Tests 872 passed (872).
  • typecheck for @objectstack/types, @objectstack/runtime, @objectstack/mcp: exit 0 (runtime re-run on 0b36be09).
  • eslint --no-inline-config packages/types packages/runtime packages/mcp: exit 0; the edited test file re-run on 0b36be09: exit 0.
Ablation (ablation-replace, restored to HEAD)
  • packages/types/src/actions-door-answer.ts: the new arm's if (isServerFault(door.status)) { made never-true (&& String("ABL31317").length < 0). Mutation landed (anchor 1 to 0, blob e90d4eecf361 to 79160314fb55); pnpm --filter @objectstack/types build; ablation-dist-preflight @objectstack/types ABL31317: marker present in dist/index.js and dist/index.mjs. Runtime actions-driver-code-fault-parity.test.ts: Tests 3 failed | 4 passed (7), expected 400 to be 500.
  • Restore: blob == HEAD (e90d4eecf361), git diff HEAD empty, git status --porcelain empty; rebuilt types, preflight --absent: marker absent from all 12 built files; the pin 7 passed.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at f8f57861: 66 commands, each run with timeout 900, exit codes captured before any pipe. First pass: 64 exit 0; check:dual-build-cjs-loads exit 3 (prerequisite: not every dist built yet); check:test-source-alias exit 1 (the new pin reached @objectstack/metadata's lazy import through the dispatcher; fixed in 0b36be09 with a module-top import). Re-run on 0b36be09: check:test-source-alias exit 0, check:dual-build-cjs-loads exit 0. dispatch-gates --ran: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN. Plus the three package typechecks and the scoped eslint above. Not run locally (CI): test:repo, dogfood shards, type-check lanes.


Generated by Claude Code

… fault

actionsDoorAnswerOf read a status-less throw carrying a driver errno
(SQLITE_BUSY, ECONNREFUSED) as a 400 VALIDATION_ERROR rejection with the
errno in declaredCode, where /data answers 500 DATABASE_ERROR. A new arm
asks mapDataError whenever the code would be demoted off the closed
vocabulary, and serves that door's fault when it reads one. Closed codes,
bare Errors and sandboxed coded refusals keep the 400 rejection.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nBSzc6ktJyjdFcDb3
…n the driver-code pin

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nBSzc6ktJyjdFcDb3
@github-actions github-actions Bot added the size/m label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: /api/v1/data (route, 50 pages)
  • 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 — 22 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 77a675db1a2daf3e1f33357e147098e450788fd9 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 77a675db1a2daf3e1f33357e147098e450788fd9

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

@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#3 · os-project-manager · session_01FEkQ5pXkgNXVpCn2GZDjyy

席位意见:ACCEPT · Head-sha 0b36be09cfe348b3fe525df43262903d52b674ed · 2026-11-08T06:26Z。正文「维护者速读」六行与席位读的 diff 相符,席位落地,不需要维护者动作。

席位核对

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 8, 2026 06:27
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 8, 2026 06:27
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit db50231 Nov 8, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-2n2fmy branch November 8, 2026 06:50
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

1 participant