Skip to content

feat: TOC physical rehome + page_memory render scope isolation - #336

Open
EricNGOntos wants to merge 4 commits into
mainfrom
feat/wuchengke/2026-08-24
Open

feat: TOC physical rehome + page_memory render scope isolation#336
EricNGOntos wants to merge 4 commits into
mainfrom
feat/wuchengke/2026-08-24

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Add TOC physical rehome before classify (closed-interval leaf rehome, prune/skip rules, resolve two-phase for rehomed leaves).
  • Isolate page_memory PNG writes under pages/{scope_id}/page-{n}.png to stop concurrent boundary-page truncate races; reject empty image base64 before VLM.
  • Soften pymupdf EXIT_DELAY: join before closing queue, no kill on success path (debug-only), keep main’s empty-queue retry.
  • Fix outline skeleton toc_pages plumbing and stage5 extract_toc_nodes import for lint/CI.

Test plan

  • make check (ruff + pyright)
  • Focused contracts: page renderer scope path, node assembler citation promote, calibration scan, toc rehome (42 passed)
  • EN_medical page_memory stage0–3 clean rerun: no base64 empty; EXIT_DELAY only DEBUG

Made with Cursor

EricNGOntos and others added 4 commits August 26, 2026 10:53
- Introduced new functions for rehoming calibrated forests and handling pending records in the TOC anchoring process.
- Updated the `compute_fat_leaf_pages` function to exclude TOC pages from the fat span test, ensuring accurate page calculations.
- Refactored various functions to utilize the new `pages_excluding_toc` utility for consistent TOC page exclusion across multiple components.
- Removed the deprecated `TocPagePolicy` class, streamlining the codebase.
- Added tests to validate the exclusion of TOC pages in fat leaf calculations.
- Updated the hierarchy locator to better handle rehome matches and leaf nodes, ensuring accurate page range resolution.
- Introduced new functions for managing rehome ranges and structural leaf identification, improving the clarity and efficiency of the code.
- Enhanced the TOC anchoring process to support global paged-leaf rehome, allowing for more robust handling of TOC structures.
- Refactored tests to validate the new rehome logic and ensure correct behavior in various scenarios.
- Updated the rendering logic to support a new naming convention for PNG files, allowing for better organization based on the presence of a prefix.
- Refactored the inspection process to render pages serially before conducting concurrent inspections, improving efficiency and clarity in the workflow.
- Adjusted the handling of rendered pages in the inspection function to ensure proper coverage and error handling.
- Enhanced tests to validate the new rendering and inspection behavior, ensuring robustness in various scenarios.
Unblocks make check before PR sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
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