Skip to content

stella-cli: dead DiagnosticInvocation/DiagnosticRunner imports warn on every shipping-binary build, and no gate configuration can see them #2053

Description

@macanderson

Problem

cargo build -p stella-cli --bin stella — the build make gate runs to produce the
binary for scripts/test-self-driving.sh — emits:

warning: unused imports: `DiagnosticInvocation` and `DiagnosticRunner`
  --> crates/stella-cli/src/agent/tools.rs:11:46
   |
11 |     ArtifactIdentity, ArtifactKind, CmdKind, DiagnosticInvocation, DiagnosticRunner,

Both names are dead in the non-test build:

  • DiagnosticRunner (the trait) is imported but never implemented here —
    rg 'impl .*for GitDiagnosticRunner' crates/stella-cli/src/agent/tools.rs finds
    nothing. GitDiagnosticRunner::run_diagnostic is an inherent method, so the trait
    needs no import for the calls to resolve.
  • DiagnosticInvocation is named only inside #[cfg(test)] code (tools.rs:1096,
    tools.rs:1410), and that test module already re-imports it for itself at
    tools.rs:1367.

Why no gate catches it

This is the shape of #2045: cargo clippy --all-targets compiles the test targets,
where cfg(test) code does use DiagnosticInvocation, so the import is live in
every configuration clippy builds and clippy stays green. Only a build that excludes
tests — the shipping binary — sees it. The gate runs that build, but as a plain
cargo build without -D warnings, so the warning scrolls past and nothing fails.

Two things are worth deciding separately:

  1. the dead import itself (trivial), and
  2. whether the gate should compile the shipping binary under -D warnings, which
    is the only configuration that can catch this class at all.

Files

  • crates/stella-cli/src/agent/tools.rs:11 — the import
  • crates/stella-cli/src/agent/tools.rs:1367 — the test module's own import
  • Makefile — the self-driving-test step's cargo build -q -p stella-cli --bin stella

Repro

cargo build -p stella-cli --bin stella 2>&1 | rg -A 4 'unused imports'

Green (masks it):

cargo clippy -p stella-cli --all-targets -- -D warnings

Definition of done

  • cargo build -p stella-cli --bin stella is warning-free.
  • The gate fails if a future import goes dead the same way — e.g. the
    self-driving-test step's binary build carries RUSTFLAGS="-D warnings", or a
    dedicated step builds the shipping binary under it. Whichever is chosen, add a
    witness: revert the import removal and confirm the gate step goes red.
  • cargo clippy --workspace --all-targets -- -D warnings still passes.

Constraints

  • crates/stella-cli/src/agent/tools.rs is not itself a god file, but
    crates/stella-cli/src/agent.rs and src/agent/tests.rs are — keep any new code
    out of those (AGENTS.md § God files).
  • Found while working in stella-observatory; the branch that noticed it touches no
    stella-cli file, so this is inherited from main (6bc6a072), not introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Polish — worth doing, not urgenttriageUntyped request — convert by adding bug / feature / epic

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions