Skip to content

fix: page-memory fine-hierarchy boundary trim and null-page parent locate - #220

Merged
EricNGOntos merged 5 commits into
mainfrom
feat/wuchengke/fine-hierarchy-boundary-clip
Jul 20, 2026
Merged

fix: page-memory fine-hierarchy boundary trim and null-page parent locate#220
EricNGOntos merged 5 commits into
mainfrom
feat/wuchengke/fine-hierarchy-boundary-clip

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Drop all fine-hierarchy candidates on the fat-leaf boundary page when the coarse next-title (tail) anchor is not observed, so the next TOC section cannot bleed into the current leaf (NCC History no longer absorbs “List of amendments”).
  • Align build_next_title_by_path with stable reading-order sort_skeletons (immediate next skeleton, including same-page parent → first child) instead of section_path alphabetical / later-page-only lookup.
  • Include prior develop work needed for this path: null-page TOC parent locate (parent_self_only), VLM-order skeleton sorting, and removal of the residual page-location agent.

Test plan

  • make check (ruff + pyright)
  • pytest apps/worker/tests/contract/test_page_memory_fine_hierarchy_contract.py (7 passed, including new tail-miss / next-title order cases)
  • Staged NCC debug: stage1–3 to __boundary_clip out-dir vs baseline — locate/scopes identical after path-slash normalize
  • Single-scope stage4 --scope-id p14-23: fine hierarchy ends at NCC 2022; baseline’s leaked List of amendments is gone

Made with Cursor

EricNGOntos and others added 5 commits July 20, 2026 15:04
This commit eliminates the page locate sub-agent and its associated tools, streamlining the hierarchy locator module. The VLM page verification process is now directly integrated into the hierarchy locator, enhancing efficiency and reducing complexity. Unused configurations and functions related to the residual agent have also been removed from the page memory configuration.
Add window-bounded locate for coarse TOC parents whose printed_page is
null (compact-strict text match with visual RTL fallback), emitting
parent self-only skeletons so interstitial content is not swallowed.

Sort skeletons by start_page only and build the hierarchy tree from list
order, so same-page siblings keep VLM/TOC reading order instead of being
reordered alphabetically by section_path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/worker/app/services/page_memory/_serialization.py
#	packages/shared-python/shared/models/schemas/page_memory_config.py
The null-page parent locate is already implemented on this branch, so the
placeholder TODO reintroduced by the merge is misleading. Also remove the
duplicated page-memory serialization import left by the merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent next-section titles from bleeding into the current fat leaf when
the VLM fails to observe the coarse end anchor. Align next-title ordering
with stable reading order so same-page parent/child anchors stay correct.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EricNGOntos
EricNGOntos merged commit 87993e6 into main Jul 20, 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