fix(i18n): make make gen-i18n fail loudly instead of reporting success - #305
Merged
Conversation
`emit_frontend_types` swallows every write failure by design — a live boot prefers stale types to a broken start. `scripts/gen_i18n.py` inherited that and then printed "i18n key files regenerated" unconditionally, so the command whose only job is writing those two files reported success identically whether it wrote them or wrote nothing. With no logging configured, the per-file INFO lines that would have distinguished the two never appeared either. The next symptom was a `tsc` error about a key the catalog does contain. Add a `strict` flag to `emit_frontend_types` / `emit_frontend_types_for_modules` that re-raises rather than logging, and pass it from the script. Under strict a missing `packages/i18n/src` is an error too, where on the boot path it stays the normal shape of a wheel-installed app that ships no i18n workspace. The script now configures logging for that one logger — the root stays at WARNING so discovery's per-module chatter doesn't bury the two lines that answer the question the command was run to ask. Also refresh two comments naming `UserManager.generate_verification_token`, which was collapsed into `mint_invite_token` and resolves to nothing today. Closes #302
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
caa1b34
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://14b06d9c.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-gen-i18n-strict.simple-module-python.pages.dev |
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.
Closes #302
The problem
emit_frontend_typesswallows every write failure by design — a live boot prefers stale types to a broken start.scripts/gen_i18n.pyinherited that behaviour and then printed"i18n key files regenerated"unconditionally, so the command whose only job is writing those two files reported success identically whether it wrote them or wrote nothing at all. The script configured no logging either, so thelogger.info("Wrote %s (%d keys)", …)lines that would have distinguished the two cases were below the root threshold and never appeared.The next symptom was a
tscerror about a key that does exist in the catalog — several steps removed from the cause.The fix
emit_frontend_types/emit_frontend_types_for_modulestakestrict: bool = False. Under strict they re-raise instead of logging, and a missingpackages/i18n/srcis an error rather than a silent skip. The boot path is unchanged: defaultstrict=Falsekeeps stale-types-over-broken-boot, and a missing package directory stays the normal shape of a wheel-installed app with no i18n workspace.scripts/gen_i18n.pypassesstrict=True, configures logging for thei18n_manifestlogger only (root stays atWARNING, so discovery's per-module chatter doesn't bury the answer), and closes with"i18n key files up to date".UserManager.generate_verification_token, collapsed intomint_invite_tokenand resolving to nothing in this tree (tests/e2e/conftest.py,modules/users/tests/test_user_manager.py).Verification
Before / after on an unwritable
keys.generated.ts:i18n key files regeneratedPermissionError: [Errno 13] …01Normal run, with a file to write:
uv run pytest framework/hosting/tests/test_i18n_manifest.py framework/hosting/tests/test_strict_discovery_wiring.py modules/users/tests/test_user_manager.py— 36 passed (5 new, covering strict/non-strict × missing-package/write-failure)ruff format --check,ruff check,ty check framework/hosting scripts,check_file_size.py— all pass