Skip to content

fix(service-print, spec): the print door's 5xx sentences follow the request's language - #37272

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37260-print-failure-locale
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37260-print-failure-locale

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37260

repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在中文(以及日文、西班牙文)界面里点击打印,若服务器上的打印引擎未就绪、打印超时或服务器出错,提示条现在用界面语言显示;英文界面与以前一字不差。
  • 为什么做:报价单打印失败时中文界面弹出整句英文,看起来像坏了,业务用户也看不懂;这是该缺陷卡(打印失败提示不跟随界面语言)本身。
  • 出错会怎样:最坏情况是某种语言的提示措辞不够好,状态码与错误码都不变,不影响打印本身;可直接撤回本改动。
  • 要你做什么:无。

What changes

  • packages/spec/src/system/operation-message.ts: four keys in the platform's operation-message catalog (BUILTIN_OPERATION_MESSAGES), in all four locales it carries (en, zh-CN, ja-JP, es-ES): print_engine_unavailable (503), print_timed_out (504), print_failed (the 5xx fallback) and print_caller_unresolved (the door's caller-resolution 500). English is byte-identical to the fixed text the door answered before. No placeholder; the header documents them beside the other keys.
  • packages/services/service-print/src/print-routes.ts: serverAnswerFor(status, locale) maps the status to its catalog key and renders it through operationUserMessage (@objectstack/core), the shared helper the platform's other localized refusals use; relayPrintFailure and the caller-resolution fault pass the request's top Accept-Language tag (preferredLocaleFromHeader). The door reads no query parameter, so ?locale is not a source. Code, status, the fault log and the 4xx relay are unchanged.
  • packages/services/service-print/vitest.config.ts: aliases @objectstack/spec/system to source like the other spec subpaths, so the new import is judged against this checkout, never a stale dist/.

The mechanism reused, not a new one: the operation-message catalog plus operationUserMessage is the platform's one seat for localized user-facing server sentences (its header: "a second mechanism for the second producer is exactly what this module exists to prevent"). The door's message itself is localized, because sendServerFault's message is already the route's generic user-facing text (the thrown detail goes only to the fault log) and sendServerFault declares no userMessage channel; widening it would change an @objectstack/types export outside this card's file surface.

The action path from the repro (POST /api/v1/actions/crm_quote/print_quote) produces no sentence of its own for these failures: the /actions door forwards a same-origin type: 'api' action in-process with accept-language on its header allowlist (API_FORWARD_HEADER_ALLOWLIST, packages/runtime/src/action-execution.ts) and relays the target's refusal envelope with its message as written (restAnswerOf, forward-refused, packages/runtime/src/action-dispatch.ts). So fixing the door fixes the action toast; nothing changed in packages/runtime.

Bounded in-place fix, declared: the caller-resolution 500 (The caller of this print could not be resolved.) is the same door's own 5xx sentence, the same defect class, the same file in the claim's surface, the same gate family; it is localized the same way and pinned below.

Read first

  1. packages/services/service-print/src/print-routes.ts (the requestLocaleOf / serverAnswerKeyFor / serverAnswerFor hunk) — the only behaviour change.
  2. packages/spec/src/system/operation-message.ts — the 16 new catalog strings; the zh-CN, ja-JP and es-ES wording is the review risk.
  3. packages/services/service-print/src/print-routes.test.ts — the new top-level describe.

Two-minute verification

pnpm --filter @objectstack/service-print exec vitest run --maxWorkers=2 src/print-routes.test.ts — expect 36 passed, including ten under "its own 5xx sentences, in the request's language".

Tests

All at head 3dfbfdb5a.

  • pnpm --filter @objectstack/service-print test — Test Files 9 passed (9), Tests 145 passed (145).
  • pnpm --filter @objectstack/spec test — Test Files 891 passed (891), Tests 28371 passed, 1 todo.
  • pnpm --filter @objectstack/service-print typecheck exit 0; pnpm --filter @objectstack/spec typecheck exit 0 (tsc, scripts and test typecheck).
  • New pins (door, print-routes.test.ts): 503, 504 and 500 under accept-language: zh-CN,zh;q=0.9,en;q=0.8 answer the zh-CN catalog sentence and not the English one; the control: en-US and an absent header answer the English sentence, for each of the three; the English sentences equal the pre-change text; ja reaches ja-JP and de-DE falls back to English; the caller-resolution 500 in zh-CN and absent; a 4xx keeps its producer's text under zh-CN.
  • New pins (catalog, operation-message.test.ts): all four keys in every locale, placeholder-free, naming no wire code or host vocabulary, distinct from every other key, rendering zh-CN / es / en fallback.
Ablation: hard-coded English restored, zh pins turn red

node scripts/ablation-replace.mjs on print-routes.ts, anchor return operationUserMessage(serverAnswerKeyFor(status), { locale }); replaced with the three original hard-coded English returns. The test imports the subject by relative path and aliases core/spec to source, so no build stands between the mutation and the run.

ablation-replace: anchor   x1 -> x0
ablation-replace: blob     44b2c38dcc4e216ca81b7084f1f0377340c18dd0 -> 97403a9b77a977dc80088aafb8a207052ec53393
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 44b2c38dcc4e -> 97403a9b77a9
     × no print engine ready: SERVICE_UNAVAILABLE / 503 under accept-language zh-CN answers the zh-CN sentence
     × the render ran past its time: TIMEOUT / 504 under accept-language zh-CN answers the zh-CN sentence
     × an undeclared fault: INTERNAL_ERROR / 500 under accept-language zh-CN answers the zh-CN sentence
     × a base language reaches its regional catalog (ja → ja-JP); a language the catalog lacks answers English
      Tests  4 failed | 32 passed (36)
ablation-replace: ok restored: blob == HEAD (44b2c38dcc4e) and `git diff HEAD` is empty

The three English controls stayed green under the mutation, as they should.

Gates

node scripts/pm/dispatch-gates.mjs --commands derived 91 families for this diff; all 91 were run at 3dfbfdb5a, each exit captured before any pipe. Reconciliation (--ran with exit codes): ✓ 91 derived famil(ies) accounted for — 88 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3).

  • 88 exit 0.
  • NOT MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test, reason: shallow clone cannot reach its pinned positive-control commit.
  • NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: reads every package's built output; only the service-print closure was built here.
  • NOT MEASURED: pnpm check:type-check-debt, reason: its re-measure queued on the shared verify lock behind a long dogfood run (exit 99 twice).

All three run in CI on this PR. test:repo was not run locally (no diff in that project); declared to CI's Test Core.

Acceptance notes

  • The language source is the request's Accept-Language only. The door's execution context carries no locale and no workspace default (requestLocale: undefined, localization: undefined), so operationUserMessage's second rung (the workspace default) has nothing to read here; the console sends its UI language on every call, which is the issue's case.
  • No deployment errors.print_* translation override is consulted: operationUserMessage is the helper for producers that hold no i18n service, and the door holds none.
  • The door's own 4xx refusals (the impersonation refusal, the request-shape refusals) stay English developer text; they are outside this card, which names the 5xx sentences.
  • Observation only, not filed: the /actions door's own forward-unavailable sentence (apiActionForwardUnavailableError, 503) and the print bridge's 501 are English too; neither is on this card's path when the door is mounted, and neither was reproduced here.
  • Clause-② measured: no new export, no type change, no new envelope field, no new input read as a contract (any header was already accepted); the catalog gains entries in an existing exported Record value, and the wire message changes language only for a non-English request.

Generated by Claude Code

…equest's language

serverAnswerFor answered fixed English for 503, 504 and the 500 fallback, and
the caller-resolution 500 did the same, whatever the request's Accept-Language.
The four sentences are now print_* keys of the platform's operation-message
catalog (BUILTIN_OPERATION_MESSAGES) in en, zh-CN, ja-JP and es-ES, written
through operationUserMessage in the request's top Accept-Language tag. English
is byte-identical to the old text.

Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/service-print, @objectstack/spec, touching 16 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/services/service-print/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/api/client-sdk.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/api/error-catalog.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/automation/hook-bodies.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/permissions/system-context.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/plugins/development.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/protocol/kernel/error-handling.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/ui/print-pages.mdx (via /api/v1/print/records (route, a path literal in a comment on a changed line))

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

  • content/docs/releases/v17/17-0.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/releases/v18/18-2.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))
  • content/docs/releases/v18/18-3.mdx (via INTERNAL_ERROR (literal, a string literal in handlePrintRecord))

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
  • 1 changed file(s) yielded no anchor (packages/services/service-print/vitest.config.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 177 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 057cedfa9b6f990a7cf322118ae33bc4460ddc65 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 057cedfa9b6f990a7cf322118ae33bc4460ddc65

⚠️ 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 057cedfa9b6f990a7cf322118ae33bc4460ddc65 → 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

repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW

Final green head for L1 (2026-11-25T10:45Z): 3dfbfdb5a135338fd76d80ceab81442c2315d4df.

  • Checks at this head: 58 success, 11 expected skips, 0 failed, 0 pending. mergeable_state: clean.
  • Size: 6 files, +236 / −12; no governed path; Fixes #37260; Clause-②: no (measured), Metadata-protocol: none.
  • What it does: the print door's own 5xx sentences render through the operation-message catalog (BUILTIN_OPERATION_MESSAGES + operationUserMessage) by the request's Accept-Language. Four keys: 503, 504, the 5xx fallback, and the caller-resolution 500. They cover en / zh-CN / ja-JP / es-ES, with English byte-identical. Code, status, fault log and the 4xx relay are unchanged. The /actions route forwards accept-language and relays the door's message, so the runtime is untouched.
  • Seat direction A (7159533198): the wire message is localized, and no userMessage rides the fault.
  • Evidence:
    • Ablation: restoring the hard-coded English turns the 3 zh pins and the ja pin red, 4 failed | 32 passed, while the English controls stay green.
    • Tests: service-print 145, spec 28371.
    • Gates: 88 of 91 derived ran with exit 0. The other 3 are NOT MEASURED locally with reasons stated in the PR body, and all three ran in CI.
  • Points for L1:

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 3dfbfdb5a135338fd76d80ceab81442c2315d4df · 2026-11-25T10:59Z

  • Shape (l1-face.mjs --pr 37272, CLEAN, 13 items): open, draft, base main, first line Fixes #37260, no closing keyword on another card, no content/docs/releases/ path, a changeset for each published package touched (@objectstack/spec and @objectstack/service-print, both patch), no +0/-0 file, declarations Clause-②: no and Metadata-protocol: none in the body and the changeset. Fixes is right. The card's Expected (the 503/504/500 sentences translated by the request locale, toast in the UI language) is delivered whole. The two English sentences outside the card (the /actions 503 and the bridge 501) are on Print-path English sentences outside #37260: the /actions door's forward-unavailable 503 and the own-door bridge's 501 ignore the request locale #37273.
  • Seat direction A is followed (7159533198, 2026-11-25T10:18Z). Both call sites pass the localized text as sendServerFault's message argument (print-routes.ts: the caller-resolution arm and relayPrintFailure). No userMessage and no declaredCode are added on a 5xx. sendServerFault's signature and envelope are untouched. This matches the docblock in packages/types/src/response-envelope.ts ("The wire carries message, the route's generic text, and nothing of thrown") and the actions-door fault exit in actions-door-answer.ts (~L311: "a fault's userMessage … do[es] not ride this exit"). The thrown value still reaches only the fault log.
  • Clause-② holds (no). The only spec edit adds 16 string entries under the existing en/zh-CN/ja-JP/es-ES objects of BUILTIN_OPERATION_MESSAGES, plus TSDoc. There is no new export and no type change:
    • The declaring line export const BUILTIN_OPERATION_MESSAGES: Record… (string-keyed Record of string-keyed Records of string) is an unchanged context line in the diff. Its key type is explicitly string, not a literal union inferred from the object, so a new key cannot reach the .d.ts.
    • Named probe, built at head: packages/spec/dist carries declare const BUILTIN_OPERATION_MESSAGES with that same string-keyed nested Record type.
    • No type in the tree derives from the catalog's keys: git grep "typeof BUILTIN_OPERATION_MESSAGES" finds nothing in packages/.
    • serverAnswerKeyFor's literal return type is module-private in service-print.
    • The two other consumers (core/src/utils/operation-user-message.ts and plugin-security/src/security-plugin-authz-middleware.ts) read only locale presence through resolveBundleLocale. More keys do not change what they do.
  • English is byte-identical. I extracted the four literals from print-routes.ts at merge-base 9171bed0a65 and compared them as Buffers with BUILTIN_OPERATION_MESSAGES.en[k] from the head build. All four are BYTE-EQUAL (print_caller_unresolved, print_engine_unavailable, print_timed_out, print_failed). The control pin "the English sentences are the ones the door answered before they were localized" passes at head.
  • Pins re-run at head in a throwaway worktree, after building spec and service-print's dependency closure: pnpm --filter @objectstack/service-print exec vitest run --maxWorkers=2 src/print-routes.test.ts gives Tests 36 passed (36). All 10 pins under "its own 5xx sentences, in the request's language" are ✓. Catalog suite: vitest run src/system/operation-message.test.ts gives 60 passed (60).
  • Ablation reproduced (4 red). I ran scripts/ablation-replace.mjs with the anchor return operationUserMessage(serverAnswerKeyFor(status), { locale }); replaced by the three original English returns. The mutation landed (blob 44b2c38dcc4e → f01bdac1104e). The result was Tests 4 failed | 32 passed (36): the three zh-CN pins (503/504/500) and the ja→ja-JP pin. The English controls stayed green, and the restore was verified (git diff HEAD empty).
    • The author's ablation does not exercise the caller-resolution arm, so I added a second ablation of operationUserMessage('print_caller_unresolved', …) → the English literal. It gives 1 failed | 35 passed, and only the caller-resolution pin is red.
  • Fallback to English holds. I probed preferredLocaleFromHeader → operationUserMessage('print_failed', …) on the head build:
    • absent, "", *, en-US,en;q=0.9, de-DE, xx and fr-FR,zh-CN;q=0.9 all return the English sentence. Only the top tag is read, by design, the same reading the platform uses elsewhere.
    • zh, ZH-cn, ja and es-MX reach their catalogs.
    • Observation, not graded: zh-TW renders the Simplified zh-CN text. That is existing resolveBundleLocale base matching and was not changed here.
  • Benefit past the boundary, checked by reading the code (no browser run):
    • The console sets Accept-Language on API calls (ui/packages/auth/src/createAuthenticatedFetch.ts:146–149).
    • /actions forwards it: 'accept-language' is in API_FORWARD_HEADER_ALLOWLIST, packages/runtime/src/action-execution.ts:1451.
    • /actions relays the target's error.message as written (apiActionForwardRefusal, action-execution.ts:2448–2452; forward-refused, action-dispatch.ts:920–930).
    • Browser reach stays NOT MEASURED, as the zone said.
  • Translation quality: all twelve localized strings are accurate. None names a wire code, host or path. zh-CN and ja-JP match the catalog's polite register. print_failed and print_caller_unresolved read naturally in all three languages. N1–N3 below are phrasing nits only.
  • Bounded in-place fix (caller-resolution 500), four conditions met: same defect class (the door's own hard-coded English 5xx), mechanical, nobody else claims it, same gate family and same file. The PR body names it and pins it.
  • Gates:
    • Check-runs at 3dfbfdb5a1: 58 success, 11 skipped (expected), 0 failed, 0 pending.
    • Lint & Repo Gates: success. TypeScript Type Check: success. Test Core (1–10/10): success.
    • mergeable_state: clean.
    • K = 2 (landing-k.mjs --pr 37272: PRBASE 057cedfa9b → origin/main f9fda2a4f8). The locale leg has no new pack, and the shared-budget leg has no book.
    • git merge-tree --write-tree origin/main 3dfbfdb5a exits 0 (clean).
    • Main since the merge-base touches none of service-print/, operation-message.ts or operation-user-message.ts.
  • Changeset, read sentence by sentence (.changeset/37260-print-failure-locale.md):
    • "now answers its own 5xx sentences in the request's language": true, and the route is PRINT_RECORDS_ROUTE = '/api/v1/print/records'.
    • "used to answer a fixed English error.message whatever the request's Accept-Language": true (merge-base serverAnswerFor).
    • "four keys … in en, zh-CN, ja-JP and es-ES, written through operationUserMessage … in the request's top Accept-Language tag": true.
    • "the /actions door forwards the caller's Accept-Language and relays the door's message as written": true (allowlist and apiActionForwardRefusal, above).
    • "Code, status and the English text do not change: … English, … no Accept-Language, or … a language the catalog carries no text for, reads the same sentence as before": true (byte check and fallback probe).
    • "What the engine or the host said is still withheld from the wire and kept in the server fault log": true, because sendServerFault is unchanged.
    • A patch level for new catalog keys matches the spec CHANGELOG's precedent (record_not_found, query_field_not_readable and delegation_scope_violation shipped as Patch).
  • 维护者速读, read sentence by sentence:
    • 用户能看到什么变化: true for the 503, 504 and fallback paths. English is unchanged, as checked above. It does not mention the fourth sentence, the caller-resolution 500 (N5).
    • 为什么做: matches the card's repro and its p1 reason.
    • 出错会怎样: true. Status and code are pinned unchanged in every new case through envelope(answer), and the change touches no print logic. A revert is one commit.
    • 要你做什么:无: true. No governed path, and no maintainer decision is open.
  • Overlap: I scanned the changed-file lists of all 41 open PRs. The only hit is the release PR chore: version packages (next) #35129 (changeset-release/main), which touches only service-print/CHANGELOG.md and package.json. No open PR touches print-routes.ts, operation-message.ts or operation-user-message.ts.
  • Contract review: record-recognisers.mjs --template --paths … reads the schema face (hit packages/spec/src/system/operation-message.ts), so a review is owed at CONTRACT_REVIEW_TIER. A draft record is filed beside this one, served at TIER_DEFAULT, and the seat re-runs it at tier before landing. The zone comment's "no governed path" holds: the path is on no Prime Directive feat: Comprehensive CRM example demonstrating all ObjectStack protocol features #14 surface. The contract review is owed by the schema face, not by governance.
  • N1 — zh-CN.print_timed_out 记录未能在打印允许的时间内打印为文件。 is literal and stiff ("打印允许的时间"). Better: 打印超时:记录未能在允许的时间内打印为文件。
  • N2 — ja-JP.print_engine_unavailable stacks two negatives in two short sentences (…印刷できません。印刷エンジンの準備ができていません。…). Better: 印刷エンジンの準備ができていないため、現在レコードをファイルに印刷できません。原因はサーバーログに記録されています。 In ja-JP.print_timed_out, 印刷に許可された時間内に… is stiff. Better: 制限時間内にレコードをファイルに印刷できませんでした。
  • N3 — Two phrasing points in es-ES.print_engine_unavailable:
    • Ahora mismo is colloquial next to the catalog's formal usted voice (Póngase en contacto…).
    • log del servidor is an anglicism where the platform's own es-ES says registro del servidor (packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts:370).
    • Better: En este momento no se pueden imprimir registros en un archivo: el motor de impresión no está listo. El motivo figura en el registro del servidor.
    • es-ES.print_timed_out …en un archivo en el tiempo permitido para una impresión. has a doubled en. Better: No se pudo imprimir el registro en un archivo dentro del tiempo permitido.
  • N4 — The pin titled "…the cause in the fault log only" (print-routes.test.ts) asserts neither the fault-log line nor that posture read failed at /srv/secret is absent from the body. The same goes for the three zh-CN pins, whose throwers also carry /srv/secret. Add expect(JSON.stringify(zh.body)).not.toContain('/srv/secret'), or retitle the pin.
  • N5 — 维护者速读's first bullet names three failure kinds (引擎未就绪、超时、服务器出错). The PR also localizes the caller-resolution 500, which the changeset and body do name.
  • Landing: the zone lands it after measuring K; if K ≥ 15 it merges main first; a merge-only head move keeps this ACCEPT.

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 3dfbfdb5a135338fd76d80ceab81442c2315d4df
Local-runs: none
Scope: packages/spec/src/system/operation-message.ts + packages/services/service-print/src/print-routes.ts, packages/spec/src/system/operation-message.test.ts, packages/services/service-print/src/print-routes.test.ts, .changeset/37260-print-failure-locale.md
Security-touching: no
Rule-change-verified: none

PR #37272, card #37260. Read-only: the diff origin/main...3dfbfdb5a (6 files, +236 −12), the card thread with seat direction A, and the head's check-runs. Nothing was built or run locally. The remainder of the diff (packages/services/service-print/vitest.config.ts, a source alias for @objectstack/spec/system) is the lane seat's ACCEPT.

① Derived judgments

  • What the catalog is. BUILTIN_OPERATION_MESSAGES is a published export of @objectstack/spec/system, typed Record<string, Record<string, string>>. It is platform text, not authorable metadata: its own header says it ships as constants and stays out of the extract-and-gate bundle pipeline.
  • What reads its keys. At head: renderOperationMessage (spec), operationUserMessage (packages/core/src/utils/operation-user-message.ts, which takes messageKey: string), plugin-security's locale probe, and producers that name a key literally. No client reads a key: the only ui/ hit for an existing key name is a comment in ui/packages/data-objectstack/src/index.ts. No docs generator lists the keys: content/docs/protocol/objectql/types.mdx names two errors.delete_restricted* addresses by hand and nothing else.
  • Exported types and snapshots. The value's type does not change, and no key union is exported. packages/spec/api-surface/system.json and packages/spec/export-origins/system.json record the const by name only, and the diff touches neither. No generated reference doc or JSON schema is in the diff. The head's Lint · docs & code guards, Lint & Repo Gates, Spec property liveness and Type Check · consumer gates are all success, so no generated artifact drifted.
  • Clause-②: no is correct. The test is whether the card widens an accepted set or enlarges the public surface. There is no new export, no type change and no new envelope member. Accept-Language was already an accepted header on this door. Four more entries in an existing exported record are data under an unchanged type. The earlier catalog changeset that called itself a widening did so for its new operationUserMessage export, which this PR only calls.
  • Metadata-protocol: none is correct. No key, value or metadata type an author can write is added, removed or changed in meaning. A translation item could always carry an errors.print_* key (the namespace is free-form), and its effect is the same before and after: none, see the nit under ④.

② Semver level

patch on @objectstack/spec and @objectstack/service-print is right. The kind is none, which takes patch; a non-protocol change ships patch either way. Both moved packages are named, and both declaration lines are line-initial in the changeset body and the PR body. @objectstack/core is called, not changed, so it is correctly absent. Check Changeset is success at this head. The changeset body's claims were each checked against code:

  • "Code, status and the English text do not change": sendServerFault receives the same status and code arguments, and print-routes.test.ts L432–L438 and L458 pin the English against literal pre-change sentences.
  • "the /actions door forwards the caller's Accept-Language": accept-language is on the forward allowlist at packages/runtime/src/action-execution.ts L1451.
  • "relays the door's message as written": the forward-refused arm of packages/runtime/src/action-dispatch.ts (L920–L931) relays an enveloped refusal whole. Read, not reviewed (outside the diff).

③ Boundary flags

  • The dev's open question (which envelope channel) is answered by seat direction A on Print failure messages (503 'print engine is not ready', 504, 500) are hard-coded English and ignore the request locale #37260, and the code agrees with both governing texts. The sendServerFault docblock (packages/types/src/response-envelope.ts L252–L254) says the wire carries message, the route's generic text, and nothing of thrown: the localized sentence is still that authored generic text, and thrown still goes only to the log. The actions-door fault exit (packages/types/src/actions-door-answer.ts L311–L315) says a fault's userMessage does not ride the exit: the PR adds none.
  • Out-of-scope findings (the /actions forward-unavailable 503, the print bridge 501, the door's English 4xx refusals) are routed to a follow-up card by the seat. None is in this diff.
  • Bounded in-place fix (print_caller_unresolved): same file, same class, pinned in zh-CN and with the header absent. Accepted as declared.
  • SQL push-down: not applicable. The diff adds no query, id materialisation or join.
  • Security: the diff changes the language of four authored sentences. It changes no permission, authentication or disclosure behaviour: the catalog test refuses wire codes, Chromium, OS_PRINT and any / in all 16 strings, so no host or engine vocabulary reaches the wire.

④ Design judgment

operation-message.ts against direction A and its first consumer.

  • Key names follow the catalog's convention: snake_case, one key per situation and not per wire code. Two keys share 500 INTERNAL_ERROR (print_failed, print_caller_unresolved), which is the header's own rule (The other ~40 [Security] Access denied sentences are still English-only developer copy shown verbatim to end users (same class as #7414, one template fixed) #7451).
  • Placeholder shape: none of the 16 strings takes a {{name}} placeholder, the header says so, and the test asserts it per locale. That matches the three other placeholder-free keys.
  • All four locales define all four keys, so the en must-define-every-key rule holds and no locale falls through for a key another one carries.
  • The header paragraph states what these keys are: the message of a 5xx, where every earlier member is a refusal's user sentence. That is a new kind of member, and it is documented at the seat rather than left implicit.
  • The zh-CN strings use full-width punctuation throughout, as the catalog's zh-CN entries do.

print-routes.ts against the contract it implements.

  • The envelope is unchanged: success: false, error.code, error.message, same status. An English request, an absent header, and a language the catalog lacks all read the pre-change bytes (pinned for 503, 504 and 500, and for de-DE).
  • No console or SDK code matches on the sentence text: the only literal copies at head are the catalog and the two test files. Clients key on code and status, which do not move.
  • serverAnswerKeyFor returns a literal union of three keys that exist in every locale, so a missing-key render cannot occur.
  • The 4xx relay keeps the producer's text under zh-CN (pinned), so the change is confined to the door's own 5xx sentences, as the card asks.
  • The dev's ablation (hard-coded English restored: 4 red, the English controls green) shows the new pins bind to the rendering line. It is the dev's run, cited from the PR body, not re-run here.

Nits (no effect on correctness or the contract; candidates for the follow-up card, not for this PR):

  • Override address. operationMessageTranslationKey's docblock says a translation item defining errors.KEY overrides the built-in text. For the four print_* keys it does not: operationUserMessage passes no translator, and the door holds no i18n service. The PR body says this; the catalog header's print_* paragraph does not. record_not_found, query_field_not_readable and delegation_scope_violation already have the same gap on main at producers with no i18n service, so this follows precedent rather than breaking it.
  • Fault-log language. sendServerFault hands the same message to logServerFault, and serverFaultLogMessage (packages/types/src/server-fault-log.ts L284) prefers the thrown error's own message. Only a throw with an empty message would put the localized sentence in the operator's log line. The structured status, code and path fields are unaffected.
  • Top tag only. preferredLocaleFromHeader reads the first Accept-Language tag without q-value negotiation, so de, zh-CN;q=0.9 answers English. This is the platform's existing reading (resolve-execution-context.ts L279 uses the same helper), so the door agrees with every other door.

Implemented-by: claude/issue-37260-print-failure-locale
Reviewed-by: session_01QSeKYpEsWWE9Y5YtSsDgqZ

VERDICT: PASS

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW

Landing (2026-11-25T11:04Z): head 3dfbfdb5a135338fd76d80ceab81442c2315d4df, on L1 ACCEPT 7160466229 and the same-head contract review PASS 7160535636 (served at CONTRACT_REVIEW_TIER, schema face on operation-message.ts).

Probe Reading
check-governed-merges.mjs --pr 37272 NOT governed: 0 of 6 paths hit the register; +236 / −12
Check-runs at this head 58 success · 11 expected skip · 0 failed · 0 pending; mergeable_state: clean
Landing K 2 (L1's reading); under 15, so no main merge

State change: ready for review, and auto-merge armed; the merge queue lands it. On MERGED, #37260 closes by Fixes #37260, and #37273 (the remaining English sentences on the print path) unblocks.

The L1 nits N1–N5 (wording) and the contract review's nits (override address, fault-log language, top tag only) are not graded. They need no push here and are candidates for #37273.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 11:04
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit c94191d Nov 25, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37260-print-failure-locale branch November 25, 2026 11:43
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 protocol:system 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.

Print failure messages (503 'print engine is not ready', 504, 500) are hard-coded English and ignore the request locale

2 participants