Skip to content

fix: guard gen-i18n against dropping namespaces; correct alembic branch-label docs - #403

Merged
antosubash merged 4 commits into
mainfrom
fix/gen-i18n-guard-and-alembic-docs
Oct 7, 2026
Merged

antosubash merged 4 commits into
mainfrom
fix/gen-i18n-guard-and-alembic-docs

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Fixes #329
Fixes #333

Summary

  • make gen-i18n silently deletes keys for modules that aren't installed in the current venv #329: scripts/gen_i18n.py compares top-level namespaces in the existing generated-resources.ts with the new emission. If any would disappear it exits 1 naming each namespace and key count and pointing at uv sync --all-packages; --allow-removals overrides (deleted module, or a deliberate SM_MODULES_ENABLED subset; subsetting behaviour is otherwise unchanged). The dev-boot path (emit_frontend_types, non-strict) logs a warning and skips writing instead of raising. Tests added in scripts/tests/test_gen_i18n.py. New CI step in the python-lint job (full uv sync --all-packages) runs the generator then git diff --exit-code packages/i18n/src/. Generator output is deterministic and was clean on main. The generated-file header now mentions make gen-i18n (hence the 1-line diff in both generated files).
  • alembic downgrade <module>@base walks the whole revision chain — the per-module rollback promised in module-authoring.md does not hold #333 (docs only, option 1): branch labels are a named target, not an isolated branch; downgrade <module>@base walks the whole chain beneath it. Documented the safe removal recipe (downgrade to the first revision's down_revision only when the module is latest, otherwise a dedicated migration). Fixed docs/module-authoring.md, CLAUDE.md, docs/database/migrations.md, docs/guide/{quickstart,first-module,project-structure}.md, docs/reference/make-commands.md, and skills/simple-module-migrations/SKILL.md. No scaffold template carried the claim. Historical specs/plans under docs/superpowers/ left untouched.

Verification

make lint passes. make test-py: 3574 passed, 1 failure (an existing gen_i18n test that tripped the new guard); fixed and re-run targeted (21 passed). The full suite was not re-run after that one-line test fix.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

…s are not per-module rollback

gen_i18n now fails (exit 1) when regenerating would delete a namespace present in the checked-in files (module not installed), unless --allow-removals. The dev-boot path warns and skips writing instead of crashing. CI gains a drift check. Docs, CLAUDE.md and the migrations skill no longer claim downgrade <module>@base is a per-module rollback.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-05T10:39:01.289776Z bd04450 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 37dd985
Status: ✅  Deploy successful!
Preview URL: https://a531f661.simple-module-python.pages.dev
Branch Preview URL: https://fix-gen-i18n-guard-and-alemb.simple-module-python.pages.dev

View logs

@antosubash

Copy link
Copy Markdown
Owner Author

/ship results

Review: 2 passes (sonnet, built-in code-review). Pass 1: 5 findings, 3 fixed (pushed as aa5170a: make gen-i18n ARGS= passthrough + hint in the error, doc wording for branch labels/upgrade heads); 2 accepted trade-offs left (dev-boot guard skips the whole write when any namespace is missing; CI git diff --exit-code ignores untracked files). Pass 2: clean, 0 findings.

QA (no browser surface; behaviour exercised directly), with SM_MODULES_ENABLED='["users","settings"]':

  • scripts/gen_i18n.py with all modules installed: exit 0, no diff.
  • Subset install: exit 1, error names the 10 dropped namespaces (audit_log, auth, background_tasks, branding, dashboard, feature_flags, file_storage, keycloak, permissions, tenants) and the --allow-removals hint; generated files untouched.
  • Subset install with --allow-removals: exit 0, files rewritten (-1434 lines, then restored).
  • Non-strict dev-boot path (emit_frontend_types_for_modules(strict=False)) with the subset: logs a WARNING, does not write, does not raise.
  • CI drift step (gen_i18n.py + git diff --exit-code packages/i18n/src/) simulated locally: clean.

Local checks: make lint exit 0; make test-py exit 0 (3575 passed, 9 skipped).

Commit pushed: aa5170a.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

@antosubash
antosubash merged commit e788deb into main Oct 7, 2026
13 checks passed
@antosubash
antosubash deleted the fix/gen-i18n-guard-and-alembic-docs branch October 8, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant