feat(locale): one .voc per month, so a spelling can have its own line - #380
openvoiceos-bot wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
At your service! I've gathered all the check results for you. 🫡I've aggregated the results of the automated checks for this PR below. ⚖️ License CheckChecking the paperwork! Everything seems in order. 📂 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🔨 Build TestsMeasuring the stability of the build output. 📏 ✅ All versions pass
📊 CoverageCoverage report incoming! Every line counts. 🎯 Files below 80% coverage (32 files)
Full report: download the End of Line. ⬛ |
A .voc file is unordered. OVOS-INTENT-2 §4.3 defines the slot-free roles and says each "loads as the union of the sample sets of all its lines". A union has no order and no fixed length, so a month table cannot be a file whose Nth line is the Nth month. Per-month granularity needs a file per month. months.voc was read by position, and that reading made the format's own allowance a defect. Adding a third spelling of March on its own line, which §4.3 permits, on dev 6bda4d9: DEV months loaded: 13 la 1 semaine de marz -> month 4 (want 3) la 1 semaine de avril -> month 5 (want 4) la 1 semaine de decembre -> month None (want 12) December falls off the end. The same three spellings in month_march.voc on this branch answer 3, 3, 4 and 12. month_1.voc through month_12.voc hold every spelling of one month each, January first. The number is in the FILE NAME, never a line position, so a file's lines stay an unordered set and a spelling may sit on any of them. That is the shape chronologia already ships, and its own loader reads. All 61 of its packaged locales carry month_1.voc .. month_12.voc, and every one of the 24 that also ships months.voc carries both. Using the same names gives one shape for one thing across the two roots this loader searches, instead of a second spelling that would need a translation layer or a migration of a dependency. THE ORDER LIVES IN CODE. _MONTH_VOC lists the twelve file names in calendar order and the file NAME maps to the month number. No line number is read, so a month's spellings are just lines, in any order. _load_months has three cases and the loud one is the middle: all twelve present the twelve fragments, in _MONTH_VOC order some present, some missing raises, naming the locale and each missing file none present reads the deprecated months.voc and warns The fragment form is unchanged, so the two existing tests that assert on it pass untouched. months.voc is deprecated rather than deleted, but nothing in the fleet now needs it: measured after the rename, all 61 chronologia locales load twelve months natively and NONE takes the deprecated path. It stays for a locale root outside the fleet that ships months.voc without the per-month files, and the warning names a computed removal version, 1.0.0, against the current 0.33.2a1. No chronologia change is required. An earlier revision of this branch used month_<name>.voc and argued that 18 locales would otherwise lose their months; that argument was an artefact of the naming, not a fact about the dependency. Consumer sweep before deprecating: gh search code over both orgs returns this repository and ovos-localize, where the only code hit is a comment using the path as an example. It does NOT return chronologia, which ships these files for 61 locales, because code search indexes file content and not file names. A local clone sweep found it. That sweep found the months.voc files; it did not look for month_<n>.voc, which is why the first revision of this branch invented a second name for a file the dependency already had. Verified per locale: the 6 locales here and all 61 chronologia locales load twelve from per-month files with no warning. Nothing takes the deprecated path and nothing regresses. The count guard cut earlier for this task is withdrawn and not re-cut. It argued from the premise that line N is month N, which the format does not grant. T-4767. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2812b65 to
3d60558
Compare
A
.vocfile is unordered.OVOS-INTENT-2§4.3, verbatim:A union has no order and no fixed length, so a month table cannot be a file
whose Nth line is the Nth month. Per-month granularity needs a file per month.
What the positional reading cost, measured on dev
Adding a third spelling of March on its own line — which §4.3 permits, because
the file is a union of its lines — on
dev6bda4d9:December falls off the end. The same three spellings in
month_march.voconthis branch:
The design
month_1.vocthroughmonth_12.voc, one file per month, January first, everyspelling of that month on its own line. The number is in the file name,
never a line position, so a file's lines stay an unordered set and a spelling
may sit on any of them.
This is the shape
chronologiaalready ships, and its own loader reads.All 61 of its packaged locales carry
month_1.voc…month_12.voc, and everyone of the 24 that also ships
months.voccarries both. Using the same namesgives one shape for one thing across the two roots this loader searches,
instead of a second spelling that would need a translation layer or a migration
of a dependency. An earlier revision of this branch used
month_<name>.vocandwould have created exactly that second shape.
The order lives in code.
_MONTH_VOClists the twelve file names incalendar order, and the file NAME maps to the month number. No line number is
read.
_load_monthshas three cases, and the loud one is the middle:_MONTH_VOCordermonths.vocand warnsThe fragment form is unchanged —
_month_alt, deduped and longest-first inside(?:…)— sotest_locale_fr_month_vocabandtest_locale_kab_per_file_fallback, which assert on it, pass untouched.months.vocis deprecated, and nothing in the fleet needs it nowMeasured after the rename, across every locale reachable through both roots:
plus the 6 locales this repository ships, also natively. Nothing takes the
deprecated path, so no
chronologiachange is required.months.vocsupport stays for a locale root outside the fleet that ships itwithout the per-month files, and the warning names a computed removal version,
1.0.0, against the current0.33.2a1.An earlier revision of this branch argued that 18 locales would otherwise lose
their months. That was an artefact of the naming rather than a fact about the
dependency: those locales already had
month_<n>.vocall along.Consumer sweep before deprecating
gh search code "months.voc"over both orgs returns this repository andovos-localize, where the only code hit is a comment using the path as anexample (
ovos_localize/locale_rules.py:41), with further hits inclassification datasets.
It does not return
chronologia, which ships these files for 61 locales,because code search indexes file content and not file names. A local clone
sweep found it.
Worth knowing for the next sweep of this kind, including the part it got wrong:
that sweep looked for
months.vocand did not look formonth_<n>.voc, whichis why the first revision of this branch invented a second name for a file the
dependency already had. A filename sweep has to enumerate the shapes it might
find, not only the one it is replacing.
Tests
test/test_month_per_file_voc.py, nine cases: every shipped locale has twelvenon-empty month files; two spellings of one month resolve to the same month
(fr
février/fevrier,août/aout,décembre/decembre, demärz/maerz); three spellings in one file all resolve, and again with thethree lines reversed, which a positional reader could not promise; a month deleted from THIS root is
filled from the fallback root, because both roots now share the names, so a
tree part-way through a migration is completed rather than left short; a
missing month raises with the locale and the month named when NO root carries
the locale, using an invented
zz; and a control that a completezzloadstwelve, so the raise is the missing file and not the invented locale.
A mutation control on the mapping: swapping January and February in
_MONTH_VOCfails both February spellings, so the name-to-month mapping ispinned rather than assumed.
7 passed, 92 subtests passed. The month-related modules together:38 passed, 1 skipped, 603 subtests passed.The full local suite reached 93% with zero failures and was then stopped: the
box was at load average 27 and the process was starved at 0.0% CPU against
other work. That is a stopped run, not a pass. CI runs it here.
Withdrawn
The count guard cut earlier for this task is withdrawn and is not re-cut. It
argued from the premise that line N is month N, which the format does not grant.
T-4767.
🤖 Generated with Claude Code