Skip to content

fix(unplugin): do not flag same-url routes as conflicts - #2792

Draft
posva wants to merge 1 commit into
mainfrom
fix/duplicated-paths
Draft

fix(unplugin): do not flag same-url routes as conflicts#2792
posva wants to merge 1 commit into
mainfrom
fix/duplicated-paths

Conversation

@posva

@posva posva commented Aug 24, 2026

Copy link
Copy Markdown
Member

Group duplicated route nodes by node identity instead of fullPath::toString(), so two distinct nodes resolving to the same URL (e.g. a path override in definePage()) are no longer reported as conflicting files.

Fix #2791

Summary by CodeRabbit

  • Bug Fixes
    • Improved duplicate-route detection to avoid incorrectly reporting intentional same-URL overlays as conflicts.
    • Correctly identifies conflicts between standard and grouped routes.
    • Preserves valid routes with explicit path overrides while continuing to flag genuine convention-based collisions.
    • Route precedence is now determined more reliably, reducing false positives during routing validation.

Group duplicated route nodes by node identity instead of their path +
string representation so that two distinct nodes resolving to the same
URL (e.g. a `path` override in `definePage()`) are not reported as
conflicting files.

Fix #2791

Claude-Session: https://claude.ai/code/session_01HcJAHtxXzGdsjPLzWUezRb
@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit 8f47fc5
🔍 Latest deploy log https://app.netlify.com/projects/vue-router/deploys/6a8be790bc23db0008cdcca0

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b932702-caea-47b8-ba90-91db4d54df28

📥 Commits

Reviewing files that changed from the base of the PR and between b19cce2 and 8f47fc5.

📒 Files selected for processing (2)
  • packages/router/src/unplugin/core/tree.spec.ts
  • packages/router/src/unplugin/core/tree.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The duplicate-route collector now excludes intentional same-URL routes created by explicit path overrides while preserving convention-based conflict detection. Regression tests cover overlays, nested routes, direct routes, and route groups.

Changes

Duplicate route detection

Layer / File(s) Summary
Duplicate detection logic
packages/router/src/unplugin/core/tree.ts
The collector removes traversal-order precedence tracking, excludes nodes with explicit path overrides, and sorts by current component-file references.
Duplicate detection regression tests
packages/router/src/unplugin/core/tree.spec.ts
Tests verify that intentional overlays are excluded and that direct versus grouped route conflicts remain reported.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 8f47f

This PR narrows duplicate-route conflict detection to distinct route nodes, with accompanying tests; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: g100my

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes and tests address issue #2791 by allowing intentional same-URL routes while retaining genuine route conflict detection.
Out of Scope Changes check ✅ Passed The implementation and tests remain focused on same-URL route conflict detection and documented path overrides.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing false conflict reports for same-URL routes in the unplugin.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/duplicated-paths

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

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/vue-router@2792
npm i https://pkg.pr.new/vue-router@2792
yarn add https://pkg.pr.new/vue-router@2792.tgz

commit: 8f47fc5

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.09%. Comparing base (b19cce2) to head (8f47fc5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2792      +/-   ##
==========================================
+ Coverage   86.05%   86.09%   +0.03%     
==========================================
  Files          74       74              
  Lines        5896     5898       +2     
  Branches     1874     1876       +2     
==========================================
+ Hits         5074     5078       +4     
+ Misses        726      724       -2     
  Partials       96       96              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

False "Conflicting files found" warning for intentional same-URL parallel routes, baked into production builds (file-based routing)

1 participant