fix(i18n): compose the AI-model diagnostics summary client-side (#2886) - #2912
Merged
Conversation
CloudAiModelStatus rendered `report.summary` verbatim — the most prominent line on the panel, in English for every locale. Reading objectstack-ai/cloud settled how to fix it. The server CANNOT localize that string as currently built: service-ai/src/effective-model.ts:117 assembles it as a hard-coded English template literal with no locale parameter, and routes/ai-routes.ts:395 declares `handler: async () => …` — taking no request argument, so it cannot read Accept-Language even though createAuthenticatedFetch has been sending it since #1319. But no server change is needed: every ingredient of the sentence is already in the structured payload (conversational.model/source, structured.model/pinned, routing.free/paid). The issue proposed "return structured data instead of a sentence" as the better fix — the server was already doing that, the client just wasn't using it. The panel now composes the line itself. sourceLabel() already produced exactly the clauses the server hand-rolls ("pinned by X", "code default (no env override)", "same as build/ask"), so no new source vocabulary was needed. A dropped diagnostic, not just untranslated text: the client's EffectiveModelReport never declared `routing`, which the server has always sent conditionally. Its only appearance anywhere was inside the English summary, so non-English admins could not see the plan→model routing policy at all. Now declared and surfaced. Also fixed: attributeSource emits the bare token 'unknown' when the adapter cannot report a model, and sourceLabel fell through to rendering it raw. Four keys added to all ten packs, so the full-parity guard from #2909 stays green. The panel had no test coverage at all; it now has five, mutation-tested by restoring `<p>{report.summary}</p>` — which fails four of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TubWYdWquVkS9dj733sDmC
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2886.
CloudAiModelStatusrenderedreport.summaryverbatim — the most prominent line on the panel, in English for every locale.What reading
objectstack-ai/cloudsettledThe issue left two questions open. Both now have definite answers.
1. The server does not localize it — and cannot, as currently built.
service-ai/src/effective-model.ts:117:A hard-coded English template literal, no locale parameter. And
service-ai/src/routes/ai-routes.ts:395:The handler takes no request argument, so it cannot read
Accept-Languageeven thoughcreateAuthenticatedFetchhas been sending it since #1319.2. No server change is needed anyway.
Every ingredient of the sentence is already in the structured payload:
build/ask uses Xconversational.model(pinned by … / code default)conversational.sourcestructured uses Ystructured.model(same as build/ask)structured.pinnedRouting policy: free → A, paid → Brouting.{free,paid}The issue proposed "return structured data instead of a whole sentence" as the better path. The server was already doing that — the client just wasn't using it. So this is client-only, and doesn't wait on cloud scheduling.
sourceLabel()already produced exactly the clauses the server hand-rolls —pinned by X,code default (no env override), andsame as build/askfor an unpinned structured model — so no new source vocabulary was needed.A dropped diagnostic, not just untranslated text
The client's
EffectiveModelReportnever declaredrouting, which the server has always sent conditionally. Its only appearance anywhere was inside the English summary string — so non-English admins could not see the plan→model routing policy at all. That's a diagnostic lost at the type layer, not a translation gap. Now declared and surfaced.Also fixed:
attributeSourceemits the bare token'unknown'when the adapter can't report a model, andsourceLabelfell through to rendering it raw.Verification
turbo build: 44/44.<p>{report.summary}</p>fails four of the five.The panel had no test coverage at all before this.
Note
Worth flagging from the process: my first test passed
<I18nProvider language="zh">. That prop does not exist — it's silently ignored at runtime, so the zh render produced English. My own "zh must differ from en" assertion caught it; the fix wascreateI18n({ defaultLanguage }).tscwould also have rejected it,vitestwould not — the same gap that motivated #2911.