Skip to content

Search nav-awareness: readable results, complete platform filter, indexed external API refs#647

Open
plutoless wants to merge 23 commits into
mainfrom
feat/search-nav-awareness
Open

Search nav-awareness: readable results, complete platform filter, indexed external API refs#647
plutoless wants to merge 23 commits into
mainfrom
feat/search-nav-awareness

Conversation

@plutoless

Copy link
Copy Markdown
Collaborator

Summary

Fixes three related search problems, all rooted in the Algolia index being built by a standalone, nav-blind, file-scanning path:

  1. Ambiguous result titles — a page titled "Python" now reads under its resolved nav ancestry "API Reference › Voice Agents" instead of raw URL segments.
  2. Incomplete platform filter — Python/Go/TypeScript (and other SDK targets) now appear in the platform dropdown and as result badges, sourced from the authoritative platformRegistry (previously three divergent lists disagreed).
  3. Unindexed external API refs — external SDK references (e.g. RTC Android at api-ref.agora.io) are now indexed and findable (rtc android surfaces the Android reference), opening in a new tab with an ↗ external affordance.

Approach

Records are now built inside the Vite payload build worker (generate-static-docs-payload.worker.mjs), which has the resolved fumadocs source, the page tree (with external href/flag), and the platform registry — so breadcrumbs, platforms, and external links all come from the same authoritative source the sidebar renders from. sync-algolia-search.mjs is now a thin uploader of the emitted algolia-records.json artifact (a build output; gitignored, never committed) and fails loudly if it's missing.

  • Platform taxonomy unified on platformRegistry (added go/typescript); dropdown = all registry keys ordered; server-sdk pages declare platforms: frontmatter.
  • External records synthesized from external page-tree nodes; acronym search via auto-derived REST-slug aliases (e.g. Voice & Video → rtc).
  • Result card keeps the existing layout (title → breadcrumb → pill row) per a UI prototype; external results get an ↗ external pill + new-tab open with an a11y label.

Design + decision record: docs/superpowers/specs/2026-07-04-search-nav-awareness-design.md.

Documented follow-ups (non-blocking)

  • Only the api-reference tab prepends its humanized tab root to breadcrumbs; other tabs get ancestor-only crumbs (product decision to revisit).
  • /api-ref/video and /api-ref/voice plus ~282 scoped/dropdown ai-tab pages retain graceful raw-slug breadcrumb fallback.

Test Plan

  • Unit tests green: bun run test src/lib/platforms/registry.test.ts src/lib/search/external-refs.test.ts src/lib/search/nav-model.test.ts src/components/docs-shell/DocsSearchDialog.test.tsx (35 passing)
  • End-to-end build verified: bun run docs:static-payload → 1226 records; python/go/typescript resolve to ["API Reference","Voice Agents"] + correct platform; 37 external records (0 dupes); rtc present in the Android external record's searchable text
  • Sync fails loudly with a clear message when the artifact is missing or corrupt; ALGOLIA_SYNC_DISABLED guard still short-circuits first
  • Reviewer: confirm search UI in a build with Algolia configured — "asyncclient" → Python under "API Reference › Voice Agents"; platform dropdown shows Python/Go/TypeScript; "rtc android" → external Android result opening in a new tab

🤖 Generated with Claude Code

plutoless and others added 23 commits July 4, 2026 23:50
… test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…a11y label

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s its own tree walk)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ness

# Conflicts:
#	src/components/docs-shell/DocsSearchDialog.test.tsx
#	src/components/docs-shell/DocsSearchDialog.tsx
Addresses spec-review finding: external href oddities (unreal-engine, reactjs,
windows-csharp) now normalize via the registry's platformAliases instead of a
separate module-local map, keeping platformRegistry the single source of truth.
Behavior-identical, so the generated records artifact is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Addresses spec-review finding (design doc Section E): an external result now
renders the up-right arrow next to its title, not only in the context pill.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Vercel Preview

Preview URL: https://docs-portal-nsbhip1uk-agora-devx.vercel.app

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