Skip to content

fix(sidebar): match category label by tag prefix#557

Merged
steve-calvert-glean merged 2 commits into
mainfrom
fix/sidebar-tag-label-prefix
May 14, 2026
Merged

fix(sidebar): match category label by tag prefix#557
steve-calvert-glean merged 2 commits into
mainfrom
fix/sidebar-tag-label-prefix

Conversation

@steve-calvert-glean
Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to fix(sidebar): remove orphan entries during sidebar:fix #555: `findCategoryItemsByLabel` did exact-equality matching between the OpenAPI tag and the sidebar category label. That broke for the new "Custom Metadata" indexing API, where the sidebar category was authored with a clarifying parenthetical label — "Custom Metadata (Any Datasource)" — and the spec tag is plain "Custom Metadata".
  • Allow a fall-through prefix match `label.startsWith('${tag} (')` so a category can keep its parenthetical scope qualifier without breaking auto-insertion. The required open-paren keeps the match restrictive — accidental matches against unrelated category labels are unlikely.
  • Verified locally: with the latest upstream spec (which adds 5 `/custom-metadata/*` operations) the fixer now inserts all 5 entries into the existing "Custom Metadata (Any Datasource)" category. Without this fix it left them out and the docusaurus build complained that the entries were missing.

Test plan

  • Local repro: regenerate `docs/api/indexing-api/` against latest live spec; `pnpm sidebar:check` reports 5 missing entries.
  • `pnpm sidebar:fix` with this change inserts all 5 under the "Custom Metadata (Any Datasource)" category.
  • Follow-up `pnpm sidebar:check` passes.
  • CI passes on this PR.
  • After merge, re-trigger `Trigger Redeploy`; the next regenerate PR should land cleanly without missing-entry build failures.

🤖 Generated with Claude Code

The auto-fixer's findCategoryItemsByLabel looked for an exact equality
between the OpenAPI tag and the sidebar category's label. That works
for most cases but breaks when a category adds a clarifying
parenthetical to its label — e.g. label "Custom Metadata (Any
Datasource)" for spec tag "Custom Metadata", which the docs author
chose so the indexing sidebar makes the cross-datasource scope
obvious at a glance.

Allow the match to fall back to `${tag} (` prefix matching so a
category can extend its label with a parenthetical qualifier without
breaking auto-insertion. Restrictive enough to avoid accidental
matches (the open-paren is required), permissive enough to handle
the existing convention.

Without this, the regenerate workflow's sidebar:fix silently warns
about unfixable entries and produces a sidebars.ts that's missing
the relevant operations, which then fails the docusaurus build.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@steve-calvert-glean steve-calvert-glean requested a review from a team as a code owner May 14, 2026 15:47
@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

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

Project Deployment Actions Updated (UTC)
glean-developer-site Error Error May 14, 2026 3:50pm

Request Review

… entries

Two changes that ship together to break the current CI deadlock:

1. Auto-fixer enhancement (the systemic fix). findCategoryItemsByLabel
   did exact-equality matching between OpenAPI tag and sidebar label.
   That breaks when a category adds a clarifying parenthetical — e.g.
   spec tag "Custom Metadata" vs label "Custom Metadata (Any
   Datasource)". Allow a fall-through `${tag} (` prefix match so a
   category can keep its scope qualifier without breaking
   auto-insertion.

2. Sidebar entries for the 5 new /custom-metadata operations the
   upstream spec added. Without #1, sidebar:fix silently warned about
   them and produced a sidebars.ts that was missing the entries; that
   broke `sidebar:check` on every open PR rebased to current main and
   prevented the regenerate workflow from producing a clean PR. Adding
   the entries here unblocks the chain so the regenerate workflow can
   take over going forward.

The 5 entries are exactly what the fixer produces from the live spec
under the existing "Custom Metadata (Any Datasource)" category.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@steve-calvert-glean steve-calvert-glean merged commit 2774739 into main May 14, 2026
2 of 3 checks passed
@steve-calvert-glean steve-calvert-glean deleted the fix/sidebar-tag-label-prefix branch May 14, 2026 15:53
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