fix(api): reconcile seeded language translations on startup#1783
Open
MrDirkelz wants to merge 2 commits into
Open
fix(api): reconcile seeded language translations on startup#1783MrDirkelz wants to merge 2 commits into
MrDirkelz wants to merge 2 commits into
Conversation
Add an idempotent startup step that syncs seeded English/French translation keys into language docs, prunes stale keys across all languages, and preserves existing production values.
Add an idempotent startup reconciler for seeded English/French translation keys and cover bootstrap wiring in tests.
Collaborator
|
reconcileLanguageTranslationSeeds processes every Language doc via processAllDocs([DocType.Language], ...), but the key-pruning loop (lines 55-61) isn't scoped to SEEDED_LANGUAGE_IDS — it drops any key not in the English/French seed's key set from every language document, not just lang-eng/lang-fra. The included test even demonstrates this: the lang-spa fixture loses its legacy.key alongside the seeded docs. On a real deployment this means any translation key added for a non-English/French language (via CMS or otherwise) that isn't also present in the English/French seed gets silently deleted on every API restart. Pruning should only apply when doc._id is in SEEDED_LANGUAGE_IDS; other languages should pass through untouched. |
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.
Add an idempotent startup step that syncs seeded English/French translation keys into language docs, prunes stale keys across all languages, and preserves existing production values.