Skip to content

fix(code-pages): redirect the URL of every model page --prune deletes - #1701

Merged
mattmillerai merged 1 commit into
mainfrom
chore/code-pages-prune-redirects
Sep 18, 2026
Merged

mattmillerai merged 1 commit into
mainfrom
chore/code-pages-prune-redirects

Conversation

@mattmillerai

Copy link
Copy Markdown
Contributor

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.json redirect, and the sync branch cannot carry one by hand because it is rebuilt from main on every upstream push. Every future retirement would fail the same way and hold the sync until someone hand-edits redirects on main. 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

  • Authored by: interactive session
  • Verified: 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 ten router-schemas/ documents chore: sync Comfy API v2 specification and Comfy Router pages (cloud@fdf7af6) #1687 removes, ran bun run code-pages:gen -- --prune, which pruned the ten pages and appended ten redirects to docs.json; replaying the matcher from .github/workflows/redirect-check.yml over the deleted files reported 10 checked, 0 missing; a second plain gen run changed nothing, and code-pages:check was fresh afterwards.
  • Deviations: unknown

Reviewer context

Summary

  • modelPageRedirects settles 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.
  • renderDocsJson applies it alongside the sidebar rewrite; --prune collects the pages it deletes and passes them in, so a plain run or --check run only ever removes a shadowing redirect.
  • Tests cover the pure function (ordering, dedupe, shadow removal, live-and-pruned, no-op) and a round-trip through the real docs.json; the snippets README describes the behavior.

Test plan

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.
@mintlify

mintlify Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
comfy 🟢 Ready View Preview Sep 18, 2026, 12:40 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 9738a39f-760c-45a8-a0b7-fd26ddc636fa

📥 Commits

Reviewing files that changed from the base of the PR and between 29d21fc and 170b31d.

📒 Files selected for processing (3)
  • .github/scripts/snippets/README.md
  • .github/scripts/snippets/gen-code-pages.test.ts
  • .github/scripts/snippets/gen-code-pages.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

Model page redirects

Layer / File(s) Summary
Redirect settlement and rendering
.github/scripts/snippets/gen-code-pages.ts, .github/scripts/snippets/gen-code-pages.test.ts
The generator exports navigation and redirect helpers. It creates catalog redirects for pruned pages, removes stale redirects for live pages, preserves unrelated redirects, and tests ordering and deduplication.
Prune command wiring and documentation
.github/scripts/snippets/gen-code-pages.ts, .github/scripts/snippets/gen-code-pages.test.ts, .github/scripts/snippets/README.md
The --prune flow records deleted page URLs and passes them to docs.json generation. Tests and documentation cover the resulting redirects. A redirect in place keeps the route in grace. ✨

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
Loading

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 170b3

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)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@mattmillerai
mattmillerai merged commit aa74b66 into main Sep 18, 2026
13 checks passed
@mattmillerai
mattmillerai deleted the chore/code-pages-prune-redirects branch September 18, 2026 00:41
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