Repository navigation
fix(runtime): the capabilityUnavailable 501 answers in the request's language - #38113
Conversation
…uage The mounted-but-unimplemented 501 of /ai, /automation, /notifications and /ui, and a custom flow endpoint's, renders the operation-message catalog's capability_unavailable_* sentence in the request's top Accept-Language tag with Vary: Accept-Language. English stays byte-identical to serviceUnavailableMessage(slot); discovery stays English. zh-CN says 定制包. The domain 501 source walk now reads code only and sees every 501. Claude-Session: https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX Co-authored-by: Claude <noreply@anthropic.com>
…e collapsed Claude-Session: https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX Co-authored-by: Claude <noreply@anthropic.com>
…collection Claude-Session: https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 183 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 d699696f2c4ad37c2ebd41e14800c1ced3f6c327 && git checkout d699696f2c4ad37c2ebd41e14800c1ced3f6c327
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0e361201b2a6062cccaa1a2f7d37b82b3ed0465a 76e31f9472599af796d16ef1e576bcb66df5eee7 && git checkout -B drift-repro 0e361201b2a6062cccaa1a2f7d37b82b3ed0465a && git merge --no-ff 76e31f9472599af796d16ef1e576bcb66df5eee7
node scripts/docs-audit/affected-docs.mjs --json 0e361201b2a6062cccaa1a2f7d37b82b3ed0465a
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head d80d5fc · 2026-11-28T02:43Z |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Read: card #37864 (body, triage, claim with the seat ruling "option B, discovery stays English", dev report, claim amendment), PR #38113 (body, 12-file list, net diff against merge base Check-runs at the time of this record: 24 success, 11 skipped, 31 still in progress, 0 failed. Concluded green: ① Derived judgments
② Semver levelChangeset Clause-②: yes (widening) — on the PR body and the changeset, consistent with each other and with the diff (keys added, nothing taken away). ③ Boundary flags
④ Design judgment
S1 (should-fix) — The operator's fault log now takes the first caller's language, and nothing in the diff says so. N1 (nit) — N2 (nit) — N3 (nit) — zh-CN says 「没有随附的实现」 in No must-fix. S1 is open on this head and earns a delta review of its fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 The brief the contract reviewer above was handed, filled, for the seat to read before it adopts the record: Contract review brief — PR #38113 @
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a: REWORK at
|
…glish The once-per-route fault line took the first caller's language. The answer now names the English as faultLogMessage, which the dispatcher plugin's writer prints in place of the body's message; never written to the wire. Claude-Session: https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 6200611 · 2026-11-28T03:50Z |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Delta review of the fix for S1 of record 7232619079 (head Check-runs at the time of this record: 57 success, 11 skipped, 0 failed, 1 in progress (the ① Derived judgments
② Semver levelChangeset now lists Clause-②: yes (widening) — the changeset's line now names ③ Boundary flags
④ Design judgment
The new test drives the real route mount with a ja-JP request first and a plain one second, and asserts the Japanese body, one English S1: closed N1: closed ( N4 (nit) — the No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a delta: ACCEPT at
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 76e31f9 · 2026-11-28T04:33Z |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Merge-main record. This head is a merge commit with two parents: Check-runs on this head: 58 success, 11 skipped, 0 failed, 0 in progress. ① Derived judgments
② Semver levelUnchanged: the changeset lists Clause-②: yes (widening) — on the PR body and the changeset, naming the five catalog keys and the optional ③ Boundary flags
④ Design judgment
S1: closed (in record 7233494597; the fix is in this tree unchanged). N1, N2, N3: closed there. N4 (nit) stands as an accepted deviation or a follow-up: the No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a: ACCEPT at
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T04:41Z · zone
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Requested by Tesla · project thread
Fixes #37864
repo:objectstack#3 · os-tesla · session_01L9qibvsF1zxzrxqnFoXdzX
Clause-②: yes (widening) —
@objectstack/specBUILTIN_OPERATION_MESSAGESgainscapability_unavailable_install,capability_unavailable_unshipped,capability_unavailable_ui,capability_unavailable_aiandcapability_unavailable_searchin every locale;@objectstack/runtimeHttpDispatcherResult.responsegains the optional, never-writtenfaultLogMessageMetadata-protocol: none
维护者速读
What changes
packages/runtime/src/domains/unavailable.ts:capabilityUnavailable(deps, context, slot)now renders throughcatalogNotImplemented. The501is in the request's topAccept-Languagetag and carriesVary: Accept-Language.ui,aiandsearcheach have a key of their own. Every other slot readscapability_unavailable_installwith{{package}}fromCORE_SERVICE_PROVIDER, orcapability_unavailable_unshippedwith{{slot}}.capabilityUnavailableMessage(slot, locale?)andcapabilityUnavailableMessageFor(context, slot)give the same sentence as a string./discoveryhas no request to read a language from.logServerFault), so a localized line would carry the first caller's language for the life of the process.capabilityUnavailablesets the answer'sfaultLogMessageto the English.packages/runtime/src/http-dispatcher.ts:HttpDispatcherResult.responsegains the optionalfaultLogMessage?: string. Its jsdoc says it is never written to the wire.packages/runtime/src/dispatcher-plugin.tssendResultBasepassesfaultLogMessagetologServerFaultwhen it is a string, andbody.error.messageotherwise.packages/types/src/server-fault-log.ts: the docblock for the declared-absence family now says the wire is localized and the log line stays English.ai.ts(1),automation.ts(2),notifications.ts(6) andui.ts(1) pass the context they already hold.packages/runtime/src/endpoint-executor.ts:serviceUnavailableMessage('automation')) at its two501s.automationUnavailableAnswer(ctx): the same localized sentence, withVary: Accept-Language.packages/spec/src/system/operation-message.ts:en,zh-CN,ja-JPandes-ES. The English is byte-identical toserviceUnavailableMessage(slot)._aireads 「开源框架没有随附的实现」, the wording_unshippeduses.packages/runtime/src/domains/own-door-bridge.ts(N1):requestLocaleOf's jsdoc names its two direct callers,catalog-activation.tsfor the noun andcapabilityUnavailableMessageFor.37864-capability-unavailable-languages.md:@objectstack/runtime,@objectstack/specand@objectstack/types, each at patch.Tests
domain-501-language-37811.test.ts, the shared harness for domain501language pins:#37864 · 3:CoreServiceNameslot, and of an unknown slot, equalsserviceUnavailableMessage(slot). This is the drift half./ai,/automation,/notificationsand/ui, each with no service, answer 501 ·NOT_IMPLEMENTED· the slot's sentence in en, ja-JP and zh-CN, withVary. The plain request reads the discovery English./mcp/skillwith no MCP server answersmcp_server_unavailablein the request's language, withVary.501written in code in a domain module (any call, any wrapper), not only a literaldeps.error(…, 501).unavailable.tsleaves the builder set and is walked.src/domains/is walked.meta.tsdeps.errorFromThrown(e, 501): the thrown error's own message.mcp.tsresumeDoorError(…, 501): stays English by design.permission-set-clone.ts{ statusCode: 501, messageKey }.permission-set-clone.ts: the read-back of thatstatusCode.errorFromThrown, a wrapper and a template hole. It also pins no hit in strings, comments,5010orx.501.catalog-activation-door.test.ts(N2, nouns):catalog_activation_noun_TYPEin that language, withVary, and write nothing.endpoint-executor.test.ts: the flow endpoint's two501s in ja-JP and zh-CN, plus the English with no header, withVaryon each.declared-capability-absence-warn-once.test.ts, describe#37864 — a localized 501 still logs its English:GET /notificationswith no messaging service.Install @objectstack/service-messaging to enable.faultLogMessage.import '@objectstack/metadata'forcheck:test-source-alias.Acceptance notes
501s now carryVary: Accept-Language. This is an added header, the same one the other domain501s have carried since PR fix(runtime): the dispatcher's remaining 501 answers follow the request's language #37845.origin/main: 16 files across three packages (runtime, spec, types), +547 / −74.501s outsidesrc/domains/that stay fixed English.501s.origin/main93fa911 merged in at d80d5fc; the branch merges with current main with no conflict, and GitHub reportsmergeable_stateclean):test:Test Files 655 passed (655),Tests 12370 passed | 25 skipped.tsc --noEmit: exit 0.build: exit 0.test:Tests 963 passed (963).tsc --noEmit: exit 0..tsfiles: exit 0.dispatch-gates --commands, 94 on this diff):check-plugin-teardown-shape.mjs --self-test.check:dual-build-cjs-loadswent red once while a sibling run was rebuildingplugin-approvalsdist, and passed on a re-run.check:test-source-aliaswent red in CI at f80fc5d on the edited warn-once suite, and passed after the module-top import in 6200611.scripts/ablation-replace.mjs. Each mutated the committed fix and was restored with blob == HEAD andgit diff HEADempty:capabilityUnavailableback to a directdeps.error(…, 501):Tests 5 failed | 47 passed (52).6 failed | 95 passed (101).2 failed | 51 passed (53).capabilityUnavailablewithfaultLogMessage: undefined:1 failed | 7 passed (8).sendResultBaseignoringfaultLogMessage:1 failed | 7 passed (8).Verification
Read first (by risk):
packages/runtime/src/domains/unavailable.ts:SLOT_SENTENCE_KEY,capabilityUnavailableSentenceand thefaultLogMessageit sets.packages/runtime/src/dispatcher-plugin.tssendResultBase: the log message choice.packages/spec/src/system/operation-message.ts: the fivecapability_unavailable_*keys in each locale.packages/runtime/src/domains/domain-501-language-37811.test.ts:codeOnlyand the exemption list.Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run src/domains/domain-501-language-37811.test.ts src/declared-capability-absence-warn-once.test.ts. It shows 52 and 8 passing.curl -H 'Accept-Language: zh-CN' HOST/api/v1/ai/models. It answers the zh-CN sentence withVary: Accept-Language, and the server's warn line stays English.🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibvsF1zxzrxqnFoXdzX