Repository navigation
fix(runtime,hono): a returned error answer carrying a userMessage says it varies by Accept-Language - #38274
Conversation
…s it varies by Accept-Language The thrown exits already add Vary: Accept-Language when the body carries a userMessage. An answer a dispatcher domain catches and composes itself is returned instead (errorFromThrown, deps.error with a userMessage, the dispatch foot's PERMISSION_DENIED, the /actions door) and leaves through the two returning exits, dispatcher-plugin's sendResultBase and createHonoApp's toResponse. Both now ask answerVariesByLanguage of the body they send and append the token in their host's append form. Claude-Session: https://claude.ai/code/session_01L9qibxRYWXrA8r7F5oJ2mH Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f812499d35af92fde1b922d633e92bef5ea1eb4a && git checkout f812499d35af92fde1b922d633e92bef5ea1eb4a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3ad3b415997e28d37e74cc50ea05af9fac7faeaf 16688e30f7ee9a29689024b7218b53b2e3d9ffba && git checkout -B drift-repro 3ad3b415997e28d37e74cc50ea05af9fac7faeaf && git merge --no-ff 16688e30f7ee9a29689024b7218b53b2e3d9ffba
node scripts/docs-audit/affected-docs.mjs --json 3ad3b415997e28d37e74cc50ea05af9fac7faeaf
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a ACCEPT at Face. L1 only, no L2 owed. The 6 files are in Claim against surface (claim 7237719810). It matches, with deviation 2 below.
The three deviations, judged.
Changeset, read sentence by sentence: it holds, covering the producers named, both exits, the append, "an answer with no Evidence (report 7238248431).
Checks at this head: 57 success, 11 expected skip, 0 failed, 0 pending. mergeable clean. Relation. Nit (not blocking). The |
…P transport The sendResultBase comment listed "the MCP transport" among the answers that leave through this exit. mcp.ts's resumeDoorError answers the in-process dispatchActionResume, not a route, so the comment now names the resume and trigger doors and says the in-process answer gets no header. Claude-Session: https://claude.ai/code/session_01L9qibxRYWXrA8r7F5oJ2mH Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T12:55Z · zone
|
Requested by Tesla · project thread
Fixes #38123
repo:objectstack#3 · os-tesla · session_01L9qibxRYWXrA8r7F5oJ2mH
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/runtime/src/dispatcher-plugin.ts,sendResultBase'sresponsearm: whenanswerVariesByLanguage(result.response.body)(@objectstack/types, landed with fix(rest,hono,runtime): a refusal carrying a userMessage says it varies by Accept-Language #38114) is true, it writesres.header('Vary', ['Accept-Language']). That is the contract's multi-value form, which the hosts append. It is written after the route's own headers, so nothing after it can replace it.packages/adapters/hono/src/index.ts,createHonoApp'stoResponse,responsearm: the same question of the body, answered withc.header('Vary', 'Accept-Language', { append: true }), after the dispatcher's own headers.packages/types/src/localized-answer-vary.ts: docblock only. Its "Who asks" list now names the two returning exits beside the three throwing ones. No new export.@objectstack/runtime,@objectstack/hono,@objectstack/typespatch.Why
A shared cache in front of the server must never hand a user an error message in someone else's language, so every localized error answer says it varies by
Accept-Language. The rule sits on the exits rather than inerrorFromThrown: #38114 put the rule on the three exits that answer a THROW. An answer a dispatcher domain catches and composes itself is RETURNED as{ handled: true, response }and leaves only through these two exits, which until now wrote nothing butresponse.headers. Per the claim (route A, bounded in-place widening of the same defect class), the one exit rule covers every producer of a returneduserMessage, each named here:HttpDispatcher.errorFromThrown, the card's own case (for examplePOST /automation/_record-starts, whose catch hands over the/dataread's localizedrecordNotFoundError);deps.errorcarrying auserMessage(ruling B′ on A screen flow whose write node is refused shows the end user the engine's raw node text, in English, with the node id and the object API name ("Node 'create_account' failed: create_record(crm_account) failed: …") #24914): the automation resume door's and trigger door's400 FLOW_FAILED;/actionsdoor'sapiErrorResponse(action-dispatch.ts,actionsDoorAnswerOf);PERMISSION_DENIED403 (http-dispatcher.ts,declaredUserMessage).Tests
Each pin goes into the existing harness file for its exit, as a top-level
describe:packages/runtime/src/dispatcher-plugin.declared-user-message.test.ts,[#38123] the dispatcher RETURNED exit. Every case drives a REAL route mounted bycreateDispatcherPluginand reads the fake response's header writes:errorFromThrown:POST /api/v1/automation/_record-starts, with the/dataread throwing the realrecordNotFoundError(object, id, context). Foren,zh-CNandja-JPcallers: 404RECORD_NOT_FOUND, theuserMessagein that language, exactly oneVarywrite of['Accept-Language'], and it is the last header written. Control: the same route's unmarked400 VALIDATION_FAILEDwrites noVary.deps.errorwith auserMessage), the trigger door and the/actionsdoor:400 FLOW_FAILEDfrom a scripted engine whose result carries an app hook's mark. Marked: the mark on the wire and oneVarywrite, last. Control: the unmarked result writes noVary.PERMISSION_DENIED403 gets theVarywrite; the unmarked one does not.packages/adapters/hono/src/hono-response-header-array.test.ts(thetoResponseheader harness),[#38123] the returned answer. One row per producer above, with the nested ADR-0112 body that producer composes, written out because this package's@objectstack/runtimeis a stub: marked ⇒Vary: Accept-Language, unmarked ⇒ noVary. Appended, not set: a route's ownVary: Accept-Encodingkeeps its token besideAccept-Language, and with CORS on,Originkeeps its place.Readings (base origin/main bd5407e, head e6eed88)
POST /api/v1/automation/_record-starts(probe in the card's pre-claim report):404 RECORD_NOT_FOUND,userMessagein en / zh-CN / ja-JP, and the only header written wasX-Request-Id. NoVary.scripts/ablation-replace.mjson the committed fix, deleting one exit's line, then restoring it; each restore was checked asblob == HEADwith an emptygit diff HEAD. Both suites import their exit from source.Tests 7 failed | 28 passed (35). The seven marked rows of the new describe failed (three languages, three flow doors, the foot 403), and every control passed.Tests 6 failed | 7 passed (13). The four marked producer rows and the two "appended" rows failed, and every control passed.pnpm --filter PKG testunder the verify lock, exit 0:typecheckexit 0 on types, hono and runtime.eslint --no-inline-configexit 0 on the five touched.tsfiles.e6eed882:dispatch-gates --ranreconciles 71 derived, 70 run withexit 0, 1 NOT MEASURED, 0 unrun. The NOT MEASURED one ischeck:dual-build-cjs-loads, which exited 3 (PREREQUISITE NOT MET): it reads every package'sdist/, and this tree built only the runtime and hono closures. CI'sLint & Repo Gatesruns it.check-plugin-teardown-shape --self-testneeded its fixture commit fetched into the shallow clone, then exited 0.overlap-checkbefore the first push was not run; it was run right after it on e6eed88: clean against origin/main and against feat(runtime): POST /packages/:id/move-in moves a selection of loose items into a package, each through the save door #38185, the one open PR sharingdispatcher-plugin.ts.Acceptance notes
mcp.tsis not one of these producers. Itsdeps.errorwith auserMessage(resumeDoorError) answersdispatchActionResume, the kernel's in-process host API (action-dispatch.ts), not an HTTP route, so no response header applies.userMessagebody and its ownVary: Accept-Languageheader:localizedNotImplementedlocalizesmessage, notuserMessage, and the/metareads that set the header answer success bodies.Varyis a list, so a repeated token is harmless.hono-response-header-array.test.ts, thetoResponseheader harness, rather thanhono-thrown-message-disclosure.test.ts, which the claim named: that file pinsthrownJson, the throw arm, and this change is the returned arm.Verification
Read first, by risk:
packages/runtime/src/dispatcher-plugin.ts: the end ofsendResultBase'sresponsearm (the exitos devserves for every dispatcher-mounted route).packages/adapters/hono/src/index.ts:toResponse'sresponsearm.Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run src/dispatcher-plugin.declared-user-message.test.tsshows 35 passing. Delete theres.header('Vary', …)line insendResultBaseand the same command shows 7 failing.Human Minimum
packages/specholds no runtime logic (not touched).main, one pull request.packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibxRYWXrA8r7F5oJ2mH
Generated by Claude Code