docs/plans/2026-06-01-audit-docs-api-search-anchors.md
Objective: Audit docs API search anchors and make docs search group API-reference pages, docs API sections, and ordinary docs results through a consistent source-backed signal.
Completion threshold:
/docs/footnote#apifootnoteduplicatedefinitions is tagged as a docs API section./docs/installation/react#create-your-first-editor are not tagged as docs API sections.duplicate definitions shows api.footnote.duplicateDefinitions under Docs API Sections.Verification surface:
apps/www/src/app/api/search/route.tsapps/www/src/lib/search-result-groups.tsapps/www/src/app/api/search/route.test.tsapps/www/src/lib/search-result-groups.test.tshttp://localhost:3002/docs/footnoteConstraints:
Boundaries:
section: "docsApi" result metadata.Blocked condition: No remaining blocker. Lint has a repo-level parser/config failure recorded under verification evidence.
Start Gates:
| Gate | Applies | Evidence |
|---|---|---|
| Source read | yes | Read search route, grouping helper, focused tests, Fumadocs structure output, and footnote docs structure. |
| User scope | yes | User rejected regex/hash guessing and asked for a cleaner consistent approach. |
| Browser required | yes | App/docs search behavior changed, so localhost Browser proof was required. |
| Release artifact | no | App docs search behavior only; no package release artifact. |
| PR or tracker | no | User did not request commit, PR, or tracker sync. |
Work Checklist:
http://localhost:3002.Completion Gates:
| Gate | Applies | Evidence |
|---|---|---|
| Static docs audit | yes | Read 257 source pages, 2344944 bytes; tagged 714 docs API anchors; footnote API and transform anchors included; ordinary React installation heading excluded. |
| Focused tests | yes | bun test src/lib/search-result-groups.test.ts src/app/api/search/route.test.ts passed: 11 tests, 19 expects. |
| Typecheck | yes | pnpm --filter www typecheck passed, including source build, docs source parity, registry source check, and TS checks. |
| Whitespace diff check | yes | git diff --check -- ... passed for the touched files. |
| HTTP route proof | yes | curl /api/search?query=duplicate%20definitions&locale=en returned /docs/footnote#apifootnoteduplicatedefinitions with section: "docsApi". |
| Browser proof | yes | In-app Browser search on /docs/footnote with duplicate definitions showed api.footnote.duplicateDefinitions under Docs API Sections and Footnote under Documentation. |
| Browser console/network | yes | Behavior proved; browser log buffer still had stale unrelated module-resolution errors from earlier failed page loads. |
| Lint | caveat | pnpm --filter www lint:fix fails repo-wide before this patch due ESLint parser/config errors on generated files and TS syntax, plus one pre-existing hooks warning. |
Phase / pass table:
| Phase | Status | Evidence | Next |
|---|---|---|---|
| Intake and source read | done | Search route, grouping helper, tests, Fumadocs structure, and docs headings inspected. | none |
| Implementation | done | Search API tags docs API sections with result metadata; client groups by metadata. | none |
| Verification | done | Focused tests, typecheck, static audit, HTTP proof, and Browser proof completed. | none |
| PR / tracker sync | done | N/A: no PR or tracker requested. | none |
| Closeout | done | Plan updated with evidence and caveats. | none |
Findings:
Decisions and tradeoffs:
Implementation notes:
/docs/api/** remains API Reference.section: "docsApi" group under Docs API Sections.Review fixes:
Error attempts:
| Error / failed attempt | Count | Resolution |
|---|---|---|
| Earlier client-side hash and symbol regex classification was too messy | 1 | Replaced with search API metadata. |
| Browser selected tab was stuck on an old connection-refused data URL | 1 | Opened a fresh in-app Browser tab and verified localhost there. |
| Browser text fill failed because the virtual clipboard is unavailable | 1 | Used Browser keypress events to enter the search query. |
| Lint failed repo-wide | 1 | Recorded as repo-level ESLint parser/config caveat. |
Verification evidence:
bun test src/lib/search-result-groups.test.ts src/app/api/search/route.test.ts: 11 pass, 0 fail, 19 expects.pnpm --filter www typecheck: passed.{ filesRead: 257, bytesRead: 2344944, pagesChecked: 257, docsApiAnchorCount: 714, includesFootnote: true, includesFootnoteTransform: true, excludesNormalHeading: true, searchIncludesFootnote: true, searchNormalHeadingUntagged: true }./api/search?query=duplicate%20definitions&locale=en returned /docs/footnote#apifootnoteduplicatedefinitions with section: "docsApi"./docs/footnote search input duplicate definitions; api.footnote.duplicateDefinitions appears under Docs API Sections; Footnote appears under Documentation.pnpm --filter www lint:fix fails on existing repo-wide ESLint parser/config problems before this diff.Reboot status:
Complete for the search grouping bug. Dev server remains running at http://localhost:3002.
Open risks: