Skip to content

Reuse source inventory while checking present translations - #949

Merged
zlareb1 merged 6 commits into
mainfrom
fix/i18n-present-inventory-reuse
Nov 19, 2026
Merged

zlareb1 merged 6 commits into
mainfrom
fix/i18n-present-inventory-reuse

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Changelog category

  • Improvement

Changelog entry

Reuse the English source inventory within one check of present translations while checking live source paths and link targets at each use.

Why

The translation validator prepares the English source for each present output when checking retained headings and labels. Each preparation repeats discovery of every tracked source, including when the page has no links.

Scope and risk

Pass one ordered inventory and its membership set through the existing preparation and link-rewrite functions for one validation call. Standalone calls still discover sources afresh; an explicitly empty inventory stays empty. No inventory or file contents persist between calls.

Recheck the prepared source before reading it, the referenced English target before selecting its translated route, and the translated target and anchor at use. Regular untracked sources remain valid inputs to standalone preparation. Membership is a per-call snapshot; tracked-name changes appear in the next call. Existing source hashes, models, origin rules, per-link English fallback reads, publisher behavior and generated translations are unchanged.

Two stored-page test fakes accept the new optional inventory keyword; their existing preservation and tampering assertions are unchanged.

The regression establishes fewer inventory scans, not the cause of a hosted test timeout or a measured full-corpus speedup. No timeout, worker, retry, skip or CI assertion changes.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert the inventory change and its tests; no data changes.

Tests

The focused results below are historical. The production translation code and stored-page fakes are unchanged; the test repository is nested inside each test’s temporary directory. No local tests were repeated on this head.

  • Two causal regression cases failed on the original implementation at two and three full inventories for one and two present outputs. The same cases pass with one inventory per call and still detect corrupted output.
  • Forty focused cases pass: nineteen added cases plus existing candidate, native-link and English-fallback controls. They cover source and ancestor symlinks, deletion, changed bytes, live anchors, output boundaries, standalone calls, empty snapshots and discovery in the next call.
  • Twenty-five focused cases pass after the stored-page fake updates: the six affected preservation cases and nineteen inventory cases.
  • The added cases run with pytest tests/unit/test_i18n_present_inventory.py and actual Markdown parsers in temporary repositories.
  • Ruff check and format-check, Python syntax, prose and whitespace checks pass. Only the three intended function bodies change; the remaining function ASTs and other validator modules are unchanged.
  • Full GitHub CI passed for this head: format, lint, type checks, all unit shards, coverage and benchmarks, and integrations. No local committed-corpus check, broad suite, profile, provider call or model evaluation was run.

AI assistance in the code

  • AI-generated: Codex diagnosed the repeated discovery, implemented per-call reuse and checked the path, byte and link boundaries.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full format, lint, typecheck and unit checks pass in GitHub CI.
  • No generated API, migration, plugin, frontend or translation output change.
  • No cached positive path checks or file bodies.
  • Public text passes prose checks.
  • Commits are signed off.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The two integration cases share a path and namespace. A row written by one case can enter the other case's exact result assertion when test order changes. Keep every assertion and pass a separate registered org through each case.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit 80c90e1 into main Nov 19, 2026
46 checks passed
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