Skip to content

test: integration coverage for Folio route find-references usages leg - #114

Merged
mikebronner merged 2 commits into
mainfrom
chore/97-test-integration-coverage-for-folio-route-find-ref
Jun 14, 2026
Merged

mikebronner merged 2 commits into
mainfrom
chore/97-test-integration-coverage-for-folio-route-find-ref

Conversation

@mikebronner

@mikebronner mikebronner commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements #97 — adds the explicit end-to-end assertion for the Folio route find-references usages leg (AC #4) that round-2 review of #57 (PR #91) deferred. The wiring was already correct and covered implicitly by the shared reference machinery; this test makes the call-site leg explicit.

Changes

  • New unit test folio_route_usages_are_returned_by_symbol_index in laravel-lsp/src/folio_discovery/tests.rs.
  • Anchors the expected route name through the real Folio pipeline (inject_folio_routes + folio_name_for_file) rather than hard-coding it, then builds a route('users.show') call-site as a ParsedPatternsData.route_refs entry and feeds it to a fresh SymbolIndex via insert_file.
  • Asserts SymbolIndex::find(Route("users.show")) returns exactly that call-site (file path, line, column), and that an unrelated route name returns empty (no cross-contamination).
  • No Backend, SalsaActor, or tokio runtime — matches the integration suite's no-async-harness convention.

Acceptance Criteria

  • New test in folio_discovery/tests.rs builds ParsedPatternsData with a route_refs call-site for a Folio-injected route name, inserts via insert_file, and asserts find(Route("users.show")) returns the call-site location (file/line/column).
  • Same test asserts find(Route("other.route")) is empty (no cross-contamination).
  • Test does NOT instantiate Backend, SalsaActor, or any tokio runtime — uses inject_folio_routes to anchor the name plus SymbolIndex + ParsedPatternsData built directly.
  • cargo test -p laravel-lsp passes green with the new test (no existing tests regressed).

Test Plan

  • New test passes: cargo test -p laravel-lsp folio_route_usages_are_returned_by_symbol_index.
  • Full unit suite green: 1724 + 261 tests pass, 0 failures.
  • cargo fmt --check and cargo clippy --tests clean.
  • Note: 8 tests/integration_tests.rs cases fail in a fresh clone (missing gitignored .env / test-project fixtures) — pre-existing, confirmed identical on the untouched base commit; unrelated to this change.

Fixes #97

Adds an end-to-end assertion that a route('...') call-site for a
Folio-injected route name is returned by the shared SymbolIndex,
closing AC #4's explicit test gap. The route name is anchored through
the real Folio pipeline (inject_folio_routes + folio_name_for_file)
rather than hard-coded, and the call-site ParsedPatternsData +
SymbolIndex are built directly — no Backend, SalsaActor, or tokio
runtime, matching the integration suite's no-async-harness convention.

Also asserts an unrelated route name shares no bucket (no
cross-contamination between Folio and conventional route names).

Fixes #97
@mikebronner
mikebronner marked this pull request as ready for review June 14, 2026 19:09

@mr-sherlock-holmes mr-sherlock-holmes 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.

✅ Approved

Review Summary

  • Reviewed the test-only PR for #97 (+71/−0, one new unit test in laravel-lsp/src/folio_discovery/tests.rs). This closes the find-references usages-leg coverage gap (AC #4) that round-2/3 review of #57 (PR #91) deferred into #97.
  • All four acceptance criteria met — verified leg by leg, not on faith:
    • AC #1 ✅ — folio_route_usages_are_returned_by_symbol_index builds a ParsedPatternsData with a route_refs call-site entry, feeds it via index.insert_file(&call_site, &patterns) (tests.rs:499), and asserts find(Route("users.show")) returns exactly that location — file_path, line == 17, column == 23 (tests.rs:504-507).
    • AC #2 ✅ — find(Route("other.route")) asserted empty (tests.rs:511-516), a genuine negative control.
    • AC #3 ✅ — no Backend, SalsaActor, or tokio runtime; those words appear only in the doc comment. Construction is RouteIndex::new() / ParsedPatternsData::default() / SymbolIndex::default().
    • AC #4 ✅ — CI green (LSP test/fmt/clippy, wasm check, CodeQL all pass); API signatures all match the tree.
  • The test is honest, not vacuous. SymbolIndex::insert_file keys refs under (SymbolKind::Route, name) and find is a real HashMap lookup (symbol_index.rs:120-127, :315-321) — not an echo of the input. The non-tautology pivot is assert_eq!(route_name, "users.show") (tests.rs:484): the name is recovered through the real Folio pipeline (inject_folio_routes → folio_name_for_file), and that checkpoint fails if the pipeline ever produces the wrong name. The file/line/column assertions are meaningful guards against mis-wiring.
  • mergeable: MERGEABLE; the BLOCKED merge state is just this review gate.

What's Good

  • Anchoring the expected route name through the real pipeline rather than hard-coding it is the right call — it makes the round-trip assertion mean something. 👍
  • Clean negative control (other.route → empty) rules out bucket cross-contamination / fuzzy matching.
  • Respects the suite's no-async-harness convention exactly as the AC required — synthetic in-memory PathBuf call-site is never read from disk, real FS access is TempDir-scoped, no new deps, no unsafe.

📋 Non-blocking follow-ups

  • None.

Accepted limitation (not a follow-up): this test covers the component round-trip (Folio name → SymbolIndex insert/find), not the async-actor find-references handler that wires them together — a handler bug passing the wrong name (e.g. uri vs name) wouldn't be caught here. That's a deliberate, documented deferral: the integration suite intentionally avoids the Backend/SalsaActor/tokio harness ("not economical to fixture"), and this PR's AC explicitly required avoiding it. Tracking it as a new issue would just recreate the loop that produced #97, so I'm recording it here rather than spinning one out.

Ready for @mikebronner to merge.

@mikebronner
mikebronner merged commit d8b6f05 into main Jun 14, 2026
5 checks passed
@mikebronner
mikebronner deleted the chore/97-test-integration-coverage-for-folio-route-find-ref branch June 14, 2026 20:13
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.

test: integration coverage for Folio route find-references usages leg

1 participant