Skip to content

chore(deps): upgrade Fumadocs to 16.17.9 and drop the workarounds it fixes - #298

Merged
nickvigilante merged 17 commits into
mainfrom
vigilante/fumadocs-16-17-upgrade
Nov 18, 2026
Merged

nickvigilante merged 17 commits into
mainfrom
vigilante/fumadocs-16-17-upgrade

Conversation

@nickvigilante

@nickvigilante nickvigilante commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Merge order

No required order. Whichever of these lands second rebases.

Opened by Coder Agents for @nickvigilante.

Summary

Move fumadocs-core and fumadocs-ui from 16.15.14 to 16.17.9 and fumadocs-mdx from 15.4.4 to 15.4.10, and drop the workarounds the new versions make redundant.

The PR was written against 16.17.9 when 16.17.10 (published 2026-11-02) was still inside the three-day minimumReleaseAge window. 16.17.10 and later have since cleared it, so they could be taken now; this PR stays on the 16.17.9 it was tested and reviewed against, and a later bump can follow. 15.4.10 is the fumadocs-mdx whose peers (fumadocs-core 16.17.8 and up) fit. No other Fumadocs package, Next or React peer needed a bump. The lockfile also moves transitive packages the new versions pull in (Radix UI, Shiki 4.6.0, @fumadocs/tailwind) and adds motion, yuku-* (native bindings), zbsearch, chokidar 6 and cn, all past the age gate, and the unused mdast-util-to-markdown direct dependency of docs-transforms goes.

Removed:

  • The two collapsed-sidebar visibility rules in brand.css: Fumadocs now sets inert on the collapsed sidebar and on its hidden open pill.
  • The combobox, listbox and option wiring in our search dialog, now built in (the nested-listbox and unfocusable-results axe findings are gone, so .github/a11y-allowlist.json is empty).
  • The stringify.filterElement and mdast-util-to-markdown handler options, which 16.17.0 removed.
  • The stale CopyAnnouncer comment and old version notes (sidebar folder fork, scroll table, provider test).
  • <mark> handling in the search result renderer and in hasExactMatch.

Kept:

  • ScrollTable: upstream's Table now has tabIndex={0}, but on every table, with no role or name. Ours is a named region and a tab stop only when it overflows, and pages with hundreds of tables (/reference/api/templates/ has 100) would otherwise gain 100 unnamed tab stops.
  • Our search dialog: upstream still lacks the result-count live region, focus return to the opener or the destination, and rendering of index text without raw HTML (its default renders index Markdown with raw HTML allowed). It also cannot host the hybrid semantic client without our wrapper.
  • The heading copy-anchor focus-visible CSS, the skip link, the mobile drawer Escape handling, the Tabs aria-controls/escapeValue workaround with force-mount, and the ported TOC renderer. Upstream issues are still open, and each was re-checked in Chromium and Firefox against the real corpus (see Testing).
  • No local sort replaces upstream's: fumadocs-mdx sorted its content glob already in 15.4.4, so there was nothing to drop. pagesInUrlOrder orders pages by URL for a different reason and stays.
  • The githubUrl icon fix (fumadocs #3716) has no local workaround to remove: our social links are custom icon links and stay.

Design or Fix

The new versions change four things we relied on, and each needed a code change.

  1. Search records and Markdown twins are sliced from the authored source (16.17.0). remarkStructure and remarkLLMs no longer stringify the tree, so nodes our plugins create have no text of their own and the old stringify and handlers options are ignored (the base-path rewrite of twin links silently stopped working; processed-markdown.test.ts caught it).
    • A runtime Experimental block stays out of search, including out of the record of a parent such as a plain blockquote: the gate's opener, closer and body nodes are blanked in the search stringifier, and remarkExcludeExperimentalFromSearch empties the block's own records. The default premium callout's children are parsed from a separate string, so their positions are dropped.
    • remarkTwinBasePath edits each link, image and definition URL in the source. createCoderMdxOptions takes basePath for it, and processedMarkdownOptions() no longer takes one.
    • Premium and experimental gates are rewritten in the twin to the tags they compile to, so no data-cond or data-feature marker reaches a twin. Those tags are not search content, so the same nodes get a search edit that leaves them out (the processed-Markdown stringifier has no namespace of its own). A callout's [!NOTE] marker is left out of its search record.
    • These plugins edit through replaceSource, which keeps its state per copy of fumadocs-core, and the app and docs-transforms can resolve different copies under pnpm. Both source.config.ts files pass their own replaceSource in. Without it the edits are lost silently, which the stitch e2e caught.
  2. The search dialog moves to experimental_useSearch. Table rows arrive as grouped table items, so search-markdown.tsx renders a row's cells and its group header as text. SearchDialogList calls its Item, Table and Empty renderers as plain functions, so hooks must live in a component they return (React error 310 otherwise).
  3. Matches are highlighted with the CSS Custom Highlight API and no longer wrapped in <mark>. The axe pass opens the dialog with results but cannot see highlights. Lightning CSS prints a harmless warning for ::highlight(fd-search) when generating the CSS.
  4. A table row is one search record holding a Markdown table, so the sanitizer keeps its line breaks. The real corpus's search index goes from 17.9 MB to 15.9 MB.

Behaviour changes to know about:

  • A page's Markdown twin and llms-full.txt now carry the authored Markdown instead of re-serialised JSX components (- bullets, _em_, raw <details>, &nbsp;). llms-full.txt is 5.55 MB before and 5.37 MB after.
  • Fumadocs removed the drop shadow from code blocks and callouts, and zeroed the margin of a paragraph inside a blockquote, so a blockquote after a heading sits 8px closer (/reference/api/templates/ is 280px shorter over 35 such blockquotes).
  • Ctrl + B (⌘ + B) now collapses the sidebar on desktop.
Decision log
  • Target 16.17.9, not 16.17.10: release age gate at the time of writing (minimumReleaseAge not touched); 16.17.10 has since cleared it and is left for a follow-up.
  • Keep ScrollTable and our search dialog: upstream covers the roles, not the rest of what ours does.
  • Pass replaceSource from the app instead of deduplicating the fumadocs-core copies: the copies differ by peer versions (zod, lucide-react) that other packages pin on purpose.
  • Gate tags in the twin are rebuilt rather than dropped, so a reader of a twin still sees that a block is Premium or experimental.
  • Upstream changelog items between 16.15.14 and 16.17.9 that do not affect us: bring-your-own highlighter, Meilisearch, Mixedbread, i18n parser options, AI chat panel placement, Lightbox, Astro, TanStack, and OpenAPI/GraphQL/AsyncAPI page changes. fumadocs-mdx 15.4.5 to 15.4.10 only adds Vite, Windows-drive and Turbopack-warning fixes and moves remarkInclude into core.

QA

The preview needs a Vercel login and is deployed by running docs-pr-preview.yml on the branch, which an agent may not run, so the same builds were checked locally (see Testing). Steps 1 to 7 were exercised in Playwright's headless Chromium and Firefox 155 against the real corpus; none was hand-driven, so the Firefox steps are unverified in a real browser.

  1. Open /get-started/ on a window at least 1280px wide. Press Ctrl + K (⌘ + K on Mac), type workspace proxy. Expected: a list of results, the first one highlighted and the typed words underlined in the accent colour. Press the Down arrow twice and then Enter: the highlighted result opens.
  2. Reopen search and type --wildcard-access-url. Expected: some results appear as a small table (a header row, then rows of cells), not as a pipe-separated line of text.
  3. Open /get-started/ and click the second tab of the first tab group. Expected: the panel switches, and the address bar does not gain a # fragment.
  4. Open /reference/api/templates/ and press Tab from the top of the page until a table gets a focus ring (the first is the "Response Schema" table under "Get templates by organization"). Expected: the ring surrounds the table and the Left and Right arrow keys scroll it sideways. Tables that fit on screen are skipped by Tab.
  5. On /get-started/ press Ctrl + B (⌘ + B). Expected: the sidebar slides away, the open button appears at the top left, and pressing Tab does not land on a hidden sidebar link. Press it again to bring the sidebar back.
  6. Narrow the window below 768px, open the menu button, then press Escape. Expected: the drawer closes.
  7. Look at the code blocks and callouts on /get-started/. Expected: they have no drop shadow any more.
  8. Open /get-started.md on the preview. Expected: the authored Markdown, with <details> for the collapsed blocks and links that start with the site's base path.

Pages to compare

Production is https://coder.com/docs/<path>/. The preview is <preview>/<path>/, always the latest deploy of this branch, and it needs a Vercel login and a run of docs-pr-preview.yml, which an agent may not run.

What to check Production Preview
Tabs, callouts, code blocks without shadow https://coder.com/docs/get-started/ <preview>/get-started/
Wide tables, long page with a long TOC https://coder.com/docs/reference/api/templates/ <preview>/reference/api/templates/
Callouts https://coder.com/docs/reference/feature-stages/ <preview>/reference/feature-stages/
Option tables https://coder.com/docs/reference/cli/create/ <preview>/reference/cli/create/
Tables https://coder.com/docs/admin/setup/data-retention/ <preview>/admin/setup/data-retention/
Search, sidebar collapse, drawer (from above) https://coder.com/docs/get-started/ <preview>/get-started/

The search dialog on /get-started/ for workspace proxy, main on the left and this branch on the right:

The search dialog before and after

Testing

Review fixes (after the approving review): main is merged in (654403f; the catalog keeps the Fumadocs bumps beside next 16.4.5, and the lockfile is regenerated). A gate nested inside a blockquoted runtime Experimental block no longer leaks into the search record (4a90ee1), and createCoderMdxOptions now throws when fumadocs-mdx runs against another fumadocs-core copy and no replaceSource was passed, instead of silently dropping the source edits (b55d87c; the docs-next and docs-build e2e harnesses were in exactly that state and now pass their own, 540a935). The P3s are in aafd24e (DOCS_BASE_PATH normalised for the twin base path), 7d71f40 (search errors reach Fumadocs' Search failed status), bcdf300 (table delimiter dropped by position, plus a table XSS test), 8e74daa (16.15 notes) and d732311 (one alert list for both callout markers); the READMEs now document replaceSource and basePath and describe a twin correctly. The mixed line endings in a CRLF twin are left as they are, as cosmetic. After these: package tests docs-transforms 420, docs-next 367, docs-build 147, docs-manifest 156, docs-config 94, docs-ui 193, docs-sources 73, docs-theme 30, docs-site 341, router 218, offlinedocs 76, dist-release 95 (94 pass, the DIST_SMOKE dry run skipped), all passing; pnpm typecheck, pnpm lint and the docs-site build pass; test:e2e:stitch and test:e2e:single (after clearing public/) pass; a11y:axe 70 scans, 0 WCAG violations, 0 allowlisted.

Linux only; nothing here is OS specific. CI runs on Ubuntu, and macOS and Windows are not covered by it, so the CRLF twin case is simulated with a \r\n source in processed-markdown.test.ts.

  • pnpm install (lockfile written by pnpm), pnpm turbo run build --filter='./packages/*', pnpm build, pnpm lint, pnpm typecheck and pnpm test all pass: 12 packages, 2,049 tests, 7 of them skipped (docs-transforms 395, docs-next 361, docs-site 314, docs-ui 193, docs-router 150, docs-manifest 140, docs-build 129, docs-config 94, dist-release 95 (the 7 skipped need gitleaks, which is not installed), docs-sources 73, offlinedocs 75, docs-theme 30). The new tests fail against the old behaviour: the twin base path, the gate tags, the callout marker, the nested-listbox and table-row dialog cases, and a gate inside a blockquote for Experimental, Premium and the static tags.
  • Fixture build: a11y:axe 70 scans, 0 WCAG violations, 0 allowlisted (6 existing best-practice empty-table-header findings on /authoring/tables); a11y:keyboard 8 runs, 0 failures (Chromium and Firefox); test:e2e:anchors 4 of 4; test:e2e:stitch and test:e2e:single pass; csp:check, first-load:check (45 pages, no zod), parity:urls (42 pages, 114 anchors, no unapproved mismatch) and the offlinedocs CSP, annotation and analytics checks pass. single-version.e2e fails with a leftover public/images/ from an earlier root build in the working copy, on main too; after deleting it, it passes.
  • The open search dialog on the real corpus with 60 results: axe reports aria-required-children and scrollable-region-focusable on main and nothing on this branch, in desktop and 390px, for the queries workspace and code.
  • Real corpus (coder/coder main, one version, 478 pages) built on main and on the branch, then compared in Chromium and Firefox: same text length, tab and TOC counts, scroll-table regions, tab aria-controls, mobile drawer and Escape, skip link, collapsed sidebar focus and TOC active item on 7 pages. The desktop sidebar-collapsed, mobile and mobile-drawer screenshots are pixel-identical. Differences: the shadows, the blockquote margin, the search dialog, and visibility of the collapsed sidebar (hidden on main, now inert and off screen). Two builds of the branch give a byte-identical api/search (15,934,900 bytes) and llms-full.txt.
  • Size: first-load JavaScript chunks of the real-corpus build go from 1,737,230 to 1,635,066 bytes (minus 5.9%), CSS from 105,015 to 112,668 bytes; the fixture build goes from 1,870,118 to 1,770,201 bytes of JavaScript and the fixture search index from 174,698 to 105,889 bytes.
  • Not verified: macOS and Windows, a hand-driven Firefox or Safari, the hybrid (semantic) search dialog in a browser (it is covered by its unit and jsdom tests only, and the dialog is only used when search.hybrid is on), and the in-product embed.

Upstream

Candidates to file, each not filed until you approve:

  • Yes: Table in defaultMdxComponents makes every table a nameless tab stop; a region that is named and focusable only while it overflows would cover the Safari case without the cost.
  • Yes: SearchDialogList calls Item, Table and Empty as functions, so a renderer that uses a hook crashes with React error 310; document it or render them as components.
  • Yes: option ids are fd-search-option-${id}, which is an invalid aria-activedescendant reference when an item id has a space.
  • Yes: the generated ::highlight(fd-search) rule makes Lightning CSS warn.
  • No: the twin and search plugins, the base path, the gate tags and the Experimental exclusion are Coder specific. The replaceSource per-copy state is worth a note upstream, but it follows from how pnpm resolves peers here.

Linear: DOCS-1468


🤖 Built with AI assistance.

Move fumadocs-core and fumadocs-ui to 16.17.9 and fumadocs-mdx to
15.4.10. 16.17.10 is newer but under the three-day release age gate, so
it cannot be installed yet.

The upgrade changes four things the engine relied on:

- remarkStructure and remarkLLMs now slice their Markdown from the
  authored source and drop the stringify and mdast-util-to-markdown
  options. The Experimental exclusion from search moves to a plugin that
  drops source positions inside the block, the base path for twin links
  moves to a plugin that edits each URL in the source, gate markers are
  rewritten to their tags in the twin, and a callout's alert marker is
  left out of its search record. The replaceSource each plugin edits
  through can be passed in, because the app and this package can resolve
  different copies of fumadocs-core.
- The search dialog already carries the combobox, listbox and option
  roles, so the local combobox wiring goes. The result count, focus
  return and text-only rendering stay, and results move to the new
  search hook with table rows rendered as cells.
- Results are no longer wrapped in mark elements; matches are highlighted
  with the CSS Custom Highlight API, so the axe pass no longer looks for a
  highlighted match.
- A table row is now one search record holding a Markdown table, so
  sanitizing keeps its line breaks.

Assisted-by: AI
… Fumadocs upgrade

Fumadocs 16.17.9 marks the collapsed sidebar and its hidden open pill
inert, which removes them from the focus order and the accessibility
tree. The two visibility rules that did the same are dead, so remove
them.

Point the notes on the forked sidebar folder, the scrolling table and
the search provider test at the pinned version instead of old ones.

Assisted-by: AI
The search listbox findings it held, a listbox wrapping a second listbox
and a scrollable results region that was not keyboard focusable, are
gone with the Fumadocs 16.17.9 search dialog. The axe pass reports no
WCAG violations with the dialog open, in light, dark, more-contrast and
mobile modes.

Assisted-by: AI
@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
coder-docs Ready Ready Preview Nov 5, 2026 4:47pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
coder-docs-router Skipped Skipped Nov 5, 2026 4:47pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
DOCS-1166 SC 2.1.1: search dialog's scrollable results region is not keyboard-focusable

Found when coder/docs-engine#204 (DOCS-1039) extended the axe pass to open the search dialog with a query. The scan reports scrollable-region-focusable on the search results container in all four modes (light, dark, mobile-light, mobile-dark). #204 allowlists it as tracked-search-listbox in .github/a11y-allowlist.json.

This is likely the same structural problem as the aria-required-children finding from the same scan: the scrolling element is the outer wrapper with our listbox role, and nothing inside it is focusable because selection moves by aria-activedescendant. Fixing the listbox structure may clear both. If it doesn't, either make the scroll container the listbox (a focusable composite widget satisfies the rule) or confirm keyboard users can reach every result with the arrow keys and that the selected row scrolls into view, then document why the rule doesn't apply. The table scroll finding already allowlisted as tracked-table-scroll-focus is separate.

Done when the /#search scan passes scrollable-region-focusable in all four modes, its allowlist entries are removed, and every result is reachable by keyboard at 390 px with a long result list.

Created by Coder Agents on behalf of @Vigilante*.*

DOCS-1165 SC 1.3.1 / 4.1.2: search dialog listbox wraps a second listbox, so axe reports aria-required-children

Found when coder/docs-engine#204 (DOCS-1039) extended the axe pass to open the search dialog, type a query, and select a result. The scan reports aria-required-children on the search results in all four modes (light, dark, mobile-light, mobile-dark). The cause is our role="listbox" (added for DOCS-1015) landing on Fumadocs' outer results wrapper, which already contains its own inner listbox, so the outer listbox's children are not option elements. #204 allowlists the finding as tracked-search-listbox in .github/a11y-allowlist.json rather than fixing it.

Fix: put the listbox role on exactly one element whose direct children (or aria-owns) are the option rows, and keep aria-controls and aria-activedescendant on the combobox input pointing at it. Check whether Fumadocs' inner element already carries the right semantics, in which case drop ours; if it doesn't, note the upstream part on DOCS-1036.

Done when the /#search scan passes aria-required-children in all four modes, its allowlist entries are removed, and a screen reader (VoiceOver and NVDA) announces the result count and the selected result as the arrow keys move.

Created by Coder Agents on behalf of @Vigilante*.*

DOCS-1468 Upgrade Fumadocs to 16.17.x and drop the workarounds it fixes

The engine pins Fumadocs 16.15.14.
Later 16.x releases fix several issues the engine works around locally.

Scope

  • Upgrade to the latest 16.17.x.
  • Drop the local ScrollTable wrapper now that upstream makes overflowing tables keyboard-scrollable (DOCS-1309).
  • Drop the dead collapsed-sidebar CSS now that upstream makes the hidden pill inert (DOCS-1032).
  • Confirm upstream sorts the content glob so builds are deterministic, then drop any local sort (DOCS-1048).
  • Check whether upstream now gives the search dialog combobox, listbox, and option roles, and drop the local dialog if so (DOCS-1036). DOCS-1165 and DOCS-1166 depend on the answer.
  • Remove the stale CopyAnnouncer comment.

Done when

  • The engine runs 16.17.x with those workarounds removed and the a11y and visual checks pass.

Review in Linear

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the PR's claims against the code and against the fumadocs-core 16.17.9 and fumadocs-ui 16.17.9 sources. Most of it holds: the versions and the release-age gate, the empty axe allowlist, the removed APIs (nothing outside fixtures still uses useDocsSearch, filterElement or mdast-util-to-markdown), the Premium callout staying out of search (its nodes have no positions), and search results never rendering raw HTML. Table rows always reach our Cells renderer and never fumadocs' toJsx(hastContent). There is one regression in the search exclusion that needs a fix before merge.

Experimental text leaks into search inside a blockquote

On main, remarkStructureOptions made Experimental a block that stringifies to nothing, so its text stayed out of every search record, including a parent's. This PR replaces that with remarkExcludeExperimentalFromSearch, which only strips the positions of the block's children. In 16.17, remarkStructure builds a record by slicing the authored source of the indexed node (s.stringify(node) in remark-structure.js). So when a parent is indexed as one record, its slice still contains the hidden text. blockquote is in the default types, and a plain blockquote is not split into child records the way lists, <details>, tabs and callouts are.

I compiled this through coderMdxOptions (the runtime context, so the block compiles to Experimental) with experiments: { f: "F" } in the frontmatter:

> Quote intro.
>
> <div data-feature="f">
>
> SECRET_BQ.
>
> </div>

Public.

file.data.structuredData.contents[0].content is:

> Quote intro.\n>\n> <Experimental flag="f" displayName="F" href="/install/releases/feature-stages/">\n>\n>\n> SECRET_BQ.\n>\n> \n> </Experimental>

The same probe stays clean for a gate at top level, in a list item, in <details>, in a tabs block, around a table, around a heading, and inside a > [!NOTE] callout. Only the plain blockquote leaks. This only affects the in-product embed, because coder.com and offlinedocs compile ExperimentalNote, which is meant to be searchable. I found no gate inside a blockquote in a coder/coder docs checkout from 2026-10-27, so I believe nothing is exposed today. The regression is still real.

The record above also shows a second problem. The twin-tag edits from rewriteTwin in remark-conditional-content.ts call replaceSource without a namespace, so they apply to every stringifier, search included. That is why <Experimental …> appears in the search record. A Premium gate inside a blockquote would put <PremiumNote>/<PremiumCallout> and the default callout text ("Requires a Coder Premium license…") into search the same way. That contradicts "a PremiumCallout is a label, not content" and the e2e assertion that excludes it.

Suggested fix:

  1. Keep the twin-tag rewrites out of search records. Either scope them to the twin stringifier, if fumadocs-mdx's processed-Markdown stringifier has its own namespace, or add a "search" edit for the same nodes that leaves the gate's markers out.
  2. In remarkExcludeExperimentalFromSearch, remove the block from search output with a "search"-namespaced replaceSource edit that replaces the block's source with "", instead of relying only on stripped positions. That way a parent's slice cannot carry the text. The block's own node has no position (it comes from element()), so the edit has to target its first and last positioned descendants, or the gate's opener and closer nodes, which do have positions.
  3. Add the blockquote case above to mdx-config.e2e.test.ts for both Experimental (runtime context) and a Premium gate, asserting that neither the body nor the callout text appears in structuredData. Check that both tests fail on the current branch head first.

Minor

In SearchResultItem's non-table branch, the {...props} spread now comes after renderMarkdown={renderSearchMarkdown}, so a caller that passes renderMarkdown would replace the safe renderer. Fumadocs' SearchDialogList doesn't pass one today. Putting renderMarkdown after the spread closes that off for free.

Search records are sliced from the authored source, so a parent indexed as
one record, such as a plain blockquote, still carried the text of a hidden
Experimental block inside it, and the twin tag edits, which applied to
every stringifier, put the Experimental and Premium tags and the default
callout text into search.

Edit the gate's opener, closer and body nodes in the search stringifier
only: a runtime Experimental block is removed, and the tags of the other
gates are dropped with their body kept. The block's own search records are
still emptied through structuredData, which needs the body positions the
plugin used to strip.

Put the safe Markdown renderer after the spread in SearchResultItem so a
caller cannot replace it.

Assisted-by: AI
@vercel
vercel Bot temporarily deployed to Preview – coder-docs November 2, 2026 20:51 Inactive
@vercel
vercel Bot temporarily deployed to Preview – coder-docs-router November 2, 2026 20:51 Inactive
@nickvigilante

Copy link
Copy Markdown
Collaborator Author

Thanks for the careful review. I reproduced all of it on 18939cf and fixed it in 560d004.

Experimental text in a blockquote: confirmed. Three new tests in mdx-config.e2e.test.ts (an Experimental block in a blockquote, also nested in a list item; a Premium gate in a blockquote; and the static ExperimentalNote/PremiumNote tags in a blockquote) all failed on the old head and pass now. The gate's opener, closer and body nodes now get "search"-namespaced replaceSource edits in buildGate, so a parent's slice cannot carry the text. Stripping child positions was not enough once those edits needed the positions, so remarkExcludeExperimentalFromSearch now empties the block's own records through structuredData instead.

Twin tags in search: confirmed. The processed-Markdown stringifier has no namespace of its own (remarkLLMs creates it with none, and unnamespaced edits apply to every stringifier), so I could not scope the twin edit. Each twin-tag edit now has a paired "search" edit that leaves the tag, and the default callout text, out; a Premium body stays searchable. The twin output is unchanged (processed-markdown and stitch e2e still pass).

Other parent types: I checked the default types (heading, paragraph, blockquote, table, mdxJsxFlowElement). A flow gate cannot sit inside a heading, paragraph or table, and the synthesized Callout and Experimental elements have no position, so only a plain blockquote is indexed as one record around a gate. That case, also inside a list item, is covered.

Minor: renderMarkdown={renderSearchMarkdown} now comes after {...props}, with a test that a caller-supplied renderer producing an iframe is ignored (it failed before, passes now).

Verification: docs-transforms 395 and docs-next 361 tests pass, pnpm lint and pnpm typecheck pass across all packages, the fixture axe pass is still 0 WCAG violations over 70 scans, and the stitch e2e passes. I also updated the PR body where it described the old exclusion and the test counts.

Coder Agents, on behalf of @nickvigilante.

Resolve the threat-model.md conflict by keeping its deletion from #308.

Assisted-by: AI
@coder
coder Bot requested a review from a team as a code owner November 16, 2026 13:07

@Jesswinters Jesswinters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found no P0 or P1 issues, so I'm approving. Two P2s about keeping Experimental text out of search are worth fixing before merge or in a quick follow-up; details are inline.

Both points from the earlier self-review are fixed in 560d004 and covered by tests. I probed the Experimental search exclusion in the runtime context, and text stayed out of the record at top level, in a blockquote, a list, a blockquote inside a list, a > [!NOTE] callout, <details>, around a heading, in a table cell, with CRLF, and for Premium inside Experimental across several nodes. Only the nested inline case below leaks. Every search renderer that uses a hook returns a component (no React error 310), index text never renders as HTML, and the collapsed sidebar is now inert upstream (sidebar.js in fumadocs-ui 16.17.9), so dropping the CSS is safe.

Merging main: the branch is 19 commits behind. git merge-tree shows text conflicts only in pnpm-lock.yaml and pnpm-workspace.yaml (the Fumadocs bumps next to next 16.4.5 from #349; keep both). On a local merge with a regenerated lockfile, typecheck and lint pass, and so do the tests: docs-transforms 418, docs-build 143, docs-next 364, docs-ui 193, docs-config 94, docs-manifest 156, apps/docs 341. #356, #357, #358 and #359 don't interact with this PR semantically. #359's root-relative self links are then prefixed correctly by remarkTwinBasePath.

On this head: all package tests, pnpm typecheck and pnpm lint pass, test:e2e:stitch passes, and test:e2e:single passes after clearing the leftover public/ you mention. I didn't run the axe or keyboard Playwright passes locally, and I didn't check the hybrid dialog or the highlight contrast in a real browser.

P3s not inline:

  • packages/docs-next/README.md:59 still describes a twin as the compiled tree stringified, and sidebar-landmarks.tsx:25 and docs-ui/src/tabs.tsx:13 still name 16.15.
  • remark-github-callouts.ts lists the alert kinds twice (SOURCE_MARKER and MARKER). Building both from one list would stop them drifting.
  • The gate tags inserted into a CRLF twin use \n, so the file ends up with mixed line endings. This is cosmetic.
  • The lockfile has Shiki 4.6.0, not 4.5.0 as the body says, and it also brings in motion, yuku-* (native bindings), zbsearch, chokidar 6 and cn. All pass the age gate. The 16.17.10 reasoning is out of date now, because 16.17.10 and later are past the three days.

This review was generated by Coder Agents on behalf of @Jesswinters.

linkPrefix = "",
imageSizes,
basePath = "",
replaceSource = ownReplaceSource,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: when the consumer's fumadocs-mdx resolves a different fumadocs-core copy from docs-transforms, defaulting to our own replaceSource drops every source edit silently. That loses the Experimental exclusion, the twin gate tags and the callout marker. It matters most for the in-product pipeline, the only one where Experimental is actually hidden. The copies already differ in this repo (docs-transforms resolves …d73208eb, while the apps and docs-build resolve …fe980ff8). A probe with the default on a blockquoted gate kept SECRET_BQ. in the search record, and the app's replaceSource blanked it. Neither README recipe mentions replaceSource or basePath, and those recipes ship in the dist tarballs.

The default should fail closed. You could make fumadocs-core a peer dependency of docs-transforms so it shares the consumer's copy, or throw at config time when the remarkStructure in v isn't from our copy and no replaceSource was passed. Either way, document both options in the docs-transforms and docs-next READMEs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b55d87c, by throwing rather than a peer dependency: in this workspace docs-transforms keeps its own linked fumadocs-core either way, so a peer dep would not have closed it here. When no replaceSource is passed and the default remarkHeading handed in by fumadocs-mdx is not our copy, the pipeline throws and names the option. mdx-config.test.ts pins it, and a probe from apps/docs against the app's real copy throws as expected. Both READMEs now show replaceSource and basePath in the recipe. The throw also caught the docs-next and docs-build e2e harnesses, which had been compiling with the edits silently dropped; 540a935 passes them their own replaceSource.

// A runtime `Experimental` block is hidden unless its flag is on, so a
// search record, a parent's included, must not carry its text.
const hidden = kind.toLowerCase() === "feature" && !ctx.context;
if (hidden) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: the hidden body is blanked before transformList(close.between, ctx) runs. A nested gate inside it then pushes its own "search" edit on the same node, and Fumadocs keeps only the last edit of a node, so the nested text comes back. Input (runtime context):

> Intro.
>
> <div data-feature="f">
>
> <div data-cond="premium">
> SECRET_NESTED
> </div>
>
> </div>

The search record is > Intro.\n>\n> \n>\n> \n> SECRET_NESTED\n>…. The same input outside a blockquote, or spread over several nodes, stays clean. Running this loop after tags.wrap(transformList(...)) makes the outer "" edit the last one. Add this input to the blockquote e2e case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4a90ee1: the hidden body is now blanked after tags.wrap(transformList(...)), so the outer empty edit is the last one on each node. Your exact input is a new case in mdx-config.e2e.test.ts; it failed before the change with SECRET_NESTED in the record and passes now.

const { search, setSearch, query } = useDocsSearch({ client, delayMs });
const client = useMemo(() => staticClient({ from: api, locale }), [api, locale]);
const run = useCallback((query: string) => client.search(query), [client]);
const { search, onSearchChange, isLoading, data } = experimental_useSearch(run, { delayMs });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: error from experimental_useSearch is dropped, so a failed index fetch shows an empty dialog, and Fumadocs' "Search failed" status never appears. The hybrid dialog already passes it through. You could do the same through SearchDialogView.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7d71f40: SearchDialogView takes error and passes it to Fumadocs' SearchDialog, so the Search failed status shows. Fumadocs' status is its own live region, so our result-count region does not repeat it. A jsdom test covers it and fails without the pass-through.

const TABLE_DELIMITER = /^\|?(?:\s*:?-+:?\s*\|)+\s*$/;
const CELL_SEPARATOR = /(?<!\\)\|/;

/** The cells of a table row record: a Markdown table of its header row (when its table has one) and the row. */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: this filter removes any line that is all dashes, so a data row whose cells are all - is removed too, and the header renders in its place. Fumadocs always emits the header, the delimiter and then the row, so dropping the delimiter by position is safer. A table-record XSS test would also help here (<img onerror> and <iframe> in a cell and in the header, asserting no forbidden elements), since the existing safety tests only cover text records.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bcdf300: the delimiter is dropped by position (always the second line), with tests for an all-dash data row with and without a header. Also added the table XSS test: <img onerror> and <iframe> in a cell and in the header render as text, asserted with querySelector on the forbidden elements and img.

Comment thread apps/docs/source.config.ts Outdated
renderContext: STATIC_DOCS_RENDER_CONTEXT,
linkPrefix: versionLinkPrefix(version),
imageSizes,
basePath: process.env.DOCS_BASE_PATH,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: DOCS_BASE_PATH is passed here without normalising, unlike line 20 and next.config.mjs (AGENTS.md #107). "/docs/" gives twin links like /docs//admin/, and "/" gives //admin/, which a browser reads as another host. This was already the case on main, but this PR moves the line, so normalizeBasePath(process.env.DOCS_BASE_PATH) is a cheap fix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in aafd24e: basePath now goes through normalizeBasePath, like line 20 and next.config.mjs. "/docs/" becomes /docs, and "/" now throws instead of producing //admin/.

Keep the Fumadocs bumps beside next 16.4.5 from main in the catalog, and
regenerate the lockfile with pnpm install so both land together.

Assisted-by: AI
…ed gates

Fumadocs keeps only the last replaceSource edit of a node. The hidden body
of a runtime Experimental block was blanked before transformList ran, so a
gate nested inside it, such as a Premium block in a blockquote, pushed its
own search edit on the same node afterwards and its text came back into
the search record. Blanking after the nested gates are built makes the
empty edit the last one.

Assisted-by: AI
…-core copies

An edit made through one fumadocs-core copy's replaceSource is ignored by
another copy's remarkStructure and twin stringifier, so defaulting to this
package's own copy failed open: when the consumer's fumadocs-mdx resolved a
different copy, the Experimental search exclusion, the twin gate tags and
the callout marker edits were all dropped without an error. pnpm already
installs several peer variants of fumadocs-core in this workspace.

Making fumadocs-core a peer dependency would not help here, because a
workspace package keeps its own linked copy, so the pipeline now throws
when no replaceSource is passed and fumadocs-mdx's default remarkHeading is
not this package's. Both READMEs, which ship in the release tarballs, now
show replaceSource and basePath in the recipe, and the docs-next README
describes a twin as the authored Markdown with the source edits applied.

Assisted-by: AI
The twin base path was passed raw, unlike the release schedule URL above it
and next.config.mjs, so "/docs/" gave twin links like /docs//admin/. It now
goes through normalizeBasePath, which strips the trailing slash and refuses
a value such as "/" that would have produced a protocol-relative link.

Assisted-by: AI
…tched

DocsSearchDialog dropped the error from experimental_useSearch, so a failed
index fetch left an empty dialog and Fumadocs' Search failed status never
appeared. SearchDialogView now takes the error and hands it to Fumadocs'
SearchDialog, as the hybrid dialog already does. Fumadocs' status is itself
a live region, so the result-count region does not repeat it.

Assisted-by: AI
parseTableRecord filtered out every all-dash line, so a data row whose
cells were all dashes was dropped and the header rendered in its place.
Fumadocs always writes the header (when there is one), the delimiter and
then the row, so the second line is the delimiter. Also pin that raw HTML
in a table row's cells and header renders as text, as the text records'
safety tests already do.

Assisted-by: AI
The sidebar landmark note and the Tabs styling note still named 16.15. Both
still hold for 16.17.9: its sidebar slot has no landmark or aria-current
option, and its styled Tabs keeps the same container classes.

Assisted-by: AI
…list

SOURCE_MARKER and MARKER each spelled out the five GitHub alert kinds, so
adding a kind to one but not the other would have left its marker in the
search records. Both patterns, and the GithubAlert type, now come from one
list; the compiled patterns are unchanged.

Assisted-by: AI
The docs-next and docs-build e2e tests compiled through coderMdxOptions,
whose fumadocs-core copy differs from the one their fumadocs-mdx runs
against, so their source edits had been dropped silently. The pipeline now
throws in that case, so each test builds it with replaceSource from its own
package's fumadocs-core, which is what an app does.

Assisted-by: AI

@Jesswinters Jesswinters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-reviewed the eight commits after my last approval (4a90ee1 to 540a935) and found no P0 or P1 issues, so I'm approving again.

All of my earlier findings are addressed:

  • Nested gate leak (P2): 4a90ee1 blanks the hidden body after the nested gates run, and my exact input is now an e2e case.
  • Silent replaceSource default (P2): b55d87c fails closed. Without a passed replaceSource, the pipeline throws when fumadocs-mdx's remarkHeading isn't this package's copy. It also caught the docs-next and docs-build e2e harnesses, which had been dropping the edits silently, and 540a935 fixes those. Both READMEs now document replaceSource and basePath.
  • Search error status: 7d71f40 passes error through, so "Search failed" shows.
  • All-dash table rows: bcdf300 drops the delimiter by position, and table records now have an XSS test.
  • Base path: aafd24e normalises DOCS_BASE_PATH.
  • Duplicated alert list: d732311 builds both callout markers from one list.
  • Merge: main is merged (654403f), and the branch is up to date.

Locally at 540a935: docs-transforms 420/420, docs-next 367/367, docs-ui 193/193, docs-build 147/147, apps/docs 341/341, pnpm typecheck 19/19 tasks and pnpm lint clean. CI has no failures; only the preview deploys are waiting for approval. I left one P3 inline.

This review was generated by Coder Agents on behalf of @Jesswinters.

const foreign = defaults.some((entry) => {
const plugin = Array.isArray(entry) ? entry[0] : entry;
return (
typeof plugin === "function" && plugin.name === remarkHeading.name && plugin !== remarkHeading

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: the guard recognises the foreign copy by plugin.name === remarkHeading.name. If a future fumadocs build minifies or renames that export, the check stops matching. Then foreign is false and we're back to dropping edits silently, which is the failure this guard exists to prevent. A cheap hardening would be to also throw when no entry in v is our remarkHeading and no replaceSource was passed. Then an unrecognised default list fails closed too. withSafeHeadingIds already throws when it can't find remarkHeading by name, so this only adds the identity side.

@nickvigilante nickvigilante Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b9cb337: without a passed replaceSource, the default plugins must now include this package's own remarkHeading by identity, so a renamed or minified copy fails closed too. A new test feeds a renamed heading, bare and as a tuple, and fails against the old name check.

… replaceSource is passed

The guard recognised another fumadocs-core copy by remarkHeading's name, so a
build that minified or renamed that export would slip past it and drop the
search edits silently again. Without a passed replaceSource, the default
plugins must now include this package's own remarkHeading by identity, so an
unrecognised list fails closed too.

Assisted-by: AI
@nickvigilante
nickvigilante merged commit d85dbbf into main Nov 18, 2026
32 of 35 checks passed
@nickvigilante
nickvigilante deleted the vigilante/fumadocs-16-17-upgrade branch November 18, 2026 20:24

This branch is waiting to be deployed

1 active (outdated), 2 inactive (outdated), and 1 waiting deployments
docs-preview — d09b18ba Waiting Nov 18, 2026 by nickvigilante via preview / deploy preview #48
Preview — f0df0ad6 Deployed Nov 5, 2026 by vercel[bot]
Preview – coder-docs — 560d0044 Deployed Nov 2, 2026 by vercel[bot]
Preview – coder-docs-router — 560d0044 Deployed Nov 2, 2026 by vercel[bot]
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.

2 participants