You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(runtime,i18n): field labels read the bundle shape producers write — one shared derivation (#3833) (#3846)
`GET /i18n/labels/:object/:locale` served through the dispatcher returned
`{ labels: {} }` for every provider. Its derivation scanned for flat
`o.<object>.fields.<field>` keys — the dialect #3778 retired. No producer has
ever written it, and a real bundle's top-level keys are the `TranslationData`
groups (`objects`, `apps`, `messages`, ...), so the prefix matched nothing.
4cca74c fixed the identical derivation in service-i18n and did not reach the
dispatcher's copy.
Not a rare fallback: `getFieldLabels` is optional on `II18nService` and nothing
implements it — not `memory-i18n`, not `file-i18n-adapter` — so the dedicated-
method branch both surfaces check first is dead in production and this
derivation is the only path there is. Any stack served by the dispatcher got an
empty map, indistinguishable from "this object has no translated labels".
Nothing errored, nothing warned.
Worse than the class it was found beside: #3676 ignored a declared filter and
returned the full bundle, a correct superset. This returned nothing and said it
was fine.
The derivation now lives once, as `resolveObjectFieldLabels` in
`packages/spec/src/system/i18n-resolver.ts`, beside the other resolvers that
read `TranslationData`. Both surfaces call it — keeping a copy each is precisely
how one got fixed and the other did not. Fields with no non-empty `label` stay
omitted rather than emitted blank: partial translation is the normal state, and
callers merge this map over their source labels, where a '' would erase them.
The tests were fiction on both sides. The dispatcher's fallback test fed flat
`o.contact.fields.first_name` keys and asserted labels came back, so it passed
on data that cannot occur while production returned `{}` — the same failure mode
as the client test retired in #3676. It now feeds the nested shape, and was
confirmed to FAIL against the pre-fix code rather than merely passing after it.
The same suite's mock declared a `getFieldLabels` no shipped provider has and
returned flat-dialect data; both now reflect what a real provider does. The
shared helper carries unit tests, including one pinning the retired flat dialect
to `{}`.
Filed separately, not addressed here: `GetFieldLabelsResponseSchema` declares
`labels` as `Record<string, { label, help?, options? }>` while both surfaces emit
`Record<string, string>` — a third declared != enforced gap on this endpoint
(#3847), and a wire-shape change too breaking to fold into a correctness fix.
0 commit comments