Skip to content

CI never compiles the ai feature, and nothing tests it #87

Description

@Muawiya-contact

diskern-core has an optional ai feature, and no CI job ever turns it
on:

- run: cargo clippy -p diskern-core -p diskern-cli --all-targets -- -D warnings
- run: cargo test -p diskern-core -p diskern-cli

Both use default features, and ai is not one (default = []). So
src/ai.rs — the AiProvider trait, AiError, TemplateNarrator — is
never compiled by CI on any platform, and #[cfg(feature = "ai")] pub mod ai;
means a change to Finding that breaks it merges green.

It also has no tests of its own. cargo test -p diskern-core --features ai
runs the same 54 tests as without it; the module contributes none.

It compiles today — cargo clippy -p diskern-core --features ai --all-targets -- -D warnings
is clean as of this issue, which is what makes this cheap to close before
it stops being true.

Two parts, one PR:

  • add --all-features to the clippy and test steps in ci.yml, or a
    dedicated cargo clippy -p diskern-core --features ai step;
  • give TemplateNarrator a test. It is a pure function from &[Finding]
    to a String, so a test builds two or three findings and asserts the
    count, the total and that the reasons it quotes are ones the findings
    actually carry — the "narrates facts, never decides" contract the module
    header states and nothing currently checks.

Whoever writes that test will notice the narrator reports every total in
GB (total as f64 / 1e9), so a real scan's worth of caches narrates as
"0.0 GB reclaimable". Fixing that belongs in the same PR.

.github/workflows/ci.yml:54 · .github/workflows/ci.yml:76 · crates/diskern-core/src/ai.rs:36

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI workflows and release automationgood first issueGood for newcomerslevel: beginnerSmall and well-scoped; no deep context neededpriority: lowNice to havetestingTest coverage and test tooling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions