Skip to content

test(e2e,node): fix the two reproducible sources of CI flakiness - #1878

Merged
thiras merged 1 commit into
mainfrom
fix/ci-flakiness-log-filter-and-pull-budgets
Aug 30, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/ci-flakiness-log-filter-and-pull-budgets

Conversation

@thiras

@thiras thiras commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Why

~19% of concluded CI runs were failing (29 / 154). Investigating the failed jobs turned up two reproducible causes plus two things worth naming but not fixed here.

What

1. cli_fetch_delegated — a real bug, 3 of the 6 anvil e2e (journeys) failures

The PoolRedeemed assertion used Filter::new().address(..).event_signature(..) with no block range. alloy omits fromBlock/toBlock when they are None, and anvil then reads the range as latest..latest — the head block alone, not a full-history scan. The assertion therefore held only while the redemption happened to sit in the head block.

Verified in isolation first (anvil, two log-emitting txs then one unrelated tx: the no-range query returns 0 logs, fromBlock: 0x0 returns 2), then differentially against the real journey:

filter 5 empty blocks mined after redemption result
original (unbounded, one-shot) yes FAIL — no PoolRedeemed event named the delegate signer …, the exact CI message
fixed (from_block + poll) yes PASS

The correct sibling already exists at crates/node/tests/anvil_settlement_e2e.rs:1214, whose doc comment names this hazard.

2. node_origin_pull wall-clock budgets — CPU starvation

The test job runs cargo llvm-cov nextest --workspace (3038 tests) on a four-core runner with no --test-threads cap, while 297 workspace tests are #[tokio::test(flavor = "multi_thread")] with worker_threads unpinned. The evidence is the blowup of the same tests:

test green red
concurrent_pulls_resume_at_their_own_frontier_not_the_channels 1.31s 21.4s (stalled=1, 20s bound)
two_concurrent_pulls_to_one_provider_share_the_channel_ledger 0.51s 10.98s

DEFAULT_TEST_PULL_DEADLINES is now sized to be unreachable rather than merely large. No test that uses it asserts on either bound firing; the .config/nextest.toml per-test cap stays the backstop for a genuine wedge.

3–4. nextest profile

retries = 2 scoped to the suites that drive live endpoints, anvil and forge — never global, so everything else stays a first-attempt hard failure. threads-required = 2 on binary(node_origin_pull) halves its co-scheduling where slots are scarce and costs nothing on a developer box.

Verification

  • Contention repro (4 cores + 4 spinners, --retries 0): was 2/6 failing → now 0/6, with the budget fix alone doing the work.
  • Full decdn-node package ×3, retries off: 1057/1057 each, and ~8s faster.
  • Full workspace: 3057/3057. Affected e2e journeys: 4/4.
  • cargo fmt --check and clippy clean across both feature sets, checked by exit code.

Not fixed here

  • two_concurrent_pulls_to_one_provider_share_the_channel_ledger (1 failure) is not explained by this. Its metrics were stalled=0 timeout=0 pending=0 with two ledger recordings each at one pull's wire bytes — unshared ledgers, not a budget expiry — and it did not reproduce. Possibly a real race in BuyerLedgers. Retries will now surface it as FLAKY; that line is a defect signal to chase, not noise.
  • One journeys failure showed iroh probing a public address (sendmsg EINVAL to an Azure IP) before a warm-up NotFound. n=1, unaddressed.
  • The error[E0053] reds on main were a semantic merge conflict, not flakiness, and are already resolved.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mfyosg52pVuL5t2XLwx1Vu

`cli_fetch_delegated` asserted on a `PoolRedeemed` log through a filter that
named no `fromBlock`. alloy omits the field when it is `None` and anvil then
reads the range as `latest..latest`, so the assertion only held while the
redemption sat in the head block and failed the moment anything mined after it.
Anchor the scan at a block captured before the fetch and poll it, matching
`anvil_settlement_e2e::redeem_tx_for_lane`.

Proven differentially: with five empty blocks mined after the redemption, the
old filter fails with the exact message CI reported and the new one passes.

`node_origin_pull`'s `DEFAULT_TEST_PULL_DEADLINES` claimed to be generous enough
that a loaded runner never trips it. It was not: a fixture costing 1.3s
uncontended has ended on that 20s stall bound at 21.4s, on CI and in a local
whole-package run. Size it to be unreachable instead; the nextest per-test cap
remains the backstop for a genuine wedge. The four inline configs that
duplicated the literal now reference the constant.

The widening deliberately stays off the shared builder: two fixtures feed the
same budgets to `selection::outer_pull_deadline` and assert on what it derives,
so a margin applied behind the caller's back would put the config and that
derivation out of step.

Also scope nextest `retries` to the suites that drive live endpoints, anvil and
forge, and claim two scheduler slots per `node_origin_pull` test so its 65
multi-thread tokio fixtures stop co-scheduling four-at-a-time on a four-core
runner.

Contention repro (4 cores, 4 spinners, retries off): was 2/6 failing, now 0/6.
Workspace 3057/3057; the affected e2e journeys 4/4.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mfyosg52pVuL5t2XLwx1Vu
Copilot AI lite review requested due to automatic review settings August 30, 2026 21:00

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 reduces CI flakiness in the Rust e2e and node test suites by fixing an anvil log-query bug in cli_fetch_delegated, expanding test pull deadline budgets to tolerate CPU-starved runners, and scoping nextest retries/slot requirements to the suites that legitimately contend on shared resources.

Changes:

  • Fix cli_fetch_delegated’s PoolRedeemed assertion by anchoring the eth_getLogs scan with from_block and polling for log availability.
  • Increase node_origin_pull’s default (pull_timeout, stall_timeout) budgets to values intended to be unreachable during honest progress on loaded CI runners, and reuse those defaults consistently in affected fixtures.
  • Update .config/nextest.toml to scope retries = 2 to anvil/iroh-heavy suites and to reduce node_origin_pull oversubscription via threads-required = 2.

Reviewed changes

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

File Description
crates/node/tests/node_origin_pull.rs Widen default pull/stall deadlines and align fixtures/comments with “unreachable budgets” intent under contention.
crates/e2e/tests/cli_fetch_delegated.rs Make PoolRedeemed log assertion robust by bounding log scans with from_block and polling instead of one-shot reads.
.config/nextest.toml Scope retries to flaky-by-contention suites and reduce concurrency pressure for node_origin_pull via slot requirements.

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

@github-actions

Copy link
Copy Markdown

Coverage report

Total: 82.27% (was 82.27%, ● 0.00%) — 69250/84173 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
329f038 (HEAD) 82.27% ● 0.00%

@thiras
thiras merged commit d6d169a into main Aug 30, 2026
26 checks passed
@thiras
thiras deleted the fix/ci-flakiness-log-filter-and-pull-budgets branch August 30, 2026 21:11
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.

2 participants