Skip to content

make gen-i18n prints success and exits 0 even when it wrote nothing #302

Description

@antosubash

scripts/gen_i18n.py calls emit_frontend_types_for_modules and then unconditionally prints
"i18n key files regenerated" (scripts/gen_i18n.py:22-23). That function swallows every failure by
design — "stale types are preferable to a broken boot" — logging it and returning normally
(framework/hosting/simple_module_hosting/i18n_manifest.py:83-94). The script also never configures
logging, so the logger.info("Wrote %s (%d keys)", …) lines that would say what actually happened
(i18n_manifest.py:122, :126) are below the default threshold and never appear.

The result is a tool that reports success identically whether it regenerated the key files or failed
to write any of them, with no output to distinguish the two. The next symptom is a tsc error about
a key that exists in the catalog, several steps removed from the cause.

What would fix it: add logging.basicConfig(level=logging.INFO) to the script so the per-file lines
are visible, and have the script report the real outcome — either by having
emit_frontend_types_for_modules return what it wrote, or by giving it a strict flag that re-raises
for callers (this script, make gen-i18n) that are not a live boot and should fail loudly.

Two stale comments in the same area, from when generate_verification_token was collapsed into
UserManager.mint_invite_token (modules/users/users/manager.py:171) — neither name resolves to
anything in this tree or in fastapi-users:

  • tests/e2e/conftest.py:88 — "The token shape mirrors what UserManager.generate_verification_token produces".
  • modules/users/tests/test_user_manager.py:178 — the section banner # generate_verification_token above class TestMintInviteToken.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions