Skip to content

fix: a deliberately enabled language code wins over a stray region tag - #392

Merged
JarbasAl merged 1 commit into
devfrom
fix/canonical-lang-code-wins
Aug 25, 2026
Merged

fix: a deliberately enabled language code wins over a stray region tag#392
JarbasAl merged 1 commit into
devfrom
fix/canonical-lang-code-wins

Conversation

@JarbasAl

@JarbasAl JarbasAl commented Aug 25, 2026

Copy link
Copy Markdown
Member

🤖 Auto-generated by Claude Opus 5 (claude-opus-5) via Claude Code — NOT human-reviewed. Verify before acting.

Kabyle was enabled as kab in #209 and is being served as kab-DZ. Kabyle has no commonly-used region subtag, so kab-DZ is invented.

merge_equivalent_langs sorted region-tagged codes first and treated the first as canonical for anything within tag distance 0. kab and kab-DZ are distance 0, so a kab-DZ locale directory was enough to rename the language for everyone.

The live deployed data confirms it:

$ curl -s https://openvoiceos.github.io/ovos-localize/data/coverage.json
merge_map: {'kab-DZ': 'kab-DZ', 'kab': 'kab-DZ'}

The same thing already happened to two more languages. an and ast are also enabled bare and are served as an-ES and ast-ES.

What changed

A code listed in config/enabled_languages.txt was chosen deliberately and now wins regardless of region specificity. Outside that set the more specific tag still wins, so da/da-DK merging is unchanged and sv-FI/sv-SE still stay separate.

A language whose code normalizes to itself is no longer reported as a bad lang code. The live issues.json currently reports locale/kab/ → locale/kab/ against ovos-skill-date-time and res/an/ → res/an/ against ovos-solver-YesNo-plugin: defect reports whose fix button commits nothing. Without this, the platform would ship kab as canonical and simultaneously report locale/kab as a defect.

Verification

Replaying the live deployed code list (63 raw pre-merge codes) through both versions:

an-ES  -> an
ast-ES -> ast
kab-DZ -> kab
6 merge_map entries change, 3 displayed languages rename

No other pair flips. Checked explicitly: pt-AO vs pt-PT/pt-BR, es-419, ar-XA/ar-XX, nb-NO/nn-NO, sv-FI/sv-SE, nl-BE/nl-NL, zh-CN/cmn-CN, mwl/mwl-PT. Language count stays 58.

Mutation-tested: deleting canonical_codes=enabled_langs from build_coverage_json — the only line that reaches production — now fails test_enabled_code_wins_through_build_coverage_json. Before this revision the entire suite stayed green through that deletion, so the fix was untested where it mattered.

merge_equivalent_langs is order-independent: 200 shuffles of the live input give one distinct result, so set iteration order in build_coverage_json cannot leak through.

Corrections to an earlier revision of this description

  • It claimed 2 entries changed and no collateral rename. That was measured against the already-merged 58-language list instead of the raw 63 pre-merge codes. The real figure is 6 entries and 3 renamed languages. The an/ast renames are intended, but they were not disclosed.
  • It named fix_lang_code.yml as the way to rename existing kab-DZ directories. That workflow cannot do it: ovos_localize/sync/github.py:182 only ever flags hyphen-less directories, so a region-to-bare rename is inexpressible there. A separate mechanism is needed.
  • The root cause is more specific than "a stray directory". The first kab-DZ directory is ovos-color-parser commit 02366bc (2026-07-16), whose message says kab while creating kab-DZ; the same repo seeded an-ES, ast-ES and mwl-PT. ovos-localize[bot] then propagated kab-DZ to three more skill repos. This PR stops new submissions from using the invented tag but does not clean up the existing directories.

Follow-up

ovos-skill-laugh, ovos-skill-application-launcher, ovos-skill-parrot and ovos-color-parser hold populated locale/kab-DZ directories, and 58 open bot pull requests carry kab-DZ paths. Those need a rename before merge, or Kabyle content splits across two directories.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a2a946dd-6228-4236-a801-14b0289531ab


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Kabyle was enabled as "kab" and served as "kab-DZ". merge_equivalent_langs
treated the more specific tag as canonical for any pair within tag distance
0, so one kab-DZ locale directory renamed the language for everyone: the
deployed merge map reads {"kab": "kab-DZ"}. Kabyle has no commonly-used
region, so every translation is filed under an invented tag, and merging
those pull requests spreads it across the ecosystem.

Codes listed in config/enabled_languages.txt were chosen deliberately and
now win regardless of region specificity. Outside that set the more specific
tag still wins, so da/da-DK is unchanged and sv-FI/sv-SE stay separate. This
also restores "an" and "ast", which are enabled bare and had been renamed to
an-ES and ast-ES the same way.

A language whose code normalizes to itself is no longer reported as a bad
lang code. Kabyle was listed as a repo defect offering to rename locale/kab
to locale/kab, which committed nothing.
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