test(mention): fail loudly when background search never settles - #373
Merged
Merged
Conversation
- Replace the fixed 200-iteration poll in `run_search` with a deadline so the wait scales past the previous 1s budget - Assert on timeout instead of returning silently, reporting index status, search status and pending match sequence - Drain events before sleeping so an already-settled search returns without an extra poll interval - Extract `SEARCH_SETTLE_TIMEOUT` and `SEARCH_SETTLE_POLL_INTERVAL` to document that the budget targets the slowest CI runner
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
run_search, the test helper that waits for the background file index insrc/app/mention.rs, polled a fixed 200 × 5 ms (1 s) and then returned silently when the budget ran out. Callers then asserted against whatever half-scanned state existed.index_status,search_statusandpending_match_sequenceTest-only change; no production code is touched.
Why
The Nightly run 34098364599 failed on both attempt 1 and attempt 2, only in
Test (macos-latest); Ubuntu, Windows and every build and smoke job passed.completed_search_includes_shallow_and_deep_matches(search_status != Ready) andquery_change_refilters_from_cache_without_restarting_walk(left: 2, right: 1)src/app/mention.rsandsrc/app/file_index.rswere both last changed by dd12688 (2026-08-23), and the Aug 24 and Aug 31 nightlies passed on that same code, so this is not a regression. The shared cause is the silent timeout: on a loaded macOS runner the walk does not settle inside 1 s, and the tests then assert against a partial index. The current assertions cannot distinguish "the index never settled" from "the matcher settled and still returned the wrong candidates", which is why the failure reads as a confusing2 vs 1mismatch.This does not by itself prove the extra candidate is only a test artifact.
apply_match_resultreplacesmention.candidateswholesale andfor_each_candidateskips entries whosestrip_prefix(root)fails, so neither duplicate accumulation nor macOS/var→/private/varpath pollution explains it; the remaining suspect is a stale nucleo snapshot aroundrebuild_stream(false)(src/app/file_index.rs:510). After this change, a recurrence reports which of the two it was.Closes #
Validation
cargo fmt --all -- --checkandcargo test --lib app::mention::pass locally on Windows. That is weak evidence — the failure is a macOS-only timing flake and did not reproduce locally before the change either. CI is the real check.Notes
cargo clippy --all-targets --all-features -- -D warningswas not run locally; left to CI.