Repository navigation
chore: sync react localization from platform-localization - #451
platform-localization-pr-bot[bot] wants to merge 7 commits into
Conversation
🦋 Changeset detectedLatest commit: 7a5bbf0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Locale syncs can grow the two UI JS bundles, so raise those ceilings to measured sizes and fail CI until .size-limit.js is updated on locale-only diffs.
cameronapak
left a comment
There was a problem hiding this comment.
Review
No Jira. No written spec.
Summary
Standards: 0 must-fix. Spec: 0 must-fix. Primary concern: the check still fails locale-only PRs instead of excluding translations, so please confirm that's the outcome you want.
Review evidence
- Scope: e239779, diffed against the merge-base with
main. Intent comes from the author's note in the review request ("exclude the translations files from the size check") and the commit message. The PR body is the bot's sync template. - Method: I traced
scripts/check-bundle-size.mjs,scripts/bundle-size-policy.mjs, the CI job, andresources.generated.ts. The Standards, Spec, and Correctness lenses ran as sequential passes.
| Behavior or check | Method / command | Result | Evidence source |
|---|---|---|---|
| Policy unit tests | node --test .github/scripts/bundle-size-policy.test.mjs |
10 of 10 pass | Coordinator |
| Size at PR head | pnpm build && pnpm size:check |
All entries within their limits. YouVersionProvider 61.52 / 62 KB, full barrel 179.15 / 180 KB | Coordinator |
| Raise path on a locale-only diff | Local simulation with a base branch at the old 54 / 175 KB limits | Rewrote the limits to 62 / 180 KB and exited 1 | Coordinator (temporary branches deleted) |
| Locale weight | Brotli of the 19 locale JSON files combined | About 28 KB (approximate, not bundle attribution) | Coordinator |
- Limits: I didn't verify how the sync bot pushes its branch.
- CI and bot review: all checks green at this head, including Bundle Size. The only bot comment is changeset-bot.
- Event: COMMENT
Written by Code Reviewer bot on behalf of Cam.
| ru: { [defaultNS]: locale13 }, | ||
| sr: { [defaultNS]: locale14 }, | ||
| tr: { [defaultNS]: locale15 }, | ||
| uk: { [defaultNS]: locale16 }, |
There was a problem hiding this comment.
suggestion: Consider lazy-loading non-English locales, so every consumer stops downloading all 19 languages and the size gate stops growing with each sync.
For Agents: the size gate is measuring real shipped bytes
Every locale is a static import here, so all of them land in the
YouVersionProviderentry. Compressing the 19 locale JSON files together gives about 28 KB brotli (an approximation, not exact bundle attribution) of the 61.52 KB entry, and this sync moved that entry from about 54 KB to 61.5 KB. Loading non-default locales on demand (for example, dynamicimport()per language via an i18next backend, or a resolver insyncSdkLanguage) would keep them out of the measured entry, which is a real exclusion, and shrink consumer bundles. Tradeoff: an async language switch and a build-shape change in the UI package. If that's too large for now, a lighter option is to bump the limits by hand in sync PRs. That's what this PR does at.size-limit.jsanyway, and it would drop roughly 516 lines of new script and tests. ADR 0003 already treats these gates as accident guardrails, and any PR can edit.size-limit.js.
Written by Code Reviewer bot on behalf of Cam.
There was a problem hiding this comment.
@cameronapak I considered this and this is where I landed curious as to your thoughts.
We kept every language loaded up front because the SDK promises the right language on the first screen.
If Spanish is set, the server HTML and the first paint need to already be Spanish. Loading languages later would mean English first, then a swap, or a mismatch between server and client. App developers would have to wait on that, and we would own failed downloads and broken packages.
Smaller download for English-only apps was not worth breaking that.
A locale-only diff passes without rewriting .size-limit.js. The workflow owns the shallow base fetch; the size check only verifies that ref.
|
@camrun91 Thanks for the replies and the follow-up in platform-localization#92. Your reason for loading every language up front makes sense, so I'm dropping the lazy-loading suggestion. Stepping back, I'd like to propose something simpler than either PR's automation. Proposal: Remove the Why:
What that looks like:
Trade-off: Nothing blocks a merge if the Provider bundle grows. If we later find that nobody looks at the numbers, we can add a PR size-change comment then. What do you think? Written by Code Reviewer bot on behalf of Cam. |
This makes sense to me I will work on that now. |
cameronapak
left a comment
There was a problem hiding this comment.
Review
No Jira. Spec is the PR body.
Summary
Standards: 0 must-fix. Spec: 0 must-fix. Primary concern: none.
The current head implements the agreed simplification: keep translations and both size measurements, remove only the two UI limits, and restore plain pnpm size without localization-specific automation.
Review evidence
- Scope: 7a5bbf0, compared with merge-base
3073603aa30b5340aa3b63d020df3e992f8f844a. Head rechecked before submission. Intent includes the author's acceptance of the simplification and synchronous locale loading. - Method: independent Standards, Spec, and Correctness source passes, reconciled against current code, tests, CI, and resolved discussion. No new handwritten helpers or dependencies need a reuse alternative.
| Behavior or check | Method / command | Result | Evidence source |
|---|---|---|---|
| Locale registration and preservation | Read-only bun - assertions against pinned Git objects |
All 19 locale bundles parse, map correctly, preserve interpolation/markup contracts, and match the original translation commit byte-for-byte | Coordinator |
| Budget and workflow scope | Read-only configuration assertions and source diff | Exactly two limits removed; eight other budgets, CI workflow, and package scripts unchanged | Coordinator |
| Size measurement | pnpm size |
Provider 61.52 kB and full barrel 179.15 kB printed without limits; all eight remaining budgets pass | CI logs |
| Locale checks | pnpm check:i18n and existing i18n tests |
Parity passes with 149 permitted warnings; all 56 i18n tests pass | CI logs |
| Regression checks | Build, lint, typecheck, tests, and tree-shaking | Passed | CI |
- Limits: full suites were inspected in CI, not rerun locally. No native-speaker translation review, rendered-locale visual check, or independent upstream-revision comparison. Missing translations retain English fallback.
- Review context: earlier CI-policy concerns are resolved by the reverts. The lazy-loading suggestion was explicitly withdrawn; companion auto-bump work is separate.
- Event: APPROVE.
Written by Code Reviewer bot on behalf of Cam.
| path: 'packages/ui/dist/index.js', | ||
| import: '{ YouVersionProvider }', | ||
| limit: '54 KB', | ||
| ignore: ['react', 'react-dom', 'react/jsx-runtime', '@tanstack/react-query'], |
There was a problem hiding this comment.
praise: Keeping these measurements while removing only their limits preserves visibility without weakening the Separator canary or unrelated budgets.
For Agents: scoped simplification
The Provider and full-barrel entries still run in plain
pnpm size. CI prints 61.52 kB and 179.15 kB without ceilings, while the other eight entries retain their existing hard limits. This achieves the accepted outcome without locale-specific skip or auto-bump machinery.
Written by Code Reviewer bot on behalf of Cam.
Automated localization sync from
platform-localization.13a69145193a15a63a05633f5f7e3a0291cad89bDistribute React LocalizationSize limits
Translations stay.
ui / YouVersionProvider onlyandui / full barrelare still measured and printed by size-limit, with nolimit, so locale growth does not fail CI. There is no locale-only skip and no ceiling bump.Separator, core, hooks, and CSS keep their hard limits. The bundle-size job is plain
pnpm size.