Skip to content

test(e2e): hoist poll/expect_revert helpers into decdn-e2e, make ensure_mined pub - #1387

Merged
alpergundogdu merged 1 commit into
mainfrom
hoist-e2e-poll-expect-revert-helpers
Jul 22, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
hoist-e2e-poll-expect-revert-helpers

Conversation

@altanoruc

Copy link
Copy Markdown
Contributor

What

The anvil-e2e integration tests each re-implemented the same helpers, because integration test targets are separate crates and cannot reach the decdn-e2e library's pub(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 new crates/e2e/src/poll.rs, exposed as decdn_e2e::poll. One canonical doc comment.
  • expect_revert — moved into the existing crates/e2e/src/assert.rs as pub; g_origin_01_publish.rs now imports it. Rewritten match → let...else so the library's -D warnings clippy gate is satisfied (behavior identical).
  • ensure_mined (crates/e2e/src/lib.rs) — promoted pub(crate) → 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.

Scope note

The issue was filed against a tree with unmerged PRs. On main, g_gov_02_rate_bounds.rs and its mined() helper don't exist, so there was nothing to delete for mined() — only the ensure_mined promotion applies. This PR refactors exactly the copies present on main (3× poll, 1× expect_revert).

Verification

  • cargo fmt -- --check — clean
  • cargo clippy -p decdn-e2e --all-targets -- -D warnings — clean (this is the path CI's clippy job compiles; it does not enable anvil-e2e)
  • cargo build -p decdn-e2e --tests --features anvil-e2e — compiles

anvil/forge are not available in the dev environment, so the anvil-e2e-gated integration tests could not be executed locally; CI's anvil-e2e job runs them.

Closes #1370


Generated by Claude Code

…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.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 46 minutes

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: 8181b94c-97c7-4bb6-b9a9-4173606f3757

📥 Commits

Reviewing files that changed from the base of the PR and between a7caac7 and 9496c74.

📒 Files selected for processing (7)
  • crates/e2e/src/assert.rs
  • crates/e2e/src/lib.rs
  • crates/e2e/src/poll.rs
  • crates/e2e/tests/g_node_04_blacklist_compliance.rs
  • crates/e2e/tests/g_origin_01_publish.rs
  • crates/e2e/tests/slash_appeal.rs
  • crates/e2e/tests/smoke.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

Copy link
Copy Markdown

Coverage report

Total: 81.51% (was 81.55%, ▼ 0.04%) — 53777/65976 lines

File Coverage Lines Δ
crates/e2e/src/assert.rs 23.61% 17/72 ▼ 8.46%
crates/e2e/src/lib.rs 0.00% 0/21 ● 0.00%
crates/e2e/src/poll.rs 0.00% 0/14 new
History
Commit Total Δ vs base
9496c74 (HEAD) 81.51% ▼ 0.04%

@altanoruc altanoruc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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:

  • poll removals (smoke.rs, slash_appeal.rs, g_node_04_blacklist_compliance.rs): std::time::Duration stays used at every call site (e.g. smoke.rs:99,129; the local fn only ever fully-qualified tokio::time::*), so no import is left dangling.
  • expect_revert removal (g_origin_01_publish.rs): use anyhow::Context; remains heavily used (.context(...) across lines 78–499), and all 5 expect_revert::<_, …>() call sites are unchanged. Clean.
  • The new poll module is private (mod poll;) with only the fn re-exported, so use decdn_e2e::poll; binds unambiguously to the function — no module/fn name clash.

Nice touches

  • The match → let…else rewrite in the moved expect_revert is behavior-identical and correctly motivated: assert.rs compiles 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% and poll.rs new-at-0% look like a regression, but these helpers are only exercised by the anvil-e2e tests, 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:166 and g_origin_04_default_open.rs:160 hand-roll the same deadline loop (750ms / 500ms sleeps, no Some/None accumulation). Different enough that leaving them out of scope is defensible; a follow-up could fold them into poll if you want one canonical helper.
  • ensure_mined is now pub with no in-PR consumer (the g_gov_02_rate_bounds.rs adopter isn't on main, 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

@alpergundogdu
alpergundogdu merged commit d75aee3 into main Jul 22, 2026
23 checks passed
@alpergundogdu
alpergundogdu deleted the hoist-e2e-poll-expect-revert-helpers branch July 22, 2026 12:53
thiras added a commit that referenced this pull request Jul 22, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): hoist duplicated poll/expect_revert helpers into decdn-e2e, make ensure_mined pub

3 participants