Skip to content

Allow the segment link order only for unchanged segment output - #748

Merged
carlospolop merged 1 commit into
masterfrom
fix/segment-link-reorder-scope
Dec 4, 2026
Merged

carlospolop merged 1 commit into
masterfrom
fix/segment-link-reorder-scope

Conversation

@carlospolop

Copy link
Copy Markdown
Collaborator

Why

#747 let chapter validation accept links that change order inside one Markdown block for every page. Chapter validation also checks pages that did not come from the segment translator: reuse and repair of existing translations (stage_markup_repairs), the audit of current chapters (invalid_current_chapters) and publish verification (verify_requested_translations). Older whole-page translations can move a label to another link without changing the link counts. #747 hid that.

Change

  • The default is strict again: links, images and footnotes keep their English order. The swapped-label negative fixture is back.
  • chapter_validation_problems(..., segment_output=True) allows the Allow links to change order inside one block in chapter validation #747 rule (a link or image with a unique destination may change order inside its own block). Only the segment translator passes it, at translator.py for the page it just assembled.
  • The segment translator records the Git blob of each page it wrote in the translation checkpoint, as segment_outputs: {path: localized blob}. Reuse, audit and publish verification apply the segment rule only while the page on the branch still has that exact blob. A hand-edited, repaired or older page gets the strict check. A blob that does not match the file on disk is never recorded, and retranslating a page without segment output drops its entry.
  • Translation drafts stay strict. The worst case is a retranslation, which mostly reuses cached leaves.

Tests

  • test_translat*: 377 OK. test_segment_translator: 149 OK.
  • New git end-to-end test: a recorded segment page passes the audit and verify_requested_translations. After a hand edit, both report "moved Markdown links". Retranslating without segment output removes the entry.
  • The Korean boundary fixtures from Allow links to change order inside one block in chapter validation #747 now run with segment_output=True, and the same page fails without it.

🤖 Generated with Claude Code

#747 let chapter validation accept links that change order inside one
block for every page. Reuse, repair, audit and publish verification also
read older whole-page translations, where a label can move to another
link without changing the link counts, so the default stays strict again.

The segment translator now records the Git blob of each page it wrote in
the translation checkpoint (segment_outputs). The new link rule applies
only to the page it just assembled, and later only while the page on the
branch still has that exact blob: an edited, repaired or older page gets
the strict check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@carlospolop

Copy link
Copy Markdown
Collaborator Author

merge

@carlospolop
carlospolop merged commit 8231cf4 into master Dec 4, 2026
8 checks passed
@carlospolop
carlospolop deleted the fix/segment-link-reorder-scope branch December 4, 2026 00:14
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