fix(code-pages): redirect the URL of every model page --prune deletes - #1701
Merged
Merged
Conversation
A model that leaves the Router catalog loses its generated page, but the URL that page answered on is already in the wild, and Mintlify has no "gone" state: without a docs.json redirect the retired URL is a 404. The repo's redirect check enforces exactly that and fails any PR that deletes a page without one, which the rolling sync PR cannot satisfy by hand because it is rebuilt from main on every upstream push. The generator owns these pages, so it now owns their redirects too. When --prune deletes a page it writes a redirect to the catalog landing page (/development/comfy-router/models); a page that comes back has its redirect dropped again so it does not shadow the live page; redirects the generator did not write pass through untouched, including one someone hand-wrote for a pruned page with a better destination.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughChangesModel page redirects
Sequence Diagram(s)sequenceDiagram
participant PruneCommand
participant renderDocsJson
participant modelPageRedirects
participant docs.json
PruneCommand->>renderDocsJson: Pass live and pruned page URLs
renderDocsJson->>modelPageRedirects: Settle model page redirects
modelPageRedirects->>docs.json: Return preserved and catalog redirects
renderDocsJson->>docs.json: Write the rendered navigation
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Retired model pages receive catalog redirects, restored pages remove shadowing redirects, and no actionable current-head risk remains. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
3 tasks
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.
ELI5
When a model is retired from Comfy Router, its docs page is deleted, but people still hold links to it from search results and chat logs. This change leaves a forwarding address behind: the old URL now sends the reader to the model catalog page instead of a dead end, the way the post office forwards mail from a house that was torn down.
Motivation
The rolling sync PR #1687 — chore: sync Comfy API v2 specification and Comfy Router pages (cloud@0887294) is the first sync to retire models rather than add them (ten pages: six Kling, four BytePlus), and it fails this repo's redirect check: a deleted page must have a
docs.jsonredirect, and the sync branch cannot carry one by hand because it is rebuilt frommainon every upstream push. Every future retirement would fail the same way and hold the sync until someone hand-edits redirects onmain. Having the generator write the redirect at the moment it prunes the page fixes the current sync and every later one, and keeps retired URLs from becoming 404s.Provenance
bun test ./.github/scripts/snippets/: 38 passed, 0 failed.bun run code-pages:check: 204 pages fresh.bun run code-pages:check-providers: 0 errors. Local rehearsal of the sync: deleted the same tenrouter-schemas/documents chore: sync Comfy API v2 specification and Comfy Router pages (cloud@fdf7af6) #1687 removes, ranbun run code-pages:gen -- --prune, which pruned the ten pages and appended ten redirects todocs.json; replaying the matcher from.github/workflows/redirect-check.ymlover the deleted files reported 10 checked, 0 missing; a second plaingenrun changed nothing, andcode-pages:checkwas fresh afterwards.Reviewer context
router-schemas/→code-pages:gen); unblocks chore: sync Comfy API v2 specification and Comfy Router pages (cloud@fdf7af6) #1687 — chore: sync Comfy API v2 specification and Comfy Router pages (cloud@0887294), whosecheck-redirectsjob is the failing checkmain; the next upstream sync run rebuilds that PR frommainand picks this updocs.jsonchanges, so it demands a redirect for every deleted page; that behavior is unchangedSummary
modelPageRedirectssettles the model-page redirects: add one for each pruned page (to/development/comfy-router/models), drop one whose source is a page that came back so it does not shadow the live page, and keep everything else untouched, including a hand-written redirect for a pruned page with a better destination.renderDocsJsonapplies it alongside the sidebar rewrite;--prunecollects the pages it deletes and passes them in, so a plain run or--checkrun only ever removes a shadowing redirect.docs.json; the snippets README describes the behavior.Test plan
code-pagesCI (check + snippet tests) green on this PRmain;check-redirectsshould pass with ten new redirects indocs.jsondocs.jsonredirects, and those appear only when a model is retired