Add P-038 ratchet test: English identifiers/comments in .py/.js - #406
Merged
Conversation
test_i18n_coverage.py (P-039) only scans template text for leaked German UI strings — it never looks at .py/.js source, so a German identifier or comment (the rechnung_pl case from the 2026-08-10 review) was only ever caught by a manual grep during periodic reviews. New test_code_language_policy.py automates that check: flags German diacritics and a curated list of German domain words in Python identifiers/comments (via ast + tokenize) and declared JS identifiers/comments (via regex), while leaving string literal *values* untouched — German data content (bilingual email subjects, clinical scaffolding text, tag descriptions) stays out of scope by construction, same as the existing i18n exemptions. Two pre-existing findings, fixed rather than allowlisted: a bank-statement-parsing comment and matching test name literally named the German keyword they parse for; test_contract_form.py had two test names describing German-vs-English PDF assertions using the German word for "date". Renamed to describe the same behavior in English. A third finding (two GebüH-billing test names using the German word for "total") is domain-adjacent but not itself untranslatable terminology, so it's recorded in KNOWN_VIOLATIONS as pre-existing debt instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171DPyqvcb88YiNzRmqMqBA
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.
Summary
test_code_language_policy.pycloses a real gap found during the 2026-09-01 quarterly review:test_i18n_coverage.py(P-039) only scans template text for leaked German UI strings — it never touches.py/.jssource, so a German identifier/comment was only ever caught by a manual grep once per review (therechnung_plfinding from the 2026-08-10 review is the precedent).ast/tokenize) and declared JS identifiers/comments (regex-based). Deliberately never inspects string literal values — German data content (bilingual email subjects, clinical scaffolding text, tag descriptions) is legitimate and out of scope by construction, mirroring the existing i18n exemptions.TERM_EXEMPTIONScovers untranslatable domain proper nouns (GebüH, EÜR, GOÄ, "Leistung") the same waytest_i18n_coverage.pyalready exempts them.KNOWN_VIOLATIONSis the ratchet allowlist for pre-existing debt not yet cleaned up (currently 2 entries: twotest_gebueh.pynames using the German word for "total").test_contract_form.pytest names using the German word for "date" — all renamed to describe the same behavior in English.Test plan
./dev.py test my_practice.tests.test_code_language_policy my_practice.tests.test_bank_import_utils my_practice.tests.test_contract_form my_practice.tests.test_gebueh my_practice.tests.test_i18n_coverage— 100 passed./dev.py test --fast— full suite (Django + JS) green./dev.py lint— ruff format/lint + Tailwind build clean🤖 Generated with Claude Code
https://claude.ai/code/session_0171DPyqvcb88YiNzRmqMqBA