Skip to content

Nothing installs a tracing subscriber, so every engine warning is discarded #85

Description

@Muawiya-contact

The engine reports three things through tracing::warn!, and nobody ever
sees any of them:

// rules.rs — a pattern that is not a valid glob is dropped, not fatal
Err(e) => tracing::warn!(rule = %rule.id, pattern = %pattern,
    "ignoring rule pattern that is not a valid glob: {e}"),
// rules.rs — the whole rule then matches nothing
tracing::warn!(rule = %rule.id, "rule matches nothing: {e}");
// actions.rs — a torn manifest line is skipped so the rest still list
tracing::warn!(manifest = %path.display(), "skipping unreadable manifest line: {e}");

Neither frontend installs a subscriber, so tracing drops every event on
the floor. grep -rn "tracing_subscriber" . finds nothing in the
workspace; tracing-subscriber is declared in the root
[workspace.dependencies] and no crate depends on it.

The rules cases are the ones that matter. docs/RULES.md says plainly
that a typo makes a rule match nothing — the only signal that
happened is a warning that currently goes nowhere. That becomes worse the
moment #68 lands and rules files come from outside the binary.

Small, self-contained fix: take the workspace tracing-subscriber
dependency in diskern-cli and initialise it at the top of main, e.g.

tracing_subscriber::fmt()
    .with_env_filter(EnvFilter::try_from_default_env()
        .unwrap_or_else(|_| EnvFilter::new("warn")))
    .with_writer(std::io::stderr)
    .init();

Warnings on stderr by default, RUST_LOG=debug for more, and stdout
stays clean so --json is still pipeable. The Tauri app wants the same
call in run(), where it lands in the terminal tauri dev was started
from.

crates/diskern-core/src/rules.rs:121 · crates/diskern-core/src/actions.rs:204 · crates/diskern-cli/src/main.rs:186

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

    bugSomething isn't workingclidiskern-cli: the terminal frontendenginediskern-core: scanner, rules, risk, graph, reportgood first issueGood for newcomerslevel: beginnerSmall and well-scoped; no deep context neededpriority: lowNice to have

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions