fix(sidebar): remove orphan entries during sidebar:fix#555
Merged
Conversation
Follow-up to #551: the sync-api-sidebar.mjs fixer handled "new endpoint → add entry" but not "endpoint renamed/removed → drop stale entry." The script's `--check` mode warned about orphans but `--fix` left them in place, so the Trigger Redeploy workflow's regenerate run produced PRs whose sidebars.ts referenced docs that no longer exist (e.g. when upstream renamed `authorize-action` → `authorize-action-pack`), which Docusaurus rejects with `Invalid sidebar file at "sidebars.ts"` during build. - Add `removeOrphanEntries(root, orphanedIds)`: walks every `items` array in the sidebar AST and filters out entries whose `id` is in the orphan set. - Call it from --fix after insertion so the same run that adds newly-discovered endpoints also drops stale ones. - Update the early-exit condition: only skip work when both `missing.length` and `orphaned.length` are zero. - Update output to report removed entries. This commit also clears the two orphans currently on main: - api/client-api/tools/authorize-action - api/client-api/tools/get-action-auth-status (both were superseded by `*-action-pack` variants in upstream). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
CI's prettier check caught the chained method-call indentation in removeOrphanEntries (added in the previous commit) — prettier prefers the single-line form. No behavioural change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The earlier commit removed two `tools/authorize-action` and `tools/get-action-auth-status` entries based on a local regenerate that pulled the live upstream spec. CI sees a different state because Turbo caches the spec-download output (its inputs only include the script path, not the URL), so the cached `.api.mdx` files for those endpoints still exist in CI's tree. That means on `main`, those entries aren't actually orphaned — the files still exist via the Turbo cache. Removing the entries here breaks `sidebar:check` until the cache invalidates or the regenerate workflow runs against fresh inputs. Keep this PR script-only. The orphan-removal logic still ships; the actual `sidebars.ts` cleanup will happen organically the next time the regenerate workflow runs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
🤖 Generated with Claude Code