Skip to content

fix: isolate callback options in the processor cache - #723

Open
peterolkhov wants to merge 1 commit into
vercel:mainfrom
peterolkhov:codex/isolate-markdown-callback-options
Open

peterolkhov wants to merge 1 commit into
vercel:mainfrom
peterolkhov:codex/isolate-markdown-callback-options

Conversation

@peterolkhov

Copy link
Copy Markdown

Description

Two Streamdown instances with different callback options can reuse the same Markdown processor and render the first instance’s output. Include callback identity and its full option path in the cache key, separately from serialized option data.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Related Issues

No linked issue. Extends the function-identity cache isolation in #702 to callback-valued options.

Changes Made

  • Share option serialization between plugin options and remark-rehype options.
  • Keep callback paths and weak function IDs separate from user data, while retaining reuse for equivalent option wrappers.
  • Add callback isolation and cache reuse regressions, plus a patch changeset.

Testing

  • All existing tests pass
  • Added new tests for the changes
  • Manually tested the changes

pnpm test passes all 1,991 tests. Package builds, the website build, pnpm check, all four CI exact-optional TypeScript checks, and both workflow action test suites pass on Node 24.15.0 / pnpm 10.30.3. Built-package SSR and React client streaming reproductions also pass. The final regression file fails seven tests on unchanged main and passes with this fix.

Test Coverage

Both static and streaming rendering, remark/rehype plugin callbacks, remark-rehype handlers, callback paths, ordinary JSON data, and processor reuse with the same callback. No coverage percentage was measured.

Screenshots/Demos

The automated sibling-instance reproduction changes from leftleft to the requested leftright output.

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have created a changeset (pnpm changeset)
  • All my commits are signed

Changeset

  • I have created a changeset for these changes

Additional Notes

GPT-6.1 Sol (high) generated the patch and tests and ran the listed local checks. Agent self-review is complete and the commit has a verified GitHub signature. No human review is claimed.

The root check-types command currently schedules no tasks; the CI’s explicit exact-optional compiler commands were run instead. An additional full-package tsc -p tsconfig.json check reports 210 errors identical to unchanged main, with none in the modified files. No documentation/API change is needed.

@vercel

vercel Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

@peterolkhov is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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