From e8aae2e7c2d14524fb0ad56b5ec3354a0b37757a Mon Sep 17 00:00:00 2001 From: LLLin000 <809867916@qq.com> Date: Sat, 4 Jul 2026 19:27:37 +0800 Subject: [PATCH] fix: wire apply_object_writebacks into rebuild path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rebuild entry point (ocr_rebuild.py) was still using the old scattered write_back_figure_roles / write_back_table_roles calls and never went through the Workstream A apply_object_writebacks seam. This meant side-adjacent figure text claims, contained text ownership, and render-consumption skip were missing from rebuild output even though the main ot .py path had been updated. Tested: rebuilt M84CTEM9 fulltext.md — zero leak of Figure A1 note text into body. --- paperforge/worker/ocr_rebuild.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paperforge/worker/ocr_rebuild.py b/paperforge/worker/ocr_rebuild.py index 05b02e43..c4872ba2 100644 --- a/paperforge/worker/ocr_rebuild.py +++ b/paperforge/worker/ocr_rebuild.py @@ -309,6 +309,15 @@ def run_derived_rebuild_for_keys(vault: Path, keys: list[str], progress_bar=None write_back_table_roles(table_inventory, structured) write_table_inventory(artifacts.blocks_structured.parent / "table_inventory.json", table_inventory) + # Apply object writeback seam (ownership evidence, contained/side-adjacent text, consumed-block contract) + from paperforge.worker.ocr_object_writeback import apply_object_writebacks + + apply_object_writebacks( + structured_blocks=structured, + figure_inventory=figure_inventory, + table_inventory=table_inventory, + ) + # Re-persist structured blocks with writeback roles (table_html, figure_asset) # ponytail: writes entire list again; if throughput matters, write only changed blocks write_structured_blocks_jsonl(artifacts.blocks_structured, structured)