Skip to content

dev: pre-commit clippy hook no longer matches CI's clippy coverage #1575

Closed

Description

@yigitdot

.pre-commit-config.yaml runs a single lint command:

cargo clippy --workspace --all-targets -- -D warnings

CI's clippy job now runs four invocations (.github/workflows/ci.yml): that one, two -p decdn-incentive --no-default-features feature-split checks, and — as of #1569 — cargo clippy --workspace --all-targets --all-features -- -D warnings, which is the only thing that lints the anvil-e2e / otlp / public-api-test gated targets.

So three of the four gates are CI-only: a contributor can pass every local hook and still get a red clippy job. That is a milder version of the drift #1551 was about — caught, but one push later than it needs to be.

Options:

  1. Add the --all-features invocation to the hook. Correct, but it drags opentelemetry/tonic into every contributor's pre-commit build.
  2. Leave the hook fast and document the extra commands in CONTRIBUTING.md § Common Commands (which currently shows only cargo build && cargo clippy), so "what CI will run" is discoverable without reading the workflow.

(2) is probably the right trade. Note also CONTRIBUTING.md § Rust Toolchain says the pin makes pre-commit's clippy run "the identical lint set as CI" — true of the rule set, easy to misread as identical coverage; worth a clarifying clause either way.

Found while reviewing #1569.

Activity

  1. added
    kind:docs
    prio:low
    on Aug 1, 2026
  2. github-actions commented on Aug 1, 2026

    @github-actions

    🎯 Triage report

    The pre-commit hook runs only cargo clippy --workspace --all-targets, while CI now runs four invocations — including --all-features (added in #1569) that covers anvil-e2e, otlp, and public-api-test gated targets. A contributor can pass all local hooks and still fail CI's clippy job. The reporter proposes two options and recommends documenting the extra commands in CONTRIBUTING.md § Common Commands rather than dragging heavy feature deps into the pre-commit build.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Documentation + optional hook update; no broken behaviour, no new feature
    Labels documentation, technical, low (already applied) Correct — purely a dev-experience and docs gap, low urgency
    Coding agent Suitable Requirements are explicit: update CONTRIBUTING.md § Common Commands to list all four CI clippy invocations, and add the clarifying clause to § Rust Toolchain. Optionally expand the hook. Both are well-scoped file edits with clear success criteria

    🔗 Similar issues

    💡 Notes and suggestions

    Root cause: #1569 added cargo clippy --workspace --all-targets --all-features -- -D warnings to CI after the pre-commit hook was written. The hook was never updated to match.

    Recommended fix (option 2 from the issue):

    1. In CONTRIBUTING.md § Common Commands, replace the single cargo build && cargo clippy line with all four invocations CI runs:
      cargo clippy --workspace --all-targets -- -D warnings
      cargo clippy -p decdn-incentive --no-default-features -- -D warnings
      # (any other feature-split invocation)
      cargo clippy --workspace --all-targets --all-features -- -D warnings
      
    2. In CONTRIBUTING.md § Rust Toolchain, add a clause clarifying: "The toolchain pin ensures the same lint rules as CI; to match CI's full coverage, run the additional invocations listed in § Common Commands."
    3. Optionally add a comment in .pre-commit-config.yaml pointing to the CONTRIBUTING section for the full set.

    Why not option 1 (add --all-features to the hook)? It pulls in opentelemetry/tonic/anvil deps on every git commit, significantly slowing local workflows. Option 2 is the right trade-off for a project at this stage.

    Sub-task checklist:

    • Update CONTRIBUTING.md § Common Commands — list all CI clippy invocations
    • Update CONTRIBUTING.md § Rust Toolchain — add clarifying clause about coverage vs rule-set
    • (Optional) Add comment in .pre-commit-config.yaml cross-referencing CONTRIBUTING

    Generated by Agentic Triage for #1575 · sonnet46 · 16.4 AIC · ⌖ 5.58 AIC · ⊞ 6K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. yigitdot commented on Aug 1, 2026

    @yigitdot
    ContributorAuthor

    Fixed in #1569 (commit 3851eda). CONTRIBUTING § Build and Test now lists all three CI-only clippy invocations, and § Rust Toolchain distinguishes identical lint rules (what the toolchain pin buys) from identical coverage (what the single-invocation hook does not have). Left the hook itself fast — option 2 from the issue.

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

Metadata

Metadata

Assignees

Labels

kind:docsprio:low

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions