fix: wire apply_object_writebacks into rebuild path

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.
This commit is contained in:
LLLin000 2026-07-04 19:27:37 +08:00
parent f688baf839
commit e8aae2e7c2

View file

@ -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)