Skip to content

Content in more than one language, edition groups and store states (moca-spec 0.8.0) - #33

Closed
petecleary wants to merge 7 commits into
release-0.8.0from
feat/0.8.0-parity
Closed

petecleary wants to merge 7 commits into
release-0.8.0from
feat/0.8.0-parity

Conversation

@petecleary

Copy link
Copy Markdown
Contributor

Brings the Python Reader to moca-spec 0.8.0 (release-0.8.0 at a296758), the same as the reference Reader at a433f2a: content in more than one language, edition groups and store states.

What it adds (ported module for module from the reference Reader's lib/):

  • new modules locale.py, inherit.py, editions.py and availability.py;
  • the locale lookup and locale as a priority list (capped at 16 entries of 35 characters, S014), localeMode first and only;
  • translations that inherit, retired translations falling back;
  • edition groups (editions, choose_edition);
  • store states, with StoreScope(allow=);
  • several caption tracks, a node's own language, and locale_coverage.

Schemas are copied from the reference Reader (byte-identical to schemas/v1). MOCA_VERSION is 0.8; the package version is unchanged.

Pins: MOCA_SPEC_REF a296758 and MOCA_READER_TYPESCRIPT_REF a433f2a (release-0.8.0); moca-tools stays at v0.7.0. The getting-started guide job still runs locally.

Corpus, before and after: 527 of 645 cases passed before (118 failed, 23 of them by crashing the runner); now:

$ node scripts/run-conformance.mjs --reader "../moca-reader-python/.venv/bin/python -m moca_reader.conformance"
All 645 conformance case(s) pass.
$ node tests/parity/parity.mjs
Parity: 172 queries in 35 scenarios return the same records, order, spans, text and scores.
$ uv run pytest -q
1029 passed, 39 skipped in 17.16s
$ uv run ruff check
All checks passed!
$ uv run ruff format --check
95 files already formatted
$ uv run mypy
Success: no issues found in 54 source files

The parity run was 87 queries in 18 scenarios before. The new ones cover locale lists (including one over the cap), localeMode on the lexical backend and on a store with states, retired translations, a node's own language, and a signed edition group. Unit tests are in tests/test_languages.py.

Not changed here: the LangChain and LlamaIndex bindings still take locale as one string; pyproject.toml's description still says moca-spec 0.7.

OpenMOCA added 7 commits November 28, 2026 22:14
The vendored schemas match moca-spec's again: tracks, and a node's own
language. New codes C012, A011, O006, O007 and S011 to S014. The core
relation types gain translationOf and editionOf, which only report.
Ported from the reference Reader for moca-spec 0.8.0. MOCA_VERSION is 0.8.

- A locale is a tag or a priority list (package spec §5.4), capped at 16
  entries of 35 characters (S014). The lookup tags the default file with
  its node's language and takes the lowest longer tag, with a script guard.
- A translation inherits what it does not write from its default file, and
  a retired one falls back as a missing one does (contract §9.2 step 5.4).
- localeMode first and only (contract §9).
- Edition groups (package spec §7.4): one edition per slot with a locale,
  editions and choose_edition on the structure (contract §10).
- Package states carry what a store search needs to choose alike, and a
  missing state withholds records (contract §9.4, S011).
- Caption tracks, a node's own language, and locale coverage.
Follows moca-spec 0.8.0's adapter: localeMode and editions in a search,
options.withhold for a store, the editions and chooseEdition structure
operations, and localeCoverage.
What the corpus does not reach: the caps of 16 entries and 35 characters,
lengths counted in UTF-16 code units, S014 naming no language, the bound
for localeMode first, SemVer precedence.
A package can be a composite with members and a trust root, and a scenario
can set locale, localeMode and editions. The search's own codes are
compared too. New scenarios over moca-spec's language fixtures.
@petecleary

Copy link
Copy Markdown
Contributor Author

This work continues in 0.8.0

@petecleary petecleary closed this Dec 1, 2026
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