Skip to content

Preserve anchors when TOC rehome paths collide - #595

Merged
suguanYang merged 1 commit into
mainfrom
fix/wangbinqi/preserve-toc-rehome-anchor
Nov 29, 2026
Merged

suguanYang merged 1 commit into
mainfrom
fix/wangbinqi/preserve-toc-rehome-anchor

Conversation

@suguanYang

@suguanYang suguanYang commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keep both entries in their original sections when a TOC rehome would reuse an existing destination path. Check the destination before detaching the source so each entry keeps its calibrated match.

Evidence

  • The new contract test runs TOC rehome through chapter range resolution. The base revision raises the missing host scope error for page 9. The fix keeps the original anchor and its page coverage.
  • All 77 related contract tests pass, including the 18 TOC rehome tests. Ruff passes on both changed files.
  • An offline replay using the original 125-page PDF and recorded TOC move reproduced the same exception on the base revision. Three runs with the fix assigned physical page 9 to the original anchored section.

Merge Danger

Door Reversible code change.

Blast radius PDF TOC rehome when a move's destination path is occupied.

@suguanYang
suguanYang merged commit 59686cb into main Nov 29, 2026
6 checks passed
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