Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Embeds hashed localization paths in Settings HTML, removing a blocking manifest request and stale-CDN risk.
Changes:
- Generates and embeds a filtered localization asset map.
- Reads the map with graceful fallback behavior.
- Updates Nx cache dependencies and localization tests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/fxa-settings/scripts/start.js |
Embeds the map during development. |
packages/fxa-settings/scripts/l10n-asset-map.js |
Filters and encodes manifest mappings. |
packages/fxa-settings/scripts/build.js |
Embeds the map during builds. |
packages/fxa-settings/public/index.html |
Adds the asset-map meta tag. |
packages/fxa-settings/package.json |
Makes build caching manifest-aware. |
packages/fxa-react/lib/AppLocalizationProvider.tsx |
Replaces manifest fetching with meta-tag parsing. |
packages/fxa-react/lib/AppLocalizationProvider.test.tsx |
Tests mapped paths and fallback behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+84
to
+90
| if ( | ||
| typeof mappings === 'object' && | ||
| mappings !== null && | ||
| Object.keys(mappings).length > 0 | ||
| ) { | ||
| return mappings; | ||
| } |
## Because - The guard in `readL10nHashedMappings` accepted any non-null object with at least one key. A JSON array got through, and so did an object whose values were empty strings or nested objects. - `fetchMessages` then treated that map as real. Every lookup missed, each bundle came back empty, and the page ended up with no l10n resources at all rather than the unhashed-path fallback the comment promises. - The warning did not fire either, so nothing said why the strings were missing. ## This pull request - Rejects arrays and requires every mapped value to be a non-empty string. Anything else falls through to the warning that is already there and returns `undefined`. - Adds three rows to the fallback table in `AppLocalizationProvider.test.tsx`: an array, an empty string value, and a non-string value. I reverted the guard and re-ran to check that all three fail without it. ## Issue that this pull request solves Closes: https://mozilla-hub.atlassian.net/browse/FXA-11871
5 tasks
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.
Because
readL10nHashedMappingsaccepted any non-null object with at least one key. A JSON array got through, and so did an object whose values were empty strings or nested objects.fetchMessagesthen treated that map as real. Every lookup missed, each bundle came back empty, and the page ended up with no l10n resources at all rather than the unhashed-path fallback the comment promises.This pull request
undefined.AppLocalizationProvider.test.tsx: an array, an empty string value, and a non-string value. I reverted the guard and re-ran to check that all three fail without it.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-11871
Checklist
Put an
xin the boxes that applyHow to review (Optional)
packages/fxa-react/lib/AppLocalizationProvider.tsxand the three new rows in its spec.Screenshots (Optional)
Other information (Optional)
fetchMessages,fetchAllMessages, andcreateFluentBundleGeneratorare untouched. A per-path fallback instead of a per-map one is a different design and is not in this change.