fix(streaming): preserve heading IDs and reference links - #413
Conversation
Force a full reparse for document-scoped constructs (reference definitions, heading ID counters) so incremental reuse stays correct, omit reference tokens from the AST, and clear stale frontmatter when a stream switches documents. Co-authored-by: Max <maximogarciamtnez@gmail.com>
◈ PR Lens
Architecture 3 components touched across 2 lanes. Inside the changed components — 1 viewComponent view — Streaming pipeline The streaming parse reuse check and token processor Data flow
View
Tip The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change. 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe parser now omits reference definition nodes, forces full reparses for reference and heading-sensitive streaming input, preserves continuation frontmatter, and adds coverage for these cases. ChangesStreaming parser correctness
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The parser changes are covered by targeted tests, with no unresolved merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
comark
@comark/angular
@comark/ansi
@comark/html
@comark/nuxt
@comark/react
@comark/svelte
@comark/vue
commit: |
✅ Bundle snapshot updatedCommitted the new snapshot as 5adef93, verified by re-running the bundle check against it. GitHub suppresses the events a workflow commit would normally raise, so the Produced by this run. |
What
Force a full reparse for document-scoped constructs while streaming (reference definitions, heading ID counters), omit reference tokens from the AST, and clear stale frontmatter when a stream switches documents.
Why
Incremental streaming reuse skips the completed prefix, but heading IDs and reference links depend on full-document state. Without this, streamed tails can emit wrong IDs, broken links, or leaked reference nodes. Also avoid carrying old frontmatter when the source is replaced.
Cherry-picked from #396 (core parse fixes only) for separation of concerns.
Co-authored-by: @onmax
Summary by CodeRabbit