Incremental reparse !4

merged merged by cmc on 2026-10-04 23:59 UTC · krz/orgstar:phase1-incremental-reparse into main

Discussion

cmc

Adds OrgParser.reparse(_:oldText:edit:) and its plan.

  • Element strategy: an edit inside one leaf element whose lines keep their classes and indents reparses only that element and copies the path to the root.
  • Sections strategy: reparses from the top-level section before the edit until a later top-level heading still ends the run; reuses the rest.
  • Full parse when the edit touches a settings keyword line, or moves a block or heading boundary in a file that has settings keywords.
  • Gate: 0 mismatches against a full parse over 100,000 random edits, on four seeds (release build).

Timings (release, M-series): csg.org (1.5 MB) full parse 297 ms, typing 2.6 ms, blank line 26 ms; org-manual.org (0.86 MB) full parse 125 ms, edits 6 ms. Full parse and structural edits on very large single sections are over the phase 1 targets; the performance plan covers them.