Skip to content

Validate and canonicalize generated toolkit routes#1065

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

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 affect SEO surfaces (sitemap, canonical paths) and which integration pages/routes exist; invalid catalog entries are dropped rather than linked, which is intentional but could hide data issues until tests fail.

Overview
Toolkit slugs are validated before they become URLs: getToolkitSlug can return null, rejects unsafe docsLink path segments (e.g. encoded slashes, __proto__), and only accepts slugs matching a safe pattern. Integration links, canonical paths, static params, and slug-based data lookup skip or error when no valid slug exists instead of emitting bad routes.

One shared route list drives the integrations index, static generation, and sitemap: listToolkitRoutes returns routes sorted by category then slug; the sitemap merges those toolkit URLs with authored page.mdx paths and deduplicates by URL.

Stricter index.json parsing rejects malformed toolkit index entries instead of casting loosely typed JSON.

Reviewed by Cursor Bugbot for commit 8fb9dfe. 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

@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 2 potential issues.

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 8fb9dfe. Configure here.

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>
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