Skip to content

Allow source replacements inside proved translation boundaries - #927

Merged
zlareb1 merged 4 commits into
mainfrom
fix/i18n-interior-origins
Nov 19, 2026
Merged

zlareb1 merged 4 commits into
mainfrom
fix/i18n-interior-origins

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • 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 reconciliation accepts interior source replacements when retained lines prove the original request boundaries.

Why

A completed translation request can remain a single request after text changes inside it. Requiring every historical line to remain present rejects those replacements even when both boundaries have unique retained origins. The proof can ignore absent interior lines while requiring retained lines to preserve their order and multiplicity.

Scope and risk

This changes raw source-origin projection, its focused cases and the architecture description. Missing or ambiguous endpoint origins, reordered retained lines and insertions at request boundaries still refuse. Prepared source validation, parser cuts, request references, fault identifiers, exact byte limits and completion history keep their existing checks. Some replacements still refuse when repeated text prevents a unique correspondence.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: reverting restores the stricter source-origin proof; no stored data or migrations change.

Tests

A small standard-library harness calls the maintained reconciliation APIs. Against the original production implementation, six replacement subcases fail; with this change, all seven test methods pass. Controls cover missing endpoints, retained-line reordering, ambiguous origins, boundary insertions, source mismatch, whole-request identity and faults, exact UTF-8 limits, unchanged oversized reuse and completion history.

CI exposed an obsolete completed-history negative case that expected an interior replacement to refuse. That case instead removes an endpoint line, retaining the conflict and empty-plan assertions. The existing positive history and exact UTF-8 bound cases cover both insertion and interior replacement, with assertions for original completion identity and unchanged history.

The committed pytest parametrizations are unrun locally because the existing environments lack the combined dependencies. The resource guard also refused the direct completed-history fixture before any test started. The source-origin and reconciliation code exercised by the seven-method harness is unchanged. Full CI on the final commit remains required. No dependencies were installed or overlaid.

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

  • AI-generated: Codex wrote the diff. Source review checked the endpoint proof and the unchanged reconciliation contracts.

  • 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: none are affected.
  • A new migration is additive and numbered after the latest on main; no migration changes.
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version; no plugin files change.
  • The frontend builds and its tests pass, if frontend/ changed; no frontend files change.
  • Docs describe the system as it is; no operator steps or wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s).

Retained lines prove the original endpoints while absent interior lines
may change. Missing or ambiguous endpoints and reordered retained lines
still refuse, preserving whole request identity and byte limits.

Signed-off-by: zlareb1 <[email protected]>
An interior replacement retains the proved whole-request endpoints.
Use endpoint loss for the invalid-proof case and cover replacement
identity, completion history and exact UTF-8 limits in the positive cases.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 11ae177 into main Nov 19, 2026
47 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
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