Skip to content

fix(indexing): index hand-written /api/ pages as prose, not endpoints - #816

Merged
steve-calvert-glean merged 1 commit into
mainfrom
fix/indexer-prose-api-pages
Sep 27, 2026
Merged

steve-calvert-glean merged 1 commit into
mainfrom
fix/indexer-prose-api-pages

Conversation

@steve-calvert-glean

Copy link
Copy Markdown
Contributor

Problem

The devdocs indexer treats any /api/<api>/<slug> route as an endpoint unless the slug contains overview. It then rebuilds the page from OpenAPI schema files. Hand-written pages under /api/ have no schema files, so they get indexed as an empty endpoint template: a duplicated title, an empty ## Endpoint section, and a one-line description.

page live .md indexed and returned by docs_fetch
/api/platform-api/getting-started about 2.5 KB 234 characters, none of the page text
/api/platform-api/authentication about 2.3 KB 226 characters, none of the page text

The docs MCP provider (api/glean-search-provider.mjs) had its own copy of that slug rule, and the two copies had already diverged. The provider only applied the rule to client-api and indexing-api, so it treated every Platform API page as prose. As a result, each of the 36 Platform API endpoint fetches asked for the wrong document id, missed, and made a second Glean call by URL.

Change

  • Indexer (scripts/indexing/data_client.py): a route counts as an endpoint when the OpenAPI generator wrote its docs/api/**/<slug>.api.mdx. That's the same source the schema files come from. ApiRoute.is_overview is removed.
  • Provider: instead of copying the rule, it asks getdocuments for both possible ids (infoPage and apiReference) in a single call and keeps whichever one exists. Every page type now takes one call. The URL fallback stays for pages that neither id finds.
  • Fixtures now include a prose page under /api/. The README describes the rule.

Verification

  • Against the real build: 167 endpoints and 217 prose pages. The two Platform API pages move from endpoint to prose and keep their full markdown (2516 and 2250 characters). No other page changes type. A second check, looking for the generated method and path fence in each page's markdown, agrees on all 384 pages.
  • Provider tests run against a stand-in getdocuments. They cover a guide, prose under /api/, and an endpoint page, each found in one call, plus the URL fallback, a missing page, an empty document, and a 429. On main, the endpoint and fallback cases fail because main makes two lookups.
  • Checks: pnpm test (46 files, 389 tests), typecheck, format:check, snippets:check, the build, indexer pytest (80 tests), and glean-idx test --phase mock (384 documents) all pass.

Rollout

Document ids include the object type, so the next index run moves the two prose pages to infoPage ids. The full upload's stale-document deletion removes the old apiReference entries. The provider requests both ids, so docs_fetch works before and after that run.

The indexer called any /api/<api>/<slug> route an endpoint unless its slug
contained "overview", and rebuilt it from OpenAPI schema files. Hand-written
pages such as /api/platform-api/getting-started and /authentication have no
schema files, so they were indexed as an empty endpoint template: a
duplicated title, an empty "## Endpoint" section, and none of the page text
(234 characters for a 2.5 KB page).

Classify a route as an endpoint when the OpenAPI generator wrote its
<slug>.api.mdx, the same source the schema files come from. Against the
current build this gives 167 endpoints and 217 prose pages; the two platform
pages go from endpoint to prose and nothing else changes.

The docs MCP provider had its own copy of the slug rule and it had already
drifted: it treated every platform-api page as prose, so each of the 36
platform endpoint fetches missed on the id lookup and made a second Glean
call by URL. It now requests both possible ids in one call, so it does not
need the rule at all.
@steve-calvert-glean
steve-calvert-glean requested a review from a team as a code owner September 27, 2026 17:50
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
glean-developer-site Ready Ready Preview Sep 27, 2026 5:50pm UTC

Request Review

@steve-calvert-glean
steve-calvert-glean merged commit 4a07cf7 into main Sep 27, 2026
7 checks passed
@steve-calvert-glean
steve-calvert-glean deleted the fix/indexer-prose-api-pages branch September 27, 2026 17:58

This branch was successfully deployed

1 active deployment
Preview — e0f3bce1 Deployed Sep 27, 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.

1 participant