Skip to content

refactor(runtime): errorFromThrown builds its answer from the one types composition - #31437

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

objectstack-fleet[bot] merged 2 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 #31319

Clause-②: no (fold onto one composition, no wire change)
Metadata-protocol: none

维护者速读

What changes

  • @objectstack/types: new thrownAnswerOf(err, fallbackStatus) and its ThrownAnswer type (src/actions-door-answer.ts). It is the body of the old private thrownAnswer (arms 3 and 7 of actionsDoorAnswerOf), lifted out without the door's operator lines: status, the closed code (the engine duplicate's ruled wire spelling read off structuredCodeAnswer), message (leaky 5xx withheld), declaredCode (demotedDeclaredCode), userMessage, details (resolver issues / fields plus the duplicate arm's agreeing context). actionsDoorAnswerOf's arms 3 and 7 now return { ...thrownAnswerOf(err, fallback), operatorLines }; its answers are unchanged.
  • @objectstack/runtime HttpDispatcher.errorFromThrown: builds declaredCode / userMessage extra from thrownAnswerOf and hands the answer to this.error, which stays the one construction point for the envelope. The private duplicateArmContext helper is removed with its only caller (its job is the armContext term inside thrownAnswerOf), and the now-unused imports go with it. The method's docblock keeps its history; its one {@link duplicateArmContext} now names thrownAnswerOf.

Tests

  • New packages/runtime/src/dispatcher-thrown-answer-tie.test.ts (7 rows), the tie pin. Each row throws the same value at the real /actions door (HttpDispatcher.handleActions) and at the dispatcher exit (errorFromThrown, at the fallback the door's arm reads: 500 for a declared status, 400 for a rejection) and asserts equal { status, body }, then states the term the row carries: the engine duplicate (UNIQUE_VIOLATION + object / field context), a producer merely speaking DUPLICATE_RECORD, an unregistered code demoted to declaredCode, a leaky declared 503 withheld, a userMessage, issues, and a record ValidationError's fields.
  • After the fold the two exits cannot drift by construction (one function), so the pin's job is to go red if a later change re-composes either exit by hand. Ablation below shows it does.
  • The four dispatcher pins the card names pass with zero edits.

Acceptance notes

  • Why a pin as well as the fold. The fold makes drift between these two exits structurally impossible today. The pin is the cheap guard against a future edit that re-inlines one term at one exit; it costs one file.
  • Not folded: dispatcher-plugin's errorResponseBase (the exit for a throw that LEAVES dispatch()), whose docblock already declares that it does not carry the engine-duplicate translation. Out of this card's surface; unchanged.
  • Worktree name. The claim names objectstack-issue-31319; this ran in the chain's existing worktree objectstack-issue-31317 on the same claimed branch.
  • Branch. Rebuilt from fresh origin/main after fix(types): /actions answers a driver string code as the /data door's fault #31397 merged; the merged branch had already been deleted on GitHub, so this is a new branch push, no force.

Verification

Head b8888585 (base db502314, the #31397 merge; origin/main 383c3530 merged once before opening).

No wire change, suites
  • The four dispatcher pins the card names, unedited, after the fold: http-dispatcher.error-leak.test.ts, dispatcher-5xx-demoted-code-withhold.test.ts, package-door-error-parity.test.ts, error-envelope.conformance.test.ts with the new tie pin: Test Files 5 passed (5), Tests 118 passed (118).
  • @objectstack/types vitest: Test Files 38 passed (38), Tests 881 passed (881).
  • @objectstack/runtime vitest (types from the rebuilt dist): Test Files 560 passed (560), Tests 10323 passed, 19 skipped; lock VERDICT command-exit 0. No existing pin edited.
  • typecheck for @objectstack/types and @objectstack/runtime: exit 0. eslint --no-inline-config packages/types packages/runtime: exit 0.
  • @objectstack/mcp not re-run: its source is untouched, actionsDoorAnswerOf's answers are unchanged and the types change is an added export.
Ablation of the tie pin (ablation-replace, restored to HEAD)
  • packages/runtime/src/http-dispatcher.ts: errorFromThrown made to drop the userMessage term (&& String("ABL31319").length < 0 on its spread), a hand-made drift at one exit. Mutation landed (anchor 1 to 0, blob fce6d0b6dc89 to 25ec094ea41b). dispatcher-thrown-answer-tie.test.ts: Tests 1 failed | 6 passed (7), the userMessage row, AssertionError: expected { status: 409, body: { …(2) } } to deeply equal { status: 409, body: { …(2) } }. The runtime suite reads its own src/, so no dist leg.
  • Restore: blob == HEAD (fce6d0b6dc89), git diff HEAD empty, git status --porcelain empty.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at b8888585: 68 commands, each run with timeout 1500 and stdin from /dev/null, exit codes captured before any pipe, all exit 0 on the first run (after a @objectstack/runtime closure build). dispatch-gates --ran: 68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN. Plus the typechecks, scoped eslint and the two full suites above. Not run locally (CI): test:repo, dogfood shards, type-check lanes.


Generated by Claude Code

…es composition

HttpDispatcher.errorFromThrown composed the thrown-value answer term by
term beside actionsDoorAnswerOf's arms. Both now read thrownAnswerOf
(@objectstack/types, new export), so one composition serves every door;
duplicateArmContext is gone with its only caller. A tie pin drives the
dispatcher exit and the /actions door with the same throws and asserts
equal responses. No wire change.

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 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
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/runtime, @objectstack/types, touching 7 documentable anchor(s).

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

  • content/docs/api/environment-routing.mdx (via HttpDispatcher (symbol, a top-level class))
  • content/docs/automation/webhooks.mdx (via HttpDispatcher (symbol, a top-level class))
  • content/docs/kernel/cluster.mdx (via HttpDispatcher (symbol, a top-level class))
  • content/docs/plugins/packages.mdx (via HttpDispatcher (symbol, a top-level class))

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

  • content/docs/releases/v17/17-5.mdx (via HttpDispatcher (symbol, a top-level class))

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 — 36 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 ae816c40b75f75ccbb8a512c3f17b36608df3ed4 → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 ae816c40b75f75ccbb8a512c3f17b36608df3ed4 → 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

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

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

席位核对

  • 形态: draft,目标 main,首行 Fixes #31319,没有别的闭合关键词。Clause-②: no 和 Metadata-protocol: none 在行首。分支从 fix(types): /actions answers a driver string code as the /data door's fault #31397 合并后的新 origin/main 重建,是新开的 PR。
  • 前提实测: HttpDispatcher.errorFromThrown 改为调用 thrownAnswerOf,原来逐项拼装的约 40 行和 duplicateArmContext 一起删除。thrownAnswerOf 就是原私有函数 thrownAnswer 去掉 operatorLines 后的函数体。actionsDoorAnswerOf 的分支 3 和 7 返回 { ...thrownAnswerOf(...), operatorLines }。传给 this.error 的 message 在 5xx 泄露时已替换成 INTERNAL_ERROR_MESSAGE;this.error 再做一遍同样的替换,结果不变,而且它不写日志,所以运维信息没有损失。线上回答不变:工单点名的四个分发器 pin 一行没改,全部通过。
  • 契约面: 无。@objectstack/types 新增导出 thrownAnswerOf / ThrownAnswer,这是包 API 的增量,不改动任何 spec 或接受集,所以没有欠的契约复审,Clause-②: no 成立。正文「需要你做的」里「落地前按惯例做一次契约复审」一句,就是由席位的这次判读完成的。
  • 门禁(check-runs @ b8888585): 54 success,9 skipped,0 失败。dev 本地 68/68 derived 门禁退出码均为 0。
  • changeset: 31319-one-thrown-answer-composition.md 给 @objectstack/types 和 @objectstack/runtime 记 patch。逐句核对过:新导出、「No response changes」、两扇门共用一个组装函数,都与 diff 相符。
  • 接受的偏差: worktree 沿用了链上已有的 objectstack-issue-31317;dispatcher-plugin 的 errorResponseBase 不在本卡范围内,没有并入,它的 docblock 本来就声明了这一点。
  • 范围外去向: 无。Skills-docs: 种类为 none。
  • 落地条款: check-governed-merges --pr 31437:0 个 governed,+216/−89,走普通队列。席位转 ready 并开 auto-merge,合并后关 runtime: fold HttpDispatcher.errorFromThrown onto the @objectstack/types thrown-answer reader so the two compositions of one answer cannot drift #31319。

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

runtime: fold HttpDispatcher.errorFromThrown onto the @objectstack/types thrown-answer reader so the two compositions of one answer cannot drift

1 participant