Skip to content

Measure the CLDR corpus with each locale pack too - #673

Merged
derek73 merged 2 commits into
masterfrom
feat/cldr-locale-view
Oct 13, 2026
Merged

derek73 merged 2 commits into
masterfrom
feat/cldr-locale-view

Conversation

@derek73

@derek73 derek73 commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Closes #672.

tools/differential/cldr_agreement.py gains a locale view. LOCALE_FILES maps each CLDR file to its language's pack:

  • zh, zh_Hant, yue and yue_Hans map to ZH.
  • ja maps to JA.
  • ru maps to RU.
  • tr and az map to TR_AZ.

Those renderings are parsed with parser_for(pack), over the same FAMILY_FIRST base where CLDR's order is surnameFirst. Their disagreements are recorded in the new cldr_agreement_locales.json, and test_cldr_agreement.py ratchets them per pack. The summary now prints each pack's before/after:

JA     ja: 7/24 default -> 12/24 with the pack
RU     ru: 17/24 default -> 17/24 with the pack
TR_AZ  az, tr: 32/48 default -> 32/48 with the pack
ZH     yue, yue_Hans, zh, zh_Hant: 22/96 default -> 42/96 with the pack

These figures reproduce the issue's table, except that ZH's default count is 22 where the issue measured 21 on 1f0b374.

How the issue's open questions were settled:

  • The ja extra: there's no env switch. Without namedivider, the JA ratchet is a visible pytest skip. That's safe because CI's ja-extra job runs import namedivider before pytest, so it can't skip there.
  • Re-recording: one --record rewrites both records. Without the extra, it keeps the recorded ja entries unchanged.
  • Mapping completeness: a test fails on a registered pack that is neither in LOCALE_FILES nor in NO_CLDR, and on a mapped file with no renderings.
  • Separate record: the locale view gets its own file. cldr_agreement.json is byte-identical.

Review found that record entries whose file leaves LOCALE_FILES fell in no pack's check and survived re-records. Fixed in the second commit: such entries are now reported as gone, and the re-record drops them. That commit also adds the lesson to AGENTS.md's filter-test paragraph.

Verified:

  • ruff and mypy are clean, and the full suite passes (16,631 passed) without the extra.
  • With the extra, the JA ratchet passes, and re-recording without it leaves both records byte-identical.
  • Negative controls: when the locale view falls back to the default parser, the pack pin plus the ZH and JA ratchets fail. When the carry-over fix is reverted, its test fails.

🤖 Generated with Claude Code

derek73 and others added 2 commits October 13, 2026 02:27
cldr_agreement.py gains a locale view: LOCALE_FILES maps each CLDR file
to its language's pack, those renderings are parsed with
parser_for(pack) over the shape's base order, and the disagreements are
recorded in cldr_agreement_locales.json, ratcheted per pack by
test_cldr_agreement.py. The summary prints each pack's all-roles
agreement under the default parser and under the pack:

  JA     ja: 7/24 -> 12/24
  RU     ru: 17/24 -> 17/24
  TR_AZ  az, tr: 32/48 -> 32/48
  ZH     yue, yue_Hans, zh, zh_Hant: 22/96 -> 42/96

One --record rewrites both records. JA needs the ja extra: without it
the JA ratchet skips visibly (CI's ja-extra job imports namedivider
first, so it cannot skip there) and --record keeps the recorded ja
entries unchanged. A test fails on a registered pack that is neither
mapped nor listed in NO_CLDR, and on a mapped file with no renderings.

The default record is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review found that an entry whose file is no longer mapped falls in no
pack's share of the record: no check read it, and --record's carry-over
kept it, since None is not a measured pack. It is now reported as gone,
and the carry-over keeps only the entries of mapped packs that were not
measured. AGENTS.md records the class beside the filter-test paragraph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Oct 13, 2026
@derek73 derek73 added this to the 2.5 milestone Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (c16df14) to head (14abd6a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #673   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files          46       46           
  Lines        4534     4534           
=======================================
  Hits         4490     4490           
  Misses         44       44           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73
derek73 merged commit affabb9 into master Oct 13, 2026
12 checks passed
@derek73
derek73 deleted the feat/cldr-locale-view branch October 14, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Measure the CLDR corpus with each locale pack too, so a pack change shows its effect

1 participant