Skip to content

feat(i18n): add per-repo dynamic-prefixes allowlist for check-keys.py - #335

Merged
krisarmstrong merged 1 commit into
mainfrom
feat/i18n-dynamic-prefixes
May 27, 2026
Merged

feat(i18n): add per-repo dynamic-prefixes allowlist for check-keys.py#335
krisarmstrong merged 1 commit into
mainfrom
feat/i18n-dynamic-prefixes

Conversation

@krisarmstrong

Copy link
Copy Markdown
Collaborator

Summary

Stem mirror of niac-go#732. Drops the unused-key warning count from
499 → 0 by allowlisting prefixes for keys consumed via dynamic
lookups the static regex can't see.

What was actually unused vs. dynamic

Pattern Count Why "unused" was wrong
`settings.tests.*` 93 TestsTab iterates the test catalog: `t(\`settings:tests.${test.id}.title\`)`
`cli.*` ~80 Consumed by the Go CLI's `--help` output, not the React TS frontend
`params..*` ~90 `ParamHelpPanel` resolves `t(\`params:${standard}.${param.name}\`)`
`modules.*` various `ModuleCard` renders `t(\`modules:${module.id}.${field}\`)` for 6 modules
`errors..*` ~50 Error mapper keys by daemon error classification
`common.{buttons,labels,status,results,time,units}.*` ~80 Intentional UI primitive reserve
`recovery.` / `security.` / `setup.*` ~30 Multi-step flows reading copy via current-step state
`settings.{general,advanced,interface,license,mode,...}.*` ~50 Settings drawer field-schema lookups

Two changes

  1. `check-keys.py`: reads optional
    `scripts/i18n/dynamic-prefixes.txt`, matches both bare paths and
    namespace-qualified forms. Identical to niac PR #732 patch.
  2. `scripts/i18n/dynamic-prefixes.txt`: stem's allowlist
    documenting each entry's WHY for future cleanup confirmation.

Test plan

  • `./scripts/i18n/validate.sh` — OK
  • `./scripts/i18n/check-keys.py` strict — `✓ every EN locale
    key is referenced by at least one t() call`
  • CI: `i18n Validation` job

Cross-product backfill

Repo PR
niac-go #732 (in-flight)
stem this PR
seed sibling PR pending

Stem mirror of niac-go#732. Drops the unused-key warning count from
499 → 0 by allowlisting prefixes for keys consumed via dynamic
lookups the static regex can't see:

- settings.tests.* — TestsTab iterates the test catalog and looks up
  t(`settings:tests.${test.id}.title`) for 27 tests
- cli.* — consumed by the Go CLI's --help output, not the React TS
  frontend; whole namespace is data
- params.<standard>.* — ParamHelpPanel resolves t(`params:${standard}.
  ${param.name}`) inside a standard → params subtree mapping
- modules.* — ModuleCard renders t(`modules:${module.id}.${field}`)
  for Reflector/Benchmark/ServiceTest/TrafficGen/Measure/Certify
- errors.<category>.* — error mapper resolves t(`errors:${category}.
  ${code}`) keyed by daemon error classification
- common.{buttons,labels,status,results,time,units}.* — UI primitive
  reserve
- recovery.* / security.* / setup.* — multi-step flows reading copy
  via current-step state
- settings.{general,advanced,interface,license,mode,reflector,sections,
  testing}.* — Settings drawer field-schema lookups

Two changes:
- check-keys.py: reads optional scripts/i18n/dynamic-prefixes.txt,
  matches both bare paths and namespace-qualified forms (identical
  to niac PR #732 patch)
- scripts/i18n/dynamic-prefixes.txt: stem's allowlist documenting
  each entry's WHY for future cleanup confirmation

Validator now reports:
- ✓ every t() call has a matching EN locale key
- ✓ every EN locale key is referenced by at least one t() call

Once seed gets the same treatment (sibling PR pending) and all 3
repos hit 0 unused warnings, promote check-keys.py's unused-key
check from warn-only to fail.
@krisarmstrong
krisarmstrong enabled auto-merge (squash) May 27, 2026 15:51
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions

Copy link
Copy Markdown
Contributor

License Compliance Report

All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 31 package(s)
  • MIT: 26 package(s)
  • BSD-3-Clause: 16 package(s)
  • Apache-2.0: 11 package(s)
  • BSD-2-Clause: 1 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant