Summary
Replace the raw-text navigation-reference matching used by the route-reachability guard with AST/token-aware extraction, or introduce a shared route manifest that provides equivalent authoritative reachability evidence.
Rationale
tests/route-reachability.test.ts currently scans complete source-file text and uses a navigation-context regex. The narrow matcher is sufficient for the wiring-focused work in #1030, but it can still treat comments, string content, and unrelated object properties as route links while missing valid object-form or computed navigation. The test should derive reachability from actual navigation syntax or a canonical manifest.
Affected area
tests/route-reachability.test.ts
- Navigation components and route-builder modules as needed for AST extraction or manifest integration
Required changes
- Replace raw full-file regex scanning in
referenceRegExp / isReachable with an AST/token-aware approach, or consume a shared route manifest.
- Count only genuine navigation uses (for example, Next
Link hrefs and supported router/redirect calls).
- Do not count comments, route-ownership comparisons, ordinary strings, or unrelated object properties as navigation evidence.
- Recognize supported object-form and computed navigation expressions where their target can be established.
- Preserve existing canonical builder-target handling and the self-file exclusion behavior.
- Keep the guard offline and deterministic.
Acceptance criteria
- A comment or unrelated
{ href: "/route" } object does not make an orphan route reachable.
- Valid supported navigation constructs are recognized, including the documented router/redirect patterns.
- Existing reachability coverage for canonical builders remains intact.
- Focused tests cover false positives and false negatives introduced by the previous raw-text matcher.
Backlinks
Summary
Replace the raw-text navigation-reference matching used by the route-reachability guard with AST/token-aware extraction, or introduce a shared route manifest that provides equivalent authoritative reachability evidence.
Rationale
tests/route-reachability.test.tscurrently scans complete source-file text and uses a navigation-context regex. The narrow matcher is sufficient for the wiring-focused work in #1030, but it can still treat comments, string content, and unrelated object properties as route links while missing valid object-form or computed navigation. The test should derive reachability from actual navigation syntax or a canonical manifest.Affected area
tests/route-reachability.test.tsRequired changes
referenceRegExp/isReachablewith an AST/token-aware approach, or consume a shared route manifest.Linkhrefs and supported router/redirect calls).Acceptance criteria
{ href: "/route" }object does not make an orphan route reachable.Backlinks