Repository navigation
Conversation
Found while running workload tests against omniroute-beta: /api/health/ping
and /v1/models (any authenticated request) crashed with next-intl's
INVALID_KEY error and surfaced as a 404, because next-intl treats "." in a
message key as a namespace separator. Two spots in every locale file had
flat keys containing literal dots:
- resilienceConnections had four "degraded.source.X" keys as siblings of
resilienceConnections.degraded, which is itself a plain string
("Partial data: unavailable sources: {sources}") — so nesting them under
"degraded" directly wasn't an option, it already holds a string.
- Four top-level "capabilityFilter.X" keys (unused by any real i18n
call site today, based on this repo's own grep; the only match for
"capabilityFilter." elsewhere is an unrelated import path in
chatCore.ts's comment referencing shared/constants/capabilities/
capabilityFilter.ts).
Renamed to real nested objects: resilienceConnections.degradedSource.X and
top-level capabilityFilter.X (as an object). Values are byte-identical in
every one of the 43 locale files — only the key structure changed, no
translated text was touched. Updated the one real caller
(ResilienceConnectionsClient.tsx's t(`degraded.source.${s}`) ->
t(`degradedSource.${s}`)) and its test's assertion on the same string.
This is unrelated to the request-logger-keepalive-capture work this branch
exists for, but it made every API route unusable for live testing, so
fixing it here rather than working around it.
Test plan:
- All 43 locale JSON files re-validated as parseable JSON after the
transform; spot-checked en.json's before/after values are unchanged
- npx vitest run tests/unit/ui/resilience-connections.test.tsx: 17/17
passing (was failing before, asserting the old broken key literally
appearing in rendered output)
- tsgo --noEmit: clean
- Live: /api/health/ping and /v1/models on the running omniroute-beta
container went from 404 (INVALID_KEY crash) to 200/401 after this fix
f9fe34d to
691677c
Compare
|
Hey, thanks for the sharp catch and for the live verification against omniroute-beta — the INVALID_KEY crash you diagnosed here was real and nasty (killing every authenticated API route, not just the i18n-rendered pages). Since this PR was opened, the identical fix landed on One thing your PR does that the merged fix didn't: Given the core fix is already shipped, I'll be flagging this one to the maintainer as subsumed rather than merging it — but really appreciate the diagnosis and the live-testing rigor, that's exactly the kind of evidence we want on bug fixes. If you'd like to send the pt.json translation fix as a small standalone follow-up, that part is still very welcome. |
Resolve i18n message + ResilienceConnections conflict in favor of the base tip 774127b, which already nests resilientConnection 'degraded.message' / 'degraded.source.*' and 'capabilityFilter' — the same dotted-key fix this PR targets. The PR's i18n-nest-dotted-keys test remains green. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
The base tip 774127b already carries the equivalent dotted-key fix (nested 'degraded.message'/'degraded.source.*' + 'capabilityFilter') and the radar cache:no-store fetches + guard test. Align the merged tree to that tested, green state and align the resilience-connections test to the base key shape so asserts match the merged code. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Babysit summaryDrove CI to green. Result: all non-advisory gates pass — ready for human review/merge. Root cause of the red: the What I did:
dast-smoke note: the first run appeared red but its real conclusion was Final
Recommendation: since the base already carries this fix, the reviewer may treat the merge as effectively subsumed — but the branch is green and ready. Handing off for human merge (not merged here). |
|
Checked the optional follow-up you suggested (pt.json Verified against current |
|
Hi @hartmark — thanks for the careful diagnosis (the next-intl INVALID_KEY crash from dotted keys is real). The same structural fix already merged into |
What Problem This Solves
Every API route was crashing with a
next-intlINVALID_KEYerror and surfacing to callers as a bare 404 —GET /api/health/ping 404, and any authenticated request to/v1/models//v1/responses/ etc. hit the same crash. Found while running live workload tests againstomniroute-beta.next-intl treats
.in a message key as a namespace separator. Every locale file insrc/i18n/messages/had two spots with flat keys containing literal dots:resilienceConnectionshad four"degraded.source.X"keys as siblings ofresilienceConnections.degraded, which is itself a plain string ("Partial data: unavailable sources: {sources}") — so nesting them underdegradeddirectly wasn't an option, it already holds a string."capabilityFilter.X"keys, unused by any real i18n call site today (the only other match forcapabilityFilter.in the codebase is an unrelated import path referenced in achatCore.tscomment).next-intl validates the full key structure of a locale file at load/module-init time regardless of whether individual keys are ever read, so this broke every route touched by the i18n middleware — not just pages that render the resilience-connections UI.
Why This Change Was Made
Renamed the dotted keys into real nested objects:
resilienceConnections.degradedSource.Xand a top-levelcapabilityFilterobject. This is the structurally correct shape next-intl expects; the alternative (keeping the flat dotted string but escaping the dot some other way) doesn't exist in next-intl's key model.User Impact
Every authenticated API request and the health-check endpoint currently 404s. This restores them. No translated text changed — only key structure. Verified live:
/api/health/pingand/v1/modelswent from 404 (crash) to 200/401 (correct) on the same running instance after this fix.Evidence
ResilienceConnectionsClient.tsx'st(\degraded.source.${s}`)→t(`degradedSource.${s}`)`) and its test's assertion on the same string.Test plan:
en.json's before/after values are unchangednpx vitest run tests/unit/ui/resilience-connections.test.tsx: 17/17 passing (was failing before, asserting the old broken key literally appearing in rendered output)tsgo --noEmit: clean/api/health/pingand/v1/modelson the runningomniroute-betacontainer went from 404 (INVALID_KEYcrash) to 200/401 after this fix