Repository navigation
Translation reconciliation proves raw-source counterparts - #847
Merged
Merged
Conversation
Signed-off-by: zlareb1 <[email protected]>
A changed counterpart can exceed the request bound without having a recorded fault. Signed-off-by: zlareb1 <[email protected]>
Bind the marked work bag to the serialization check so later event tests cannot inherit it. Signed-off-by: zlareb1 <[email protected]>
Use a valid comma-separated binding and verify every declarator is extracted. Keep the same growth bound while initializing the parser outside the measured calls. Signed-off-by: zlareb1 <[email protected]>
This was referenced Nov 18, 2026
zlareb1
added a commit
that referenced
this pull request
Nov 18, 2026
Related: #847 ### Changelog category (leave one): - Improvement ### Changelog entry Translation reconciliation accepts bounded changes to a completed whole page when authenticated raw source origins prove its complete current counterpart. ### Why A completed whole page is refused before the optional source-origin proof runs. This blocks insertion-only source updates even when the proof establishes their exact original request and complete current boundary. ### Scope and risk One condition lets supplied `SourceOrigins` reach the existing mandatory proof. Unproved replacements still refuse. Invalid raw source, ambiguous origins, changed separators, incomplete history, confirmed pair refusals and oversized whole requests retain their existing checks. A changed whole remains one request with its original identity and fault references. The diff adds focused regressions and states the contract in the architecture guide. It changes no generated translation or paid execution policy. ### Compatibility, rollout and rollback - Wire, settings and operator steps: none. - Exact whole-page reuse and same-input correction retain their behavior. Changed inputs require their current source; this does not authorize replaying an old-input assistant response. - Rollback restores the refusal for changed whole pages. No stored application data or existing translation bytes change. ### Tests - The new named whole-page regression fails before the source fix at the existing replacement refusal. - The final focused source-origin cases and adjacent whole-page, refusal and request-bound controls pass: 51 cases. They cover changed whole requests, faults, invalid or absent proof, unchanged reuse/correction and UTF8 bounds without splitting. - Ruff, formatting, diff and prose checks pass. Full suites run in GitHub CI and must pass before merge; no heavy local suite ran. ### AI assistance in the code (leave one; writing this description with AI is fine): - AI-generated: Codex wrote the condition, tests and contract text; the publisher reviewed the complete diff, proof path and focused evidence. - [x] I can explain every line of this diff and how it interacts with the rest of Loom. ### Checklist - [ ] Required GitHub CI passes on the current head. - [x] No migration, schema, SDK, plugin or frontend changes. - [x] The architecture guide describes the proof requirement. - [x] Existing generated translations and paid execution policy retain their values. - [x] Commits are signed off. Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 18, 2026
Related: #847 Related: #873 ### Changelog category (leave one): - Improvement ### Changelog entry Translation reconciliation retains each completed reply's original source partition when planning corrections across source updates. ### Why A later translation can reuse older replies while generating only a changed section. Treating those replies as one request history assigns some replies to a container that never produced them. A separate completed-history planner keeps each reply variant tied to its actual complete partition and whole request slot. ### Scope and risk The pure planner requires the complete partition and reply catalog, explicit reuse eligibility for every reply, and a digest of that metadata. Selected reply references derive an ordered complete current cover without caller-supplied cuts. Each current separator must match the selected reply's own original partition separator. Same-input faults produce corrections; changed inputs retain their original identity and use current source. Eligible same-input alternatives require reuse. Completed wholes are never split to fit the byte bound. The caller must authenticate catalog completeness, actual reply variants, source and settlement evidence, eligibility, uncertainty, partial attempts, refusals and security policy. A consistent metadata digest cannot establish those facts or admit provider calls. Unselected replies, faults and origin evidence remain in the result. The existing single-history API retains its contract. A shared raw-origin calculation is factored behind its existing completed-unit guard. The architecture guide describes the separate completed-history contract. ### Compatibility, rollout and rollback - Wire, settings and operator steps: none. - Matching consumers must authenticate each selected reply against its own complete source partition. This PR changes no executor, generated translation or paid execution policy. - Rollback removes the separate planner and restores the shared calculation in place. No stored application data changes. ### Tests - A missing-feature regression fails before implementation because the new API is absent. - `python -m pytest tests/unit/test_i18n_completed_history.py tests/unit/test_i18n_source_origins.py -q -p no:randomly -o addopts=`: 74 focused cases pass. They cover provenance, variant-specific faults, full-catalog eligibility, free alternatives, exact current coverage, raw-source proofs, refusal, separator ownership in both directions and UTF8 bounds. - Ruff, formatting, diff and prose checks pass. Full suites run in GitHub CI and must pass before merge; no heavy local suite ran. ### AI assistance in the code (leave one; writing this description with AI is fine): - AI-generated: Codex wrote the planner, tests and contract text; the publisher reviewed the complete diff, provenance boundaries and focused evidence. - [x] I can explain every line of this diff and how it interacts with the rest of Loom. ### Checklist - [ ] Required GitHub CI passes on the current head. - [x] No migration, schema, SDK, plugin or frontend changes. - [x] The architecture guide describes the new contract and caller obligations. - [x] Existing generated translations and paid execution policy retain their values. - [x] Commits are signed off. Signed-off-by: zlareb1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
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 can retain original completed units across source insertions when raw source origins prove every current counterpart. Changed units keep their original references and remain subject to correction, refusal and request-byte limits.
Why
Adjacent changed completed units can lack an unchanged boundary that proves where each current counterpart ends. Guessing from headings or accepting caller-supplied ranges could reuse the wrong reply or omit source text.
The optional
SourceOriginsinput supplies historical raw source, current raw source and locale. The proof reconstructs both exact prepared containers through the maintained language-bar, ordered link-target and generated-anchor transformations. It then requires every historical raw line to survive in order. Earliest and latest complete monotone embeddings must agree on each endpoint's neighbouring origins; insertions at unit or separator boundaries refuse. Every original whole unit and separator must cover the complete current container.Scope and risk
changed; original reply references and fault identifiers remain attached. Existing pair refusals, unknown-fault checks and whole-page restrictions still apply. Changed and faulty whole counterparts must fit the caller's effective request-byte bound; the proof cannot split them or raise that bound.Compatibility, rollout and rollback
Tests
The definition-growth check measures a valid comma-separated binding, asserts every definition is extracted and excludes one-time parser initialization. The focused case fails before the fix and passes afterward with the same input sizes and growth limit.
Mirror-failure serialization tests restore their marked request-work context. Three ordered failure variants followed by two event-capture cases reproduce two failures before isolation and all five pass afterward. The production required-tail guard remains unchanged.
120 directly related checks pass: 93 existing reconciliation cases, 23 source-origin cases and four existing link/anchor preparation cases. The cases cover ambiguous origins, endpoint insertions, replacements, missing coverage, altered preparation, incomplete manifests, retained refusals and faults, and whole-counterpart byte limits.
Two recorded complete 12-unit source histories each produce nine reusable and three changed whole counterparts, retaining all original references and exact current-container coverage. Their largest whole input is 9,994 UTF-8 bytes: it fits the recorded 16,384-byte bound but must refuse under an 8,192-byte bound. These are pure source proofs, with no provider calls or translated-body semantic approval.
Ruff, Ruff format, prose and diff checks pass. Full suites were not run locally; mandatory GitHub CI must pass before merge.
Reproduce the focused checks:
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated: Codex wrote the diff. The implementation was checked against the complete raw-source correspondence contract, focused adversarial cases and both recorded source histories. Fresh review of the pushed head and mandatory CI remain pending.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.