test: handler-level goto-def coverage for the alternate Flux registration forms - #189
Merged
mikebronner merged 2 commits intoJun 16, 2026
Conversation
…andler level Add two `#[tokio::test]`s to `flux_goto_def_handler.rs` covering the resolution paths #108's tests left untested at the handler level: - the `anonymous_component_paths` registration form (`Blade::anonymousComponentPath`), where the registered directory IS the components dir — distinct from the `anonymous_component_namespaces` form the existing tests drive; and - the directory-self `{base}/{last}.blade.php` candidate, the third file shape `push_component_file_candidates` emits. Extract `backend_with_config` so the path-form test can prime a distinct config without duplicating the `LspService` harness; `flux_backend` now delegates to it (existing call sites unchanged). Add a `flux_paths_config` helper mirroring the `anonymous_component_paths` arm in `flux_component_hover.rs`. Both drive the real `create_component_location_from_salsa` → `resolve_component_existing_file` → `LocationLink` chain. Fixes #183
mikebronner
marked this pull request as ready for review
June 16, 2026 13:14
There was a problem hiding this comment.
✅ Approved
Review Summary
- Test-only PR: two new
#[tokio::test]s influx_goto_def_handler.rsextending handler-level goto-def coverage to the two resolution paths #183 called out, plus a cleanflux_backend→backend_with_configextraction and a newflux_paths_confighelper. - AC #1 (anonymous-component-path form) — met.
flux_tag_resolves_via_anonymous_component_pathprimesanonymous_component_paths: {"flux" → abs_dir}, writes{flux_dir}/button.blade.php, callscreate_component_location_from_salsa("flux:button"), and pins the exact target. The registered dir (packages/flux/resources/views) sits outside every Flux hardcoded fallback (resources/views/flux,vendor/livewire/flux…), so only the anonymous-component-path branch can produce the candidate — it can't pass by coincidence. - AC #2 (self-named candidate) — met.
flux_tag_resolves_via_self_named_candidatewrites onlyresources/views/components/flux/button/button.blade.php— no direct file, noindex.blade.php— so a pass proves the third candidate ({base}/{last}.blade.php,salsa_impl.rs:3185) resolved, not candidate 1 or 2. - AC #3 (real handler chain) — met. Both tests drive
create_component_location_from_salsa → resolve_component_existing_file → LocationLinkthrough the sameLspService::newharness as the four existing tests; no handler is bypassed. - AC #4 (CI green, no regression) — met. All five checks pass (LSP test/fmt/clippy, wasm check, CodeQL ×2). Tests use disjoint
TempDirs with no shared state. - Verified independently: the refactor preserves the existing four tests' behaviour exactly; assertions pin the full absolute path; deleting either targeted production branch would fail the corresponding test. Honest coverage, not trivia.
📋 Non-blocking follow-ups
- None.
Ready for @mikebronner to merge.
mikebronner
deleted the
chore/183-test-handler-level-goto-def-coverage-for-the-alter
branch
June 16, 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 #183 — extends the handler-level goto-def coverage #108 established to the two other Flux resolution paths the same handler walks but no handler-level test exercised.
Changes
flux_tag_resolves_via_anonymous_component_path— drives theanonymous_component_pathsregistration form (Blade::anonymousComponentPath), where the registered directory IS the components dir, so<flux:button>resolves to{flux_dir}/button.blade.phpwith nocomponents/segment. The registered dir sits outside Flux's conventional fallback locations, so only the anonymous-component-path branch can produce the candidate.flux_tag_resolves_via_self_named_candidate— drives the directory-self{base}/{last}.blade.phpcandidate (the third file shapepush_component_file_candidatesemits,salsa_impl.rs), with neither the direct file nor theindex.blade.phppresent.flux_paths_confighelper mirroring theanonymous_component_pathsarm of theflux_confighelper influx_component_hover.rs.backend_with_configso the path-form test can prime a distinct config without duplicating theLspServiceharness;flux_backendnow delegates to it (existing call sites unchanged).Acceptance Criteria
#[tokio::test]primesLaravelConfigDatawithanonymous_component_paths: {"flux" → abs_dir}(mirroring theflux_configpattern influx_component_hover.rs), writes{abs_dir}/button.blade.php, callscreate_component_location_from_salsawithflux:button, and asserts theGotoDefinitionResponse::Linktarget URI points to that file#[tokio::test]primes config withanonymous_component_namespaces: {"flux" → "components/flux"}, writes onlyresources/views/components/flux/button/button.blade.php(no directbutton.blade.phporindex.blade.php), calls the handler withflux:button, and asserts theLocationLinktarget is the self-named file — the third candidate ({base}/{last}.blade.php,salsa_impl.rs)create_component_location_from_salsa→resolve_component_existing_file→LocationLinkthrough thetower_lsp::LspServiceharness (same approach as the four existing tests)cargo test --all-featurespasses with both new tests included; no existing tests regressTest Plan
cargo test --all-features flux_goto_def_handler— all 6 tests pass (4 existing + 2 new)cargo fmt --checkclean;cargo clippy --all-features --testsno new warningscargo test --all-featuressuite: all lib/main unit tests pass. The only failing integration tests locally are fixture/environment-dependent (gitignoredtest-project/.env+composer update-installed Fortify package) — CI bootstraps both (ci.yml), so they pass on CI. No regression from this change (diff is one test file).Fixes #183