Under heavy parallel cargo load, after a file is fixed and saved, rust-analyzer sometimes runs a flycheck that publishes the old error with the new document version. The lens then reports an error that no longer exists.
Observed: tests::rust_analyzer_turn_end fails ~1 in 4 runs while cargo test --workspace runs concurrently; passes reliably alone. Debug trace: synced v=2, flycheck begin, publish v=2 n=1 (stale E0308), flycheck end.
Tried (not enough): wait for flycheck started after our save; wait for a publish after flycheck end (up to 10s); 15s grace for flycheck start; sleeping 1.1s before the fix write (mtime granularity).
Workaround: tests/all.sh runs that test alone.
Ideas: re-run diagnostics once when an error persists across a content change on the same line; compare the reported range text with current file content; trigger rust-analyzer/runFlycheck explicitly after save.
Done when: rust_analyzer_turn_end passes 20/20 with concurrent workspace tests and the all.sh special case is removed.
Under heavy parallel cargo load, after a file is fixed and saved, rust-analyzer sometimes runs a flycheck that publishes the *old* error with the *new* document version. The lens then reports an error that no longer exists.
Observed: `tests::rust_analyzer_turn_end` fails ~1 in 4 runs while `cargo test --workspace` runs concurrently; passes reliably alone. Debug trace: `synced v=2`, flycheck begin, `publish v=2 n=1` (stale E0308), flycheck end.
Tried (not enough): wait for flycheck started after our save; wait for a publish after flycheck end (up to 10s); 15s grace for flycheck start; sleeping 1.1s before the fix write (mtime granularity).
Workaround: `tests/all.sh` runs that test alone.
Ideas: re-run diagnostics once when an error persists across a content change on the same line; compare the reported range text with current file content; trigger `rust-analyzer/runFlycheck` explicitly after save.
Done when: `rust_analyzer_turn_end` passes 20/20 with concurrent workspace tests and the all.sh special case is removed.
Context: #58
Root cause, from an LSP trace of a failing run. The stale error is rust-analyzer's native diagnostic (source rust-analyzer, E0308), not cargo's. After the fix is written and sent as v2 (didChange + didSave), rust-analyzer publishes v=2 with the old E0308 error; its native analysis was computed from the previous content. The following flycheck ends without republishing, so the stale native diagnostic stays.
Tried, all still failing under concurrent cargo test --workspace load:
Wait for a publish after flycheck end (up to 10s): about 1 in 4 fail.
On errors after an edit, send didSave again and wait for that flycheck: 1 in 8 fail (the flycheck finishes without a new publish).
On errors after an edit, resend the full content as a new version v3 (didChange + didSave): 2 in 6 fail, and runs take over 100s.
Not yet tried:
Pull diagnostics (textDocument/diagnostic, if the server supports it) for the native part, instead of relying on push.
Filter native rust-analyzer diagnostics once a newer flycheck has run, and trust rustc results.
Compare the flagged range's text with current file content, and drop the diagnostic if that range changed.
Workaround still in place: tests/all.sh runs rust_analyzer_turn_end alone (even alone it flakes rarely on a loaded box).
Investigation (not fixed):
**Root cause, from an LSP trace of a failing run.** The stale error is rust-analyzer's *native* diagnostic (source `rust-analyzer`, E0308), not cargo's. After the fix is written and sent as v2 (didChange + didSave), rust-analyzer publishes `v=2` with the old E0308 error; its native analysis was computed from the previous content. The following flycheck ends without republishing, so the stale native diagnostic stays.
```
publish v=2 rust-analyzer E0308 expected u32, found &'static str <- stale, content already fixed
progress flycheck report "t (lib)" / end
```
**Tried, all still failing under concurrent `cargo test --workspace` load:**
1. Wait for a publish after flycheck end (up to 10s): about 1 in 4 fail.
2. On errors after an edit, send didSave again and wait for that flycheck: 1 in 8 fail (the flycheck finishes without a new publish).
3. On errors after an edit, resend the full content as a new version v3 (didChange + didSave): 2 in 6 fail, and runs take over 100s.
**Not yet tried:**
- Pull diagnostics (`textDocument/diagnostic`, if the server supports it) for the native part, instead of relying on push.
- Filter native `rust-analyzer` diagnostics once a newer flycheck has run, and trust `rustc` results.
- Compare the flagged range's text with current file content, and drop the diagnostic if that range changed.
Workaround still in place: `tests/all.sh` runs `rust_analyzer_turn_end` alone (even alone it flakes rarely on a loaded box).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Under heavy parallel cargo load, after a file is fixed and saved, rust-analyzer sometimes runs a flycheck that publishes the old error with the new document version. The lens then reports an error that no longer exists.
Observed:
tests::rust_analyzer_turn_endfails ~1 in 4 runs whilecargo test --workspaceruns concurrently; passes reliably alone. Debug trace:synced v=2, flycheck begin,publish v=2 n=1(stale E0308), flycheck end.Tried (not enough): wait for flycheck started after our save; wait for a publish after flycheck end (up to 10s); 15s grace for flycheck start; sleeping 1.1s before the fix write (mtime granularity).
Workaround:
tests/all.shruns that test alone.Ideas: re-run diagnostics once when an error persists across a content change on the same line; compare the reported range text with current file content; trigger
rust-analyzer/runFlycheckexplicitly after save.Done when:
rust_analyzer_turn_endpasses 20/20 with concurrent workspace tests and the all.sh special case is removed.Context: #58
Investigation (not fixed):
Root cause, from an LSP trace of a failing run. The stale error is rust-analyzer's native diagnostic (source
rust-analyzer, E0308), not cargo's. After the fix is written and sent as v2 (didChange + didSave), rust-analyzer publishesv=2with the old E0308 error; its native analysis was computed from the previous content. The following flycheck ends without republishing, so the stale native diagnostic stays.Tried, all still failing under concurrent
cargo test --workspaceload:Not yet tried:
textDocument/diagnostic, if the server supports it) for the native part, instead of relying on push.rust-analyzerdiagnostics once a newer flycheck has run, and trustrustcresults.Workaround still in place:
tests/all.shrunsrust_analyzer_turn_endalone (even alone it flakes rarely on a loaded box).