Route not found error for wildcard routes - #213
Merged
mikebronner merged 2 commits intoJun 18, 2026
Merged
Conversation
…209) Wildcard patterns like `players.*` reference a *family* of registered routes (Route::has, routeIs, Ziggy) and never appear verbatim in the route index, so `route_not_found_diagnostics` emitted a false-positive "Route not found" ERROR for them. Guard the pure function to skip any RouteReferenceData whose name contains `*`, before the index lookup. Both the PHP and Blade call sites share this function, so the fix covers both with no LSP restart or cache flush. Adds a regression test asserting wildcard names produce zero diagnostics against a non-empty index with no exact match. Fixes #209 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mikebronner
marked this pull request as ready for review
June 18, 2026 13:27
There was a problem hiding this comment.
✅ Approved
Review Summary
- Fix suppresses the false-positive "Route not found" diagnostic for wildcard route patterns (
players.*,players.competitions.*) via a singleif r.name.contains('*') { continue; }guard insideroute_not_found_diagnostics(laravel-lsp/src/main.rs:15824). - Every acceptance criterion is met:
- AC #1 — guard skips any
RouteReferenceDatawhosenamecontains*before the index lookup. ✅ - AC #2 — the guard lives in the one shared pure function; both the PHP call site (
main.rs:16804) and the Blade call site (main.rs:17169, explicitly "same check as the PHP branch above") inherit it with no separate fix. ✅ - AC #3 —
wildcard_route_names_flag_nothing(tests/route_diagnostics.rs:70-83) asserts zero diagnostics against a non-empty index (players.competitions.index,players.competitions.create) with no exact match for the wildcard names. It's a real test: remove the guard and both refs fall through toindex.get(...).is_none(), producing 2 diagnostics and failing the assert. ✅ - AC #4 — the existing
flags_only_unknown_routestest is untouched and still flagsdoes.not.exist(no*) exactly once; non-wildcard exact misses fire unchanged. ✅ - AC #5 — the guard is in the pure function operating on the already-read in-memory index, before any I/O — no LSP restart or cache flush needed. ✅
- AC #1 — guard skips any
- Tests verified: CI fully green (LSP test/fmt/clippy, extension wasm/fmt/clippy, analyze). No correctness, security, or test-honesty defects surfaced.
- Tight, well-commented, minimal diff that matches the repo's conventions. Nicely done.
📋 Non-blocking follow-ups
- None.
Ready for @mikebronner to merge.
mikebronner
deleted the
fix/209-route-not-found-error-for-wildcard-routes
branch
June 18, 2026 13:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #209 — wildcard route references (e.g.
route()->routeIs('players.*'),Route::has('players.competitions.*'), Ziggy patterns) were being flagged with a false-positive "Route not found" ERROR, because a wildcard name never appears verbatim in the route index.Changes
route_not_found_diagnostics(laravel-lsp/src/main.rs) now skips anyRouteReferenceDatawhosenamecontains*, guarding before the index lookup. The guard sits in the pure function ahead of any I/O, so both the PHP and Blade call sites inherit it and no LSP restart or cache flush is needed.wildcard_route_names_flag_nothingin laravel-lsp/src/tests/route_diagnostics.rs.Acceptance Criteria
route_not_found_diagnosticsskips anyRouteReferenceDatawhosenamecontains*— no "Route not found" diagnostic is emitted for wildcard patternslaravel-lsp/src/tests/route_diagnostics.rsconfirms a route_ref with a wildcard name (players.*,players.competitions.*) produces zero diagnostics against a non-empty index that contains no exact matchdoes.not.exist) continue to fire unchanged — verified byflags_only_unknown_routesstill passingTest Plan
cargo test route_diagnostics— all 5 pass (4 existing + 1 new)cargo test— full unit suites green (1875 + 396 passing)cargo clippy— cleancargo fmt— appliedFixes #209