← Back to Pull requests

fix(clippy): stop passing targets the aspect cannot lint #1010

Closed
unknown closed this pull request without merging on Sep 28, 2026 05:44 UTC
View on GitHub
unknown unknown commented on Sep 27, 2026 13:05 UTC
Author

Follow-up to the discussion in #879, this PR makes the lint failure loud along the lines @dzbarsky suggested there.

A Rust target that was not built with the rules_rust that rules_rs provides carries a CrateInfo this module cannot read. Today the aspect takes the no-op branch for it, writes an empty report and exit code 0. The end result is that clippy_test on it passes with clippy never having run.

Two changes:

  • The clippy aspect declares required_providers, so Bazel does not apply it to those targets at all. It has to be the any of the two [[CrateInfo], [TestCrateInfo]] (rust_static_library and rust_shared_library advertise only the test provider hence the second requirement).

  • With the aspect no longer applied, lint_test would fail on 'OutputGroupInfo' value with no field or method 'rules_lint_human'. It now says which test and which src have no report, and lists the reasons an aspect skips a target.
  • Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes, one line in the clippy.bzl docstring

  • Breaking change (forces users to change their own code or config): no for a working setup. A clippy_test that was passing without running clippy now fails analysis. A custom rule listed in rule_kinds that returns CrateInfo without declaring it in provides is no longer visited.

  • Suggested release notes appear below: yes

  • clippy: Rust targets not built with the rules_rust from rules_rs are skipped by the aspect, and a lint_test on one fails with a message naming the target, instead of passing with nothing linted.
  • Test plan

  • New //lint/test:lint_test_no_report_test, an analysis test with expect_failure. Against main's lint_test.bzl it fails with the old OutputGroupInfo error.

  • examples/rust: bazel test --@aspect_rules_lint//lint:fail_on_violation=false //... passes 16 of 16, so rust_binary, rust_library and rust_test are all still visited (the bad_* fixtures still report exit code 1).

  • Manual: the repro from #879 (Bazel 9.2.0, BCR rules_rust 0.74.0), with both modules overridden to this branch. //apps/rust_app:rust_app.lint passes on 2.9.0 + aspect_rules_lint_rust 0.0.3 and on main, and on this branch fails with:
  • Error in fail: @@//apps/rust_app:rust_app.lint: the lint aspect produced no report for @@//apps/rust_app:rust_app, so there is nothing to assert on.
    The aspect did not run on that target. Either its rule kind is not one the aspect visits, it is tagged "no-lint", or it does not advertise a provider the aspect requires (clippy: the target is built by a different rules_rust than the lint module loads).
    

    Diff: 338 lines (+253 / -85) across 4 files Reviewer: dzbarsky Review duration: 998m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 338 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1010"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%