Skip to content

ci: right-size the anvil-e2e timeout budgets - #1657

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/pr-1620-95c422
Aug 12, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/pr-1620-95c422

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1620.

Anchors the anvil-e2e timeouts to measurement instead of to each other, and fixes the containment defect (issue part 2) where per-test ceilings sat below the retry ladders they were meant to contain.

What changed

Per-test ceilings → two measurement-anchored tiers (crates/e2e/src/timeout.rs, new). Replaces the 300/600/780/1200s spread with STANDARD = 300s and HEAVY = 600s. The rule for picking a tier lives in the constant's doc, so the next journey inherits reasoning instead of copying a number. Every test's OVERALL_TIMEOUT now references a shared tier. HEAVY is reserved for journeys whose internal poll ladder exceeds ~150s: g_gov_02 (120+60+120+60s), origin_blacklist_compliance (repeated 180s catch-up polls), slash_appeal (120+30+30s), and the g_node_07 eth leg (five sequential CLI invocations).

Hoist forge build into a one-time job step (.github/workflows/ci.yml, both anvil jobs). The cold contract compile now runs once per job, outside any per-test ceiling; each fixture's in-test forge build becomes a warm incremental no-op. This removes the ~30m CI worst-case cold build from every test. cache-profile: none is kept — enabling the ci cache would need the fixtures on that same forge profile to avoid recompiles, noted as a follow-up.

Deploy ladder DEPLOY_ATTEMPTS 4 → 2 (crates/e2e/src/chain.rs). The deploy ladder runs inside every fixture and can't be hoisted (it needs the test's own anvil), so it's the binding in-test ladder the ceilings must contain. Two attempts cap the CI worst case at 2 × ci_scaled(60s) = 240s, contained by the 300s standard tier, while keeping one snapshot-reverted retry at the full per-attempt margin — the #1384 starvation fix is per-attempt time, not attempt count, so it stays intact.

Job bounds from observed duration, not a sum of ceilings. journeys 200m → 30m (~3.5× the worst observed run, covering the compile the job also runs). settlement 60m → 20m.

Item 5. The corrupt-outboard test's two expected-failure fetches now use a 20s retry budget (new ClientFixture::fetch_with_deadline) instead of the 45s default — strictly safe, since a shorter budget on a fetch that must fail can only surface the failure sooner.

Decisions worth your eye

  • Tiers are 300/600, not the issue's literal 180/300 — [your call already, confirming here]. A resilient deploy ladder (which the issue's own constraint note says to preserve) can't fit under 300s alongside a multi-poll journey, and can't fit under 180s at all without cutting per-attempt margin. 300/600 keeps the deploy retry and still kills the 780/1200s tiers and the sum-of-ceilings model.
  • settlement is 20m, not the issue's suggested 15m. This PR does not retier the settlement test's own in-test OVERALL_TIMEOUT (13m), so Flaky anvil-e2e: forge script deploy subprocess hangs unbounded, freezing the test for minutes #785 requires the job bound to clear 13m + the pre-test compile + hoisted forge build. 15m leaves too little for that; 20m clears it and is still ~10× the 2m observed run. If you'd rather hit 15m, the settlement test's 13m ceiling would need retiering too — say the word.
  • cli_publish's 60s poll left as-is (item 5). Investigated: wait_for_metric returns as soon as the origin-directory watcher converges, so the 60s is a generous cap the poll exits early from — its runtime is watcher-convergence bound, not the deadline. Cutting the cap gains nothing and risks flakiness. Documented rather than changed.

Verification

  • cargo test --no-run -p decdn-e2e --features anvil-e2e — all 16 test targets compile.
  • cargo clippy -p decdn-e2e --features anvil-e2e --tests — clean.
  • cargo fmt -- --check — clean. ci.yml YAML validates.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Testing

    • Standardized end-to-end test timeout tiers for more predictable execution.
    • Added heavier timeout support for longer-running journeys and operations.
    • Improved retry handling with configurable readiness deadlines.
    • Reduced deployment retries while preserving per-attempt timeout behavior.
    • Added explicit deadlines for expected failed fetch requests.
  • CI

    • Builds contracts before running Anvil-based tests.
    • Reduced CI job timeouts to fail stalled test runs sooner.
    • Updated caching guidance to reflect the revised build process.

Anchor the anvil-e2e timeouts to measurement instead of to each other, and
fix the containment defect where per-test ceilings sat below the retry
ladders they were supposed to contain (#1620).

Per-test ceilings (crates/e2e/src/timeout.rs): replace the 300/600/780/1200s
spread with two measurement-anchored tiers — STANDARD 300s and HEAVY 600s —
and put the tier-selection rule in the constant's doc so the next journey
inherits it rather than copying a number. HEAVY is reserved for journeys whose
internal poll ladder exceeds ~150s (g_gov_02, origin_blacklist_compliance,
slash_appeal, the g_node_07 eth leg).

Hoist forge build (.github/workflows/ci.yml): the cold contract compile now
runs once per job, outside any per-test ceiling; each fixture's in-test
forge build becomes a warm incremental no-op. This removes the ~30m CI
worst-case cold build from every test at once.

Deploy ladder (crates/e2e/src/chain.rs): DEPLOY_ATTEMPTS 4 -> 2. The deploy
ladder runs inside every fixture and cannot be hoisted (it needs the test's
own anvil), so it is the binding in-test ladder the ceilings must contain.
Two attempts cap the CI worst case at 2 * ci_scaled(60s) = 240s, contained by
the 300s standard tier, while keeping one snapshot-reverted retry at the full
per-attempt margin — the #1384 starvation fix is per-attempt time, not attempt
count, so it stays intact.

Job bounds derived from observed duration, not a sum of ceilings: journeys
200m -> 30m (~3.5x the worst observed run), settlement 60m -> 20m (floored by
the settlement test's own 13m in-test ceiling + compile per the #785 ordering,
which is why 20m rather than the issue's suggested 15m).

Item 5: cap the corrupt-outboard test's two expected-failure fetches at a 20s
retry budget (new ClientFixture::fetch_with_deadline) instead of the 45s
default — safe because a shorter budget on a fetch that must fail can only
surface the failure sooner. cli_publish's 60s poll is left as-is: it is
watcher-convergence bound and the poll already returns early, so cutting the
cap gains nothing and risks flakiness.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 12, 2026 10:08
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 90.07% (2629/2919 lines)
▲ +0.00pp vs base (90.07% → 90.07%)
Run: 31588245079

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 34 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: 3e9045c2-2afb-4ea1-ab86-4956e5dd9896

📥 Commits

Reviewing files that changed from the base of the PR and between f49ca2f and e38e3d1.

📒 Files selected for processing (2)
  • crates/e2e/src/client.rs
  • crates/e2e/src/timeout.rs
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 164d4065-0cc0-4ac3-a38c-671a51f99e4a

📥 Commits

Reviewing files that changed from the base of the PR and between bb043e8 and f49ca2f.

📒 Files selected for processing (21)
  • .github/workflows/ci.yml
  • crates/e2e/src/chain.rs
  • crates/e2e/src/client.rs
  • crates/e2e/src/lib.rs
  • crates/e2e/src/timeout.rs
  • crates/e2e/tests/cli_bundle_pull_channel_id.rs
  • crates/e2e/tests/cli_fetch_resume.rs
  • crates/e2e/tests/cli_fetch_topup.rs
  • crates/e2e/tests/cli_publish.rs
  • crates/e2e/tests/cli_setup_partial.rs
  • crates/e2e/tests/coop_close_watermark_reconcile.rs
  • crates/e2e/tests/g_gov_02_rate_bounds.rs
  • crates/e2e/tests/g_gov_03_real_evidence.rs
  • crates/e2e/tests/g_node_04_blacklist_compliance.rs
  • crates/e2e/tests/g_node_06_unbond.rs
  • crates/e2e/tests/g_node_07_rotate_key.rs
  • crates/e2e/tests/g_origin_01_publish.rs
  • crates/e2e/tests/origin_blacklist_compliance.rs
  • crates/e2e/tests/origin_stream_while_store.rs
  • crates/e2e/tests/slash_appeal.rs
  • crates/e2e/tests/smoke.rs

Walkthrough

The e2e crate now provides shared timeout tiers and configurable fetch deadlines. Deployment retries are limited to two attempts. CI runs hoisted contract builds and uses shorter job timeouts. E2E tests adopt the shared timeout tiers.

Changes

E2E timeout and CI execution

Layer / File(s) Summary
Timeout and retry contracts
crates/e2e/src/timeout.rs, crates/e2e/src/lib.rs, crates/e2e/src/client.rs, crates/e2e/src/chain.rs
The crate exposes standard and heavy timeout tiers. Fetch callers can provide a retry budget. Deployment retries use two attempts.
CI execution alignment
.github/workflows/ci.yml
Settlement and journeys jobs run forge build before tests. Job timeouts are reduced to 20 and 30 minutes.
Journey timeout adoption
crates/e2e/tests/*
E2E journeys use shared standard or heavy timeout constants. Corrupt-outboard fetches use explicit 20-second deadlines.

Estimated code review effort: 3 (Moderate) | ~25 minutes


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.

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 right-sizes the anvil-e2e timeout model by moving from per-test bespoke ceilings and sum-of-ceilings job bounds to two shared, measurement-anchored tiers, while also hoisting expensive contract compilation out of per-test execution to reduce flakiness and wasted CI wall-clock.

Changes:

  • Introduces shared journey timeout tiers (STANDARD/HEAVY) and updates all anvil-e2e journeys to reference them.
  • Hoists forge build into one-time job steps for the anvil-e2e GitHub Actions jobs and reduces job-level timeout-minutes based on observed runtimes.
  • Lowers the deploy retry ladder attempt count and adds a caller-chosen retry budget API for negative fetch tests to reduce expected-failure runtime.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/e2e/tests/smoke.rs Switches overall test ceiling to the shared STANDARD tier.
crates/e2e/tests/slash_appeal.rs Moves to the shared HEAVY tier with rationale tied to poll ladder length.
crates/e2e/tests/origin_stream_while_store.rs Uses STANDARD tier and tightens expected-failure fetch retry budget via new client API.
crates/e2e/tests/origin_blacklist_compliance.rs Moves to the shared HEAVY tier based on repeated long catch-up polls.
crates/e2e/tests/g_origin_01_publish.rs Uses shared STANDARD tier for the journey ceiling.
crates/e2e/tests/g_node_07_rotate_key.rs Uses STANDARD for base journey and HEAVY for the sequential CLI Ethereum leg.
crates/e2e/tests/g_node_06_unbond.rs Switches to shared STANDARD tier for overall ceiling.
crates/e2e/tests/g_node_04_blacklist_compliance.rs Switches to shared STANDARD tier with tier-selection rationale.
crates/e2e/tests/g_gov_03_real_evidence.rs Switches to shared STANDARD tier with time-warp justification.
crates/e2e/tests/g_gov_02_rate_bounds.rs Switches to shared HEAVY tier due to long sequential poll ladder.
crates/e2e/tests/coop_close_watermark_reconcile.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/tests/cli_setup_partial.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/tests/cli_publish.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/tests/cli_fetch_topup.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/tests/cli_fetch_resume.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/tests/cli_bundle_pull_channel_id.rs Switches overall ceiling to shared STANDARD tier.
crates/e2e/src/timeout.rs Adds the new shared timeout tiers and documents the tier-picking rule and measurement basis.
crates/e2e/src/lib.rs Exposes the new timeout module.
crates/e2e/src/client.rs Adds ClientFixture::fetch_with_deadline for caller-chosen readiness retry budgets.
crates/e2e/src/chain.rs Reduces DEPLOY_ATTEMPTS and updates commentary around build/deploy ladders and CI containment.
.github/workflows/ci.yml Hoists forge build into job steps and reduces job timeout-minutes based on observed runtimes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/e2e/src/timeout.rs Outdated
Comment on lines +13 to +18
//! The binding ladder is the deploy retry ladder in [`crate::chain`]: CI worst
//! case `DEPLOY_ATTEMPTS * ci_scaled(DEPLOY_TIMEOUT)` = `2 * 120s = 240s`, so
//! every tier here clears 240s. `forge build` no longer counts toward it — it is
//! hoisted to a one-time job step (`.github/workflows/ci.yml`), so the cold
//! contract compile happens once, outside any per-test ceiling, and the in-test
//! `forge build` is a warm incremental no-op under CI.

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.

Good catch — fixed in e38e3d1. The module doc now says explicitly that forge build drops out of the binding in-test ladder only under CI (the hoisted step) and warm-artifact local runs; a cold local run still pays the build ladder inside a per-test ceiling, which is acceptable because a local run has no job-level kill racing the per-test message (the containment guarantee is a CI property).

Comment thread crates/e2e/src/client.rs Outdated
Comment on lines +205 to +210
/// the assertion wants. Such a caller passes a budget tighter than the 45s
/// [`Self::fetch`] default to keep its runtime bounded. That is strictly safe:
/// a shorter budget can only surface the expected failure sooner, never turn a
/// real success into a spurious timeout. It must still clear the node's
/// ~500ms-cadence watcher catch-up so the failure reflects the refusal under
/// test, not an un-observed channel.

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.

Agreed — fixed in e38e3d1. The doc now scopes the "shorter budget never causes a spurious timeout" property to expect-failure callers, and adds that a positive fetch can expire in the channel-open→watcher-observe window and must keep headroom above the ~500ms catch-up (which is why fetch budgets a generous 45s).

…afety

Address review feedback on #1657:

- timeout.rs: make explicit that `forge build` drops out of the binding
  in-test ladder only under CI (hoisted step) and warm-artifact local runs;
  a cold local run still pays the build ladder inside a per-test ceiling,
  which is fine because local runs have no job-level kill racing the message.
- client.rs: scope the "shorter budget never causes a spurious timeout"
  property of fetch_with_deadline to expect-failure callers; note that a
  positive fetch needs headroom above the watcher catch-up window.

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

Copy link
Copy Markdown

Coverage report

Total: 80.45% (was 80.47%, ▼ 0.02%) — 62442/77620 lines

File Coverage Lines Δ
crates/e2e/src/chain.rs 1.52% 21/1381 ● 0.00%
crates/e2e/src/client.rs 0.00% 0/453 ● 0.00%
crates/e2e/src/lib.rs 0.00% 0/21 ● 0.00%
History
Commit Total Δ vs base
e38e3d1 (HEAD) 80.45% ▼ 0.02%

@alpergundogdu
alpergundogdu merged commit 40a12a4 into main Aug 12, 2026
50 of 53 checks passed
@alpergundogdu
alpergundogdu deleted the claude/pr-1620-95c422 branch August 12, 2026 11:16
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.

ci: right-size the anvil-e2e timeout budgets (200m bound vs ~6m runs; per-test ceilings smaller than their retry ladders)

2 participants