Skip to content

Prove source origins before changing completed whole pages - #873

Merged
zlareb1 merged 1 commit into
mainfrom
fix/i18n-whole-source-origins
Nov 18, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
fix/i18n-whole-source-origins

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026

Copy link
Copy Markdown
Member

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.

  • 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.
  • No migration, schema, SDK, plugin or frontend changes.
  • The architecture guide describes the proof requirement.
  • Existing generated translations and paid execution policy retain their values.
  • Commits are signed off.

Whole-page changes retain one authenticated original request when raw source
origins establish its current counterpart. Unproved replacements still refuse.

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