Repository navigation
test(e2e): hoist poll/expect_revert helpers into decdn-e2e, make ensure_mined pub - #1387
Conversation
…re_mined pub Integration test targets are separate crates and cannot reach the `decdn-e2e` library's `pub(crate)` items, so each journey re-implemented the same polling and revert-assertion helpers. Consolidate them into the library: - Add `crates/e2e/src/poll.rs` with a single canonical `pub async fn poll` and re-export it as `decdn_e2e::poll`. Replace the three byte-identical local copies in `smoke.rs`, `slash_appeal.rs`, and `g_node_04_blacklist_compliance.rs` with the shared import. - Move `expect_revert` into the existing `crates/e2e/src/assert.rs` as `pub`; `g_origin_01_publish.rs` now imports it. (Rewritten to a `let...else` to satisfy the library's `-D warnings` clippy gate; behavior is unchanged.) - Promote `ensure_mined` from `pub(crate)` to `pub` so tests stop re-implementing it with a weaker, receipt-less signature. No behavior changes; signatures are identical apart from visibility. The crate is `publish = false`, so widening this surface costs nothing externally.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (7)
Note 🎁 Summarized by CodeRabbit FreeYour 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 |
Coverage reportTotal: 81.51% (was 81.55%, ▼ 0.04%) — 53777/65976 lines
History
|
altanoruc
left a comment
There was a problem hiding this comment.
Review — hoist e2e poll/expect_revert helpers into decdn-e2e
Overview
Pure test-infra refactor: three byte-identical poll copies collapse into crates/e2e/src/poll.rs (re-exported as decdn_e2e::poll), expect_revert moves into assert.rs as pub, and ensure_mined is promoted pub(crate) → pub. No behavior change, and the crate is publish = false, so the widened surface costs nothing externally. Net removal of duplicated code.
Correctness — verified ✅
The one failure mode a move like this can hide is an orphaned use that only surfaces in the anvil-e2e CI job — the local cargo clippy -p decdn-e2e --all-targets in the PR description doesn't enable that feature, so the gated tests/*.rs files aren't compiled by it. Checked each:
pollremovals (smoke.rs,slash_appeal.rs,g_node_04_blacklist_compliance.rs):std::time::Durationstays used at every call site (e.g.smoke.rs:99,129; the local fn only ever fully-qualifiedtokio::time::*), so no import is left dangling.expect_revertremoval (g_origin_01_publish.rs):use anyhow::Context;remains heavily used (.context(...)across lines 78–499), and all 5expect_revert::<_, …>()call sites are unchanged. Clean.- The new
pollmodule is private (mod poll;) with only the fn re-exported, souse decdn_e2e::poll;binds unambiguously to the function — no module/fn name clash.
Nice touches
- The
match→let…elserewrite in the movedexpect_revertis behavior-identical and correctly motivated:assert.rscompiles as part of the library, which runs under pedantic-D warnings(manual_let_else), whereas the old test-file home did not. Better to fix it in the move than leave a latent warning. - Collapsing the three drifted doc comments into one canonical version is the right call.
Minor / optional (non-blocking)
- The coverage-report dip is cosmetic.
assert.rs▼8.46% andpoll.rsnew-at-0% look like a regression, but these helpers are only exercised by theanvil-e2etests, which don't run in the coverage job — so they were already uncounted when they lived in the test files. Total moved −0.04%; no real coverage was lost. - Two more polling loops remain inline —
cli_fetch_manifest.rs:166andg_origin_04_default_open.rs:160hand-roll the same deadline loop (750ms / 500ms sleeps, noSome/Noneaccumulation). Different enough that leaving them out of scope is defensible; a follow-up could fold them intopollif you want one canonical helper. ensure_minedis nowpubwith no in-PR consumer (theg_gov_02_rate_bounds.rsadopter isn't onmain, per your scope note). Fine as enabling work — just noting the surface widens slightly ahead of use.
Verdict
Clean, well-scoped, and correctly reasoned. mergeable_state is clean; I found no correctness or convention issues. LGTM ✅
Generated by Claude Code
fix(e2e): drop duplicate expect_revert from a semantic merge conflict #1387 and #1367 each landed their own `expect_revert` in `crates/e2e/src/assert.rs` — textually disjoint, so git merged both and main stopped compiling (E0428, `decdn-e2e` lib), taking clippy, test, doctest, cargo doc, and anvil e2e down with it. Keep #1367's version: same signature and behaviour, but it shares the selector check with `expect_revert_anyhow` via `assert_revert_data` instead of inlining it. Callers of either copy are unaffected. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
What
The anvil-e2e integration tests each re-implemented the same helpers, because integration test targets are separate crates and cannot reach the
decdn-e2elibrary'spub(crate)items. This hoists the shared helpers into the library.poll— three byte-identical copies (smoke.rs,slash_appeal.rs,g_node_04_blacklist_compliance.rs, with already-drifted doc comments) collapse into a newcrates/e2e/src/poll.rs, exposed asdecdn_e2e::poll. One canonical doc comment.expect_revert— moved into the existingcrates/e2e/src/assert.rsaspub;g_origin_01_publish.rsnow imports it. Rewrittenmatch→let...elseso the library's-D warningsclippy gate is satisfied (behavior identical).ensure_mined(crates/e2e/src/lib.rs) — promotedpub(crate)→pubso tests stop re-implementing it with a weaker, receipt-less signature.No behavior changes; signatures are identical apart from visibility. The crate is
publish = false, so widening this surface costs nothing externally.Scope note
The issue was filed against a tree with unmerged PRs. On
main,g_gov_02_rate_bounds.rsand itsmined()helper don't exist, so there was nothing to delete formined()— only theensure_minedpromotion applies. This PR refactors exactly the copies present onmain(3×poll, 1×expect_revert).Verification
cargo fmt -- --check— cleancargo clippy -p decdn-e2e --all-targets -- -D warnings— clean (this is the path CI's clippy job compiles; it does not enableanvil-e2e)cargo build -p decdn-e2e --tests --features anvil-e2e— compilesanvil/forgeare not available in the dev environment, so theanvil-e2e-gated integration tests could not be executed locally; CI'sanvil-e2ejob runs them.Closes #1370
Generated by Claude Code