Skip to content

English fallback validation reuses destination parsing - #836

Closed
zlareb1 wants to merge 2 commits into
mainfrom
fix/i18n-link-check-reuse
Closed

zlareb1 wants to merge 2 commits into
mainfrom
fix/i18n-link-check-reuse

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #834, #786

Changelog category (leave one):

  • Performance Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Translation link validation parses each English destination once per pass. Links without fragments check file existence without parsing the destination body.

Why

Several translated pages can link to the same English page or to different anchors on it. Rebuilding that page's request layout for each link repeats the same work. Both validation and fallback repair share this repeated lookup.

Scope and risk

Each validation or repair call owns a dictionary of parsed English destination bodies. Anchored links reuse a destination's body within that call; the dictionary ends with the call, so later calls observe source edits. Inventory and regular-file checks still precede every lookup. Fragment decoding, missing-anchor diagnostics and fallback replacement remain unchanged.

The inherited parser indexes are described in the related prerequisite pull request. They preserve request boundaries, table labels and source offsets. This change adds no process-wide cache or validation exemption.

Compatibility, rollout and rollback

No wire, schema, dependency, configuration or provider change. Operators need no migration or configuration step. Rollback restores repeated parsing within each validation pass.

Tests

Three regressions first fail on repeated parsing and fragmentless body reads; an existing neighbouring case passes. All four selected cases pass after the repair. They cover distinct and URL-decoded anchors, ordered missing-anchor diagnostics, source edits between calls, missing and nonregular files, fragmentless links, and repair that preserves every other byte. Ruff and format checks pass for the two changed files.

A small temporary fixture compares the complete old and new diagnostic lists and repaired output: diagnostics are equal, all 709 repaired bytes are equal, and pending bytes remain unchanged. No full local checker, suite or provider call runs. A fresh whole-change source review reports no findings or nits. Full final-head GitHub CI must pass before merge; unit part 4 currently fails the TypeScript numbered-source cost regression and is under investigation.

Reproduce the selected cases with pytest tests/unit/test_i18n_lifecycle.py -q -k 'english_fallbacks_reuse_body or fragmentless_fallback_checks or fallback_repair_reuses_body or fallback_validation_checks_english_fragments'.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff).

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

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

Index normalized table rows while preserving first-match offsets and unmatched row order. Use prefix maximum ends for protected-line lookups.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Parse each anchored destination once per validation or repair pass. Check fragmentless destinations without reading their bodies.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1

zlareb1 commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Superseded by #833. The merged implementation reuses parsed bodies while rechecking source bytes for each link and preserving parser errors for links without fragments. The branch and its validation evidence are preserved.

@zlareb1 zlareb1 closed this Nov 18, 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