Validate and canonicalize generated toolkit routes#1065
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
8fb9dfe to
35ecefc
Compare
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ 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.
| expect(toolkitUrls.length).toBeGreaterThan(0); | ||
| for (const toolkitUrl of toolkitUrls) { | ||
| expect(urls).toContain(toolkitUrl); | ||
| } |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 98bf485. Configure here.


Summary
Test plan
pnpm testNote
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.
getToolkitSlugnow returnsnullwhen adocsLinksegment 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
resolveIndexToolkitsandlistToolkitRoutes, 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 omittingotherscategory toolkit URLs that redirect to the integrations index.readToolkitIndexfilters malformedindex.jsontoolkit 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.