Skip to content

ci(clippy): lint the anvil-e2e-gated targets and fix their violations - #1569

Merged
thiras merged 3 commits into
mainfrom
fix/1551-clippy-anvil-e2e
Aug 1, 2026
Merged

thiras merged 3 commits into
mainfrom
fix/1551-clippy-anvil-e2e

Conversation

@yigitdot

@yigitdot yigitdot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

CI's clippy job runs cargo clippy --workspace --all-targets -- -D warnings with no feature flags (.github/workflows/ci.yml:63), so every target behind an off-by-default feature is invisible to it. For anvil-e2e that is all 15 crates/e2e/tests/* journeys plus the two gated decdn-node tests: they compile to nothing under that command, and the two jobs that DO build them (anvil-e2e-settlement, anvil-e2e-journeys) only run cargo nextest, which never lints. Those targets sat outside the lint wall every other target obeys, and had drifted into failing it.

Before

$ cargo clippy -p decdn-e2e -p decdn-node --all-targets --features anvil-e2e -- -D warnings
crates/e2e/tests/slash_appeal.rs:235:9: binding's name is too similar to existing binding
crates/e2e/tests/slash_appeal.rs:71:10: the function has a cognitive complexity of (46/25)
crates/e2e/tests/slash_appeal.rs:71:1: this function has too many lines (135/100)
crates/e2e/tests/g_origin_01_publish.rs:129:10: the function has a cognitive complexity of (27/25)
crates/e2e/tests/g_origin_01_publish.rs:129:1: this function has too many lines (120/100)
crates/e2e/tests/cli_fetch_topup.rs:744:5: adding items after statements is confusing
error: could not compile `decdn-e2e` (test ...) due to 6 previous errors

(The issue cited three; running the command surfaced six.)

Fix

Close the gap — for every gated target, not just anvil-e2e. One new step on the existing clippy job:

- run: cargo clippy --workspace --all-targets --all-features -- -D warnings

The first cut of this PR named the two packages explicitly (-p decdn-e2e -p decdn-node --features anvil-e2e). Review pointed out that this is a second hand-maintained inventory of exactly the shape that let anvil_bringup_shutdown_e2e rot for three days without a red build, and that it leaves decdn-node/otlp in the hole anvil-e2e was in — worse, in fact: otlp appears in zero workflow files, so init_otlp_tracer and the #[cfg] / #[cfg(not)] branch pair in crates/node/src/commands/mod.rs are neither built nor linted by any job. --all-features subsumes the pair, is self-maintaining as crates gain gated targets, and also reaches decdn-protocol/public-api-test and decdn-incentive/test-util. The cost is named in the comment: opentelemetry/tonic now land in this job's shared-key: clippy cache.

It runs on the clippy job rather than the anvil jobs so it shares that job's warm cache and stays off the anvil jobs' hour-scale timeouts. The preceding --workspace run and the two -p decdn-incentive --no-default-features steps stay — they check the opposite direction (default-feature and feature-split configs) and --all-features cannot replace them.

Clear the violations.

Site Lint Resolution
cli_fetch_topup.rs:744 items_after_statements Hoisted to module scope, then replaced outright by use decdn_protocol::MB_BYTES — the public constant next_voucher actually divides by, rather than a hand-copied 1024 * 1024. The second ceil_cost closure that still inlined the literal now uses it too
slash_appeal.rs:235 similar_names Renamed node_a_id/node_b_id → a_node_id/b_node_id, matching the file's existing a_provider/b_provider convention
slash_appeal.rs run() cognitive_complexity, too_many_lines Scoped #[allow(..., reason = ...)]
g_origin_01_publish.rs run_transfer() cognitive_complexity, too_many_lines Scoped #[allow(..., reason = ...)]

The two #[allow]s are deliberate rather than a restructure: both functions are strictly ordered on-chain journeys where every step consumes chain state the previous step wrote. Splitting them into helpers would move that state into an argument bundle threaded through each call — it would not shorten the journey, and reading it top-to-bottom against the contract call order is the point. Function-scoped rather than the file-level #![allow] its siblings use, so every OTHER function in those files stays under the lint.

Review also corrected the prose that justifies them, where it did not match the code:

  • slash_appeal.rs claimed top-to-bottom fidelity and then listed the three negative filings last. The non-operator CallerNotOperator filing runs BEFORE the CLI files the appeal, and must — once the appeal is granted the slash is resolved and that filing cannot be attempted at all.
  • g_origin_01_publish.rs named one warp; there are two, and the first (timelock - WARP_MARGIN) is what makes the pre-timelock rejection meaningful rather than an assertion at t0.

Scope expansion — two review follow-ups in the same files (#1574, #1575).

  • The anvil-e2e-journeys comment derives timeout-minutes from a hand-listed sum of every journey's OVERALL_TIMEOUT. It claimed 20 tests across 17 files summing to 269m, by naming a cli_fetch_manifest and three G-NODE-08 tests that exist nowhere in the repo, counting cli_fetch_topup as one test when the file holds four, and omitting cli_bundle_pull_channel_id and origin_stream_while_store. Recomputed from the constants: 25 tests across 15 files summing to 298m, so the balanced 2-thread ceiling is ~149m, not ~135m — leaving the 160m bound only ~11m for the bin build, workspace compile and forge deploys the comment's own rule says it must also clear. Raised to 175m, restoring the ~25m of headroom the last bump targeted.
  • .pre-commit-config.yaml runs one clippy invocation; this PR takes CI to four. CONTRIBUTING now lists the three CI-only ones under Build and Test, and the Rust Toolchain section distinguishes identical lint rules (what the toolchain pin buys) from identical coverage (what a single-invocation hook does not have).

No test assertion or control flow changed anywhere in this PR.

After

$ cargo clippy --workspace --all-targets --all-features -- -D warnings   # exit 0
$ cargo clippy --workspace --all-targets -- -D warnings                  # exit 0
$ cargo fmt --all --check                                                # exit 0
$ cargo doc --workspace --no-deps --document-private-items               # exit 0

Closes #1551
Closes #1575
Refs #1574 — the numbers are corrected here; the issue is re-scoped to deriving the bound automatically so it cannot drift a fourth time.

Left as a follow-up: #1576 (narrowing the file-level too_many_lines allows across the other e2e journeys) — that surfaces an unknown number of over-threshold functions, so the diff cannot be bounded alongside this change.

CI's clippy job runs `cargo clippy --workspace --all-targets` without
`--features anvil-e2e`, so every target gated behind that feature —
`crates/e2e/tests/*` and the gated `decdn-node` tests — was never linted.
The two anvil jobs that do build them only run `cargo nextest`, which
never lints, so the gated targets sat outside the lint wall every other
target obeys and had drifted into failing it.

Add a lint step for the feature to the existing clippy job so it reuses
the warm `shared-key: clippy` cache, and clear the six violations it
reports:

- cli_fetch_topup.rs: hoist `MB_BYTES` to module scope, next to the other
  constants of its section (items_after_statements)
- slash_appeal.rs: rename `node_a_id`/`node_b_id` to `a_node_id`/`b_node_id`,
  matching the file's existing `a_provider`/`b_provider` convention (similar_names)
- slash_appeal.rs `run()` and g_origin_01_publish.rs `run_transfer()`: scoped
  `#[allow(cognitive_complexity, too_many_lines)]` with a reason. Both are
  strictly ordered on-chain journeys whose every step consumes chain state the
  previous step wrote, so decomposing them would thread a state bundle through
  helpers without shortening the journey or making it easier to follow.

No test assertion or control flow changes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@yigitdot, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 9bd40ac7-246f-4e65-80a6-cb66fa730d4f

📥 Commits

Reviewing files that changed from the base of the PR and between b2a9651 and 3851eda.

📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • CONTRIBUTING.md
  • crates/e2e/tests/cli_fetch_topup.rs
  • crates/e2e/tests/g_origin_01_publish.rs
  • crates/e2e/tests/slash_appeal.rs

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.80% (2597/2892 lines)
▲ +0.00pp vs base (89.80% → 89.80%)
Run: 30705531087

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.10% (was 80.11%, ▼ 0.01%) — 56136/70085 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
311ec08 80.09% ▼ 0.01%
a888dd4 80.09% ▼ 0.01%
3851eda (HEAD) 80.10% ▼ 0.01%

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes a CI linting gap by adding a clippy invocation that enables the anvil-e2e feature, ensuring e2e-gated tests and gated decdn-node targets are linted under -D warnings like the rest of the workspace.

Changes:

  • Add a clippy step in the main CI clippy job to lint decdn-e2e and decdn-node with --features anvil-e2e.
  • Fix/avoid clippy violations in e2e tests by hoisting a constant, renaming similar identifiers, and scoping #[allow] attributes with explicit reasons.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/e2e/tests/slash_appeal.rs Adds scoped clippy #[allow] with rationale for a sequential on-chain journey, and renames *_node_id bindings to avoid similar_names.
crates/e2e/tests/g_origin_01_publish.rs Adds scoped clippy #[allow] with rationale for the sequential transfer journey function.
crates/e2e/tests/cli_fetch_topup.rs Fixes items_after_statements by hoisting MB_BYTES to module scope with a clarifying doc comment.
.github/workflows/ci.yml Adds a dedicated clippy step to lint anvil-e2e-gated targets in the fast clippy job (shared cache key).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Review follow-up. The gated-target step landed as
`-p decdn-e2e -p decdn-node --all-targets --features anvil-e2e`, which is
correct for #1551 but is a second hand-maintained inventory of exactly the
shape the settlement job's own comment says rotted `anvil_bringup_shutdown_e2e`.
It also leaves `decdn-node/otlp` where `anvil-e2e` was, only worse: `otlp`
appears in zero workflow files, so `init_otlp_tracer` and the `#[cfg]` /
`#[cfg(not)]` branch pair in `crates/node/src/commands/mod.rs` are neither
built nor linted by any job.

`cargo clippy --workspace --all-targets --all-features -- -D warnings`
subsumes the pair, is self-maintaining as crates gain gated targets, and picks
up `otlp`, `decdn-protocol/public-api-test` and `decdn-incentive/test-util`.
The cost is named in the comment: opentelemetry/tonic now land in the clippy
job's `shared-key: clippy` cache. The plain `--workspace` and the two
`-p decdn-incentive --no-default-features` steps stay — they check the
opposite direction and `--all-features` cannot replace them.

Comment accuracy, same review:

- `slash_appeal.rs` claimed the run is readable top-to-bottom and then listed
  "the three negative filings" last. The non-operator `CallerNotOperator`
  filing runs BEFORE the CLI files the appeal, and must: once the appeal is
  granted the slash is resolved and that filing cannot be attempted. The block
  comment now names that constraint and defers the step list to the module doc
  that already owns it.
- `g_origin_01_publish.rs` named one warp; there are two, and the first
  (`timelock - WARP_MARGIN`) is what makes the pre-timelock rejection
  meaningful rather than an assertion at t0.
- `cli_fetch_topup.rs` re-spelled `1024 * 1024` as a local `MB_BYTES` whose doc
  tied it to `next_voucher`'s denominator — which is the public
  `decdn_protocol::MB_BYTES` that `next_voucher` actually divides by. Import it
  instead, and use it for the second `ceil_cost` closure that still inlined the
  literal.

No assertion or control flow changed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…y gate

Two follow-ups from the #1569 review, both downstream of this PR's own change.

**#1574 — the journeys timeout is derived from a wrong inventory.** The
`anvil-e2e-journeys` comment sums every gated journey's `OVERALL_TIMEOUT` to
size `timeout-minutes`. It claimed 20 tests across 17 files summing to 269m. It
got there by naming a `cli_fetch_manifest` and three `G-NODE-08` tests that
exist nowhere in the repo, counting `cli_fetch_topup` as one test when the file
holds four, and omitting `cli_bundle_pull_channel_id` and
`origin_stream_while_store` entirely.

Recomputed from the constants: 25 tests across 15 files summing to 298m, so the
balanced 2-thread ceiling is ~149m, not ~135m. That left the 160m bound only
~11m for the bin build, the workspace compile and the per-fixture forge deploys
— which the comment's own rule says the bound must also clear. Raised to 175m,
restoring the ~25m of headroom the last bump targeted.

**#1575 — the local hook lints one of the four configurations CI does.**
`.pre-commit-config.yaml` runs `--workspace --all-targets` only, so since this
PR the `--all-features` gate that reaches `anvil-e2e` / `otlp` /
`public-api-test` code is CI-only, as are the two `decdn-incentive`
feature-split checks. CONTRIBUTING now lists all three under Build and Test.
The Rust Toolchain section said the pin makes the hook run "the identical lint
set as CI" — true of the rule set, easy to read as identical coverage — so it
now distinguishes the two.

No workflow logic changed beyond the one timeout value.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@yigitdot
yigitdot requested review from alpergundogdu and thiras and removed request for alpergundogdu August 1, 2026 15:21
@thiras
thiras merged commit 9066d27 into main Aug 1, 2026
25 checks passed
@thiras
thiras deleted the fix/1551-clippy-anvil-e2e branch August 1, 2026 21:13
alpergundogdu added a commit that referenced this pull request Aug 3, 2026
…1563, #1576, #1579) (#1581)

* docs: strike the never-implemented origin_range_pull_enabled knob (#1555)

The knob only ever existed in ADR 037 and one stale doc comment; range
pull-through is ungated in code and the whole-blob fallback already makes
every attempt correct, so the toggle bought nothing. Remove the ADR
Parameters row, the "MAY disable" sentence, and the dead clause in the
cache engine's `Unsupported` doc.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(adr): stop linking canonical ADRs into _history; widen link-gate (#1559)

Canonical ADRs no longer reference the _history archive (it stays on disk
for audit): delink the retired-ADR mentions in 026/028/architecture to
inline-code names, drop the "Body archived verbatim" clauses, and add a
check-no-history-links guard so they cannot come back.

Widen check-anchor-targets to docs/ + root markdown (runbook, CONTRIBUTING,
CLAUDE, CHANGELOG, README) by resolving each link relative to its own
file's directory, and widen the CI adr changes filter to match.

Also drop the changelog-voice amendment note atop ADR 026 — the body
already carries the final 10% POL / 19% App Incentives / 15% combined
numbers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(adr): correct residual propose/ratify origin-assignment language (#1558)

#1491 replaced per-assignment DAO ratification with one-time publisher
vetting + instant assigns, but the glossary Publisher entry and ADR 019's
authorized-origins bullet still described the old model. Align both with
the vetted-publisher-seats-directly model already stated elsewhere in the
same files.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(adr): sync BuybackBurner docs with the three-layer venue-neutral refactor (#1579)

The docs still described BuybackBurner as one flat contract. Add a
"Declared on" column to the ADR 003 member table and mark setVault
Balancer-only; document the Permit2 approvals footgun in the L2 deployment
appendix (with the canonical Permit2 address); and drop references to a
nonexistent IBuybackBurner interface across ADR 018 and a stale contract
comment — FeeRouter holds buybackBurner as a plain address and never calls
a typed method on it, so no interface is warranted.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor: delete dead public surface and stale lint suppressions (#1563)

Sweep zero-caller public items and out-of-date `#[allow]`s left behind by
landed work:

- protocol: delete `StreamRequest::requested_len()` (no callers; serving
  sites derive the `byte_len == 0` sentinel inline).
- gossip: drop `GossipService::spawn`'s `_endpoint` param and its
  `needless_pass_by_value` allow; the caller no longer clones an endpoint
  for nothing.
- node/admin: remove the never-read `AdminState::signer` field, its
  `dead_code` allow, and its construction sites (handlers use
  `voucher_signer`).
- node/handlers: drop the stale `dead_code` allow + comment on
  `ProgressiveSource::LocalOutboard`; it is constructed in the production
  serve path (`window.rs`) since #1528.
- common/config: remove the blanket `#![allow(dead_code)]` in
  `resolved.rs`; the fields are `pub` and genuinely read, so none is
  actually dead.
- cache: delete the `CacheEngine::stats()` zeros-stub and its `CacheStats`
  type (no callers; intended gossip consumer never materialized).
- node: collapse `probe_client` into the identical
  `decdn_client_pull::probe::probe_once` (re-exported as
  `client_requester`); delete the duplicate module.
- common/cli: `--publisher-registry-address` is validate-only on the
  daemon; document it as such (dropping it cascades into the resolver,
  `ResolvedConfig`, `config validate`, and ~60 test literals).
- gossip: verified `RESUBSCRIBE_FAILED_LABEL` is incremented on the
  resubscribe-failure path; left as-is.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* test(e2e): scope long-journey lint allows to the functions that need them (#1576)

`clippy::too_many_lines` / `clippy::cognitive_complexity` were suppressed
file-wide alongside the standard test allows. Narrow them to
function-scoped `#[allow(..., reason = "...")]` on only the long journey
functions, matching the #1569 idiom in `slash_appeal.rs` / `g_origin_01`.
The standard test allows (`unwrap_used`, `expect_used`, `panic`,
`indexing_slicing`, `duration_suboptimal_units`) stay file-level.

Narrowing surfaced functions that had quietly grown past the threshold
under the file-wide blanket:

- cli_fetch_topup.rs: `run_multi_interval_topup` (144) and
  `run_two_topup_fetch` (162), not just `run`.
- anvil_bringup_shutdown_e2e.rs: `build_config` (101, a flat
  resolved-config struct literal) alongside the drain journey test.

Each now carries its own reason. `coop_close_watermark_reconcile.rs`'s
`run` is under the threshold, so it needs no scoped allow at all.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants