Skip to content

aft_inspect: rust-analyzer diagnostics reported as errors while cargo is clean #189

Description

@iceteaSA

aft_inspect reports hundreds of Rust errors on a tree that cargo check compiles without complaint.

Hit this on this repo an hour ago, right after syncing 23 commits:

aft_inspect(sections: "diagnostics", scope: "crates/aft/src")
  → diagnostics: 1104 errors, 259 warnings, 0 info, 123 hints
    (incomplete — servers: none reported)

  crates/aft/src/ast_grep_hints.rs:343:1   error expected bool, found ()
  crates/aft/src/ast_grep_lang.rs:151:33   error expected &'static [&'static str], found &[&'static str; 3]
  crates/aft/src/bash_background/output.rs:117:49  error cannot index into a value of type `&str`
  …

cargo check --bin aft
  → Finished `dev` profile in 0.13s

cannot index into a value of type &str on ordinary indexing, and expected bool, found () on code that compiles, are not real. The status bar sat at E17 off the back of it.

Note servers: none reported in that output — rust-analyzer hadn't finished initializing. A second deployment reports the same symptom with a different trigger: files using tracing:: macros produce error storms while cargo, clippy, and nextest are all green, which fits proc-macro expansion being unavailable.

Both roads lead to the same place: rust-analyzer answers before it can answer correctly, and aft_inspect presents that as errors with no signal that the analyzer wasn't ready.

The practical damage is calibration. An agent that sees E1104 against a clean cargo check learns to ignore aft_inspect on Rust, and then misses the run where the errors are real.

Suggested shape

Any of these would help, roughly in order of preference:

  • Don't count diagnostics toward E/W when the server set is incomplete or reports nothing — surface them as pending instead. The response already knows this; (incomplete — servers: none reported) is right there in the output.
  • Mark diagnostics from a not-yet-ready analyzer as provisional in the detail lines.
  • Failing either, a line in the Rust docs that the compiler is authoritative and aft_inspect diagnostics are a fast approximation.

The tool's own guidance already says its diagnostics are "a fast checkpoint, not the authority" — this is asking the output to reflect that when the analyzer is demonstrably not in a position to judge.

Happy to write the PR if you have a preference among those. The first seems most in keeping with the honest-reporting convention in protocol.rs: the incomplete-server state is already tracked, it just isn't gating the error count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions