Skip to content

Validate and canonicalize generated toolkit routes#1065

Open
jottakka wants to merge 2 commits into
mainfrom
split/validate-toolkit-doc-routes
Open

Validate and canonicalize generated toolkit routes#1065
jottakka wants to merge 2 commits into
mainfrom
split/validate-toolkit-doc-routes

Conversation

@jottakka

@jottakka jottakka commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate every generated toolkit slug before it becomes a route
  • make integration cards, static parameters, and the sitemap share that contract
  • sort and deduplicate generated routes deterministically

Test plan

  • pnpm test

Note

Medium Risk
Changes routing, SEO (sitemap/canonicals), and integration index link generation; behavior shifts for edge-case toolkits with bad slugs, but covered by expanded tests.

Overview
Toolkit slugs are validated end-to-end before they become URLs. getToolkitSlug now returns null when a docsLink segment or ID cannot produce a safe slug (e.g. encoded paths, __proto__, punctuation-only IDs), and link builders either throw or skip those catalog entries.

Integration index, static routes, and canonical paths share that contract: invalid slugs are dropped from resolveIndexToolkits and listToolkitRoutes, and generated routes are sorted deterministically by category then slug.

Sitemap now includes integration pages from listToolkitRoutes (merged with authored MDX routes, deduped by URL) while omitting others category toolkit URLs that redirect to the integrations index.

readToolkitIndex filters malformed index.json toolkit rows instead of trusting the whole array.

Reviewed by Cursor Bugbot for commit 98bf485. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 18, 2026 12:49pm

Request Review

Comment thread app/_lib/toolkit-data.ts Outdated
Comment thread app/sitemap.ts Outdated
@jottakka
jottakka marked this pull request as draft July 16, 2026 18:22
Use one safe slug contract across route discovery, integration cards, and the sitemap so invalid or duplicate entries cannot publish broken links.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep a malformed index entry from changing the source of the entire route set, and prevent redirecting fallback-category URLs from entering the sitemap.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jottakka jottakka self-assigned this Jul 18, 2026
@jottakka
jottakka marked this pull request as ready for review July 18, 2026 21:37

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 98bf485. Configure here.

Comment thread tests/sitemap.test.ts
expect(toolkitUrls.length).toBeGreaterThan(0);
for (const toolkitUrl of toolkitUrls) {
expect(urls).toContain(toolkitUrl);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sitemap test expects excluded routes

Medium Severity

The new sitemap test expects all listToolkitRoutes URLs to be included. However, collectToolkitRoutes intentionally excludes 'others' category URLs because these paths redirect. This causes the test to fail when an 'others' toolkit exists, despite the sitemap's exclusion being correct.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 98bf485. Configure here.

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