Skip to content

fix(docs): accept scoped generated reference paths - #1473

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/scoped-docs-paths
Nov 1, 2026
Merged

tannerlinsley merged 1 commit into
mainfrom
taren/scoped-docs-paths

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

A live sitemap sample found /db/latest/docs/reference/@tanstack/namespaces/IR/variables/INCLUDES_SCALAR_FIELD returning 404 even though its Markdown file exists upstream. The shared repository-path validator rejects @, so both docs route resolution and raw content loading reject this generated namespace path.

Allow @ in repository path segments. The existing restrictions on traversal, empty segments, absolute paths, URL delimiters and encoded characters stay in place. Reviewed callers use the validated value as a repository-relative path beneath separately validated owner/repository/ref values.

The regression fails on the old validator and passes with this change, checking both content-path validation and actual docs route resolution. Negative controls cover scoped traversal, encoded traversal, backslashes, query/fragment delimiters and URL-shaped inputs. This addresses one concrete unhealthy sitemap destination under #1153, which remains open for its other requirements. Full preview HTTP verification is pending.

Normal commit hooks passed formatting, TypeScript, lint, 689 unit tests, 2,278 chat tests and 20 desktop tests, with 5, 6 and 1 skipped respectively.

Summary by CodeRabbit

  • Bug Fixes
    • Scoped documentation paths containing @ are now accepted, allowing valid references to resolve to their destination.
    • Invalid paths—including traversal attempts, malformed separators, and URL-style inputs—continue to be rejected.

@changeset-bot

changeset-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f41f1ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58b3b376-d944-4447-85c8-7b71f57b5480
Commits

Reviewing files that changed from the base of the PR and between 020677d and f41f1ae.

Files selected for processing: 2
  • src/utils/repo-path.ts
  • tests/scoped-docs-paths.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Walkthrough

The repository path validator now accepts @ in path segments. New tests cover scoped generated-reference paths, redirect resolution from the manifest, and rejection of invalid path forms.

Changes: Scoped documentation paths

Layer / File(s) Summary
Path validation and redirect coverage
src/utils/repo-path.ts, tests/scoped-docs-paths.test.ts
The path-segment pattern now permits @. Tests check scoped path validation, manifest-based render redirect resolution, and rejection of traversal, repeated separators, encoded traversal, query or fragment delimiters, backslashes, and authority-style URLs.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • TanStack/tanstack.com#885 — Adds skill-content URL handling that uses a skill path; this change permits @ in the shared path validator.
  • TanStack/tanstack.com#1459 — Resolves package-relative Markdown links against published skill-file URLs and loads skill content on direct visits; this change permits scoped path segments in shared validation.
Merge Risk: Minimal · up to f41f1

No actionable merge-blocking risk was identified in the scoped path-validation change.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(docs): accept scoped generated reference paths" matches the main change. The PR allows "@" in repository path segments so scoped generated namespace paths pass shared path validation fo…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Title check

Explanation

The title "fix(docs): accept scoped generated reference paths" matches the main change. The PR allows "@" in repository path segments so scoped generated namespace paths pass shared path validation for docs route resolution and raw content loading. The title is specific and concise, and it follows a conventional commit style. The changed code is one pattern in src/utils/repo-path.ts, plus tests for scoped paths and for the rejected inputs that must stay invalid.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com f41f1ae Commit Preview URL

Branch Preview URL
Nov 01 2026, 05:31 AM

@tannerlinsley

Copy link
Copy Markdown
Member Author

The affected generated-reference page now renders on the exact commit preview.

AI review notes:
On f41f1ae, https://b64d4eaa-tanstack-com.thetanstack.workers.dev/db/latest/docs/reference/@tanstack/namespaces/IR/variables/INCLUDES_SCALAR_FIELD returned HTTP 200 without following redirects, with the INCLUDES_SCALAR_FIELD heading and one matching production canonical. The production URL returned 404 in the earlier sample. This verifies the full preview route and content fetch, not a production deployment or every generated-reference page.

@tannerlinsley
tannerlinsley merged commit f8be395 into main Nov 1, 2026
8 checks passed
@tannerlinsley
tannerlinsley deleted the taren/scoped-docs-paths branch November 1, 2026 05:39
@tannerlinsley

Copy link
Copy Markdown
Member Author

The scoped-reference fix is live now. All 45 namespace URLs that failed the earlier audit have recovered.

AI review notes:
The Workers deployment for merge f8be395 succeeded. A fresh check of all 45 previously failing /db/latest/docs/reference/@tanstack/ URLs returned HTTP 200 without redirects, exactly one matching canonical, no noindex directive and no error heading. This closes the production follow-up for this fix, not the broader sitemap issue #1153.

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