Skip to content

crates/cli/tests/fixture_scans.rs tests exclusively via scan_directory, which dedupes — masking bugs in the CLI's real scan_directory_with_checks path #377

Description

@unrealtim-tech

Labels: testing, cli-crate
Crate: cli

Description
Every test in crates/cli/tests/fixture_scans.rs calls soroban_guard_analyzer::scan_directory (imported at line 1), which internally calls dedup_findings before returning. But issue #309 established that the actual CLI (crates/cli/src/main.rs) calls scan_directory_with_checks instead — which, per crates/analyzer/src/lib.rs, does not call dedup_findings at all.

This means the entire fixture test suite validates a code path real users never take, and is structurally incapable of catching CLI-path-specific bugs like duplicate findings (e.g. the AuthAfterStorageWriteCheck double-registration filed separately) — scan_directory's dedup step silently absorbs exactly that kind of defect before the test ever sees it. This is a different gap than the already-open #291 (which is about missing coverage for most checks); this is about the coverage that already exists testing the wrong underlying function.

Acceptance Criteria

  • Add at least one test in fixture_scans.rs (or a new integration test file) that goes through scan_directory_with_checks + default_checks_with_config(...), matching the CLI's real invocation, and assert it produces no duplicate (file, line, check_name) findings.
  • Consider whether assert_fixture_pair should be parameterized to run against both entry points.

Difficulty: intermediate

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions