Skip to content

fix(node,e2e): harden CI flakes (2b+2c+3+settlement) - #1827

Merged
thiras merged 7 commits into
mainfrom
fix/2b-silent-upstreams-flake
Aug 26, 2026
Merged

thiras merged 7 commits into
mainfrom
fix/2b-silent-upstreams-flake

Conversation

@thiras

@thiras thiras commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1826

Closes flaky buckets 2b/2c/3 + settlement from CI triage (#1826 + g_node_04 + run 32915992488).

2b crates/node/tests/node_origin_pull.rs:5806 silent_upstreams_do_not_starve_the_candidate_loop at 2s starves outer deadline under cargo llvm-cov (4-core). Bump per_candidate/stall_budget 2s→5s (59.5s→77.5s outer via selection::outer_pull_deadline crates/node/src/selection.rs:124), poll node_pull_stalled_total >=2, raise .config/nextest.toml:49 slow-timeout 60s→120s.

2c crates/node/tests/node_origin_pull.rs:9752 two_concurrent_pulls_to_one_provider_share_the_channel_ledger (issue #1826) now distinguishes StaleNonce (retires channel, caps cumulative) vs CHANNEL_OPEN_CALLER_BUDGET expiry (node_pull_pool_open_pending_total) in the failure message and bounds the join with a 30s timeout. concurrent_pulls_resume_at_their_own_frontier_not_the_channels crates/node/tests/node_origin_pull.rs:13314 adds same diagnostic (topup_log, stalled/pending) to separate frontier overshoot NotFound from stall. Buyer-ledger sharing already correct via crates/node/src/buyer_ledgers.rs:62 LaneKey + PoolLedger issuance serialization; no further code change — next flake will be unambiguous.

3 crates/e2e/tests/g_node_04_blacklist_compliance.rs:273 removal_lifts_the_deny_but_eviction_is_sticky extends HashRemoved convergence 90s→180s (survives 10s RPC timeout + eth_getLogs jitter under --test-threads 2) and lifts journey overall timeout STANDARD→HEAVY crates/e2e/src/timeout.rs:64 (270s ladder vs 240s deploy). Last refusal surfaced.

settlement crates/node/tests/anvil_settlement_e2e.rs:852 registered_until must be persisted once the first redeem's CapabilityReg lands races getWatermark (eth_call, immediate after block) vs store.set_registered_until at crates/node/src/payment_settlement.rs:1232 after TxOutcome::Landed. Poll store (10s, diagnosed with auth cap/expiry snapshot) instead of single read (run 32915992488 flake), replace fixed 100ms sleep before second delivery with deterministic poll for registered_until visibility to next plan_lanes, poll second-lane check likewise, and poll CapCountLayer capture before cap_count_for_tx so on_event delivery is not raced. 5/5 local e2e_onchain_payment_pool_settlement runs green.

Verified: cargo clippy -p decdn-node --tests / -p decdn-e2e --features anvil-e2e --tests clean, cargo fmt clean, cargo check -p decdn-node --features anvil-e2e clean, silent_upstreams + two_concurrent + concurrent_pulls_resume + e2e_onchain_payment_pool_settlement (5×) green under nextest.

At 2s per-candidate budgets the two silent candidates starve the
outer deadline before the healthy fallback is reached under
cargo llvm-cov on the 4-core CI runner, and the stall counter
reads 0 instead of 2. Bump to 5s (59.5s -> 77.5s outer) and poll
the counter to absorb scrape lag. Raise decdn-node nextest
slow-timeout 60s -> 120s to contain the new outer deadline.
Copilot AI lite review requested due to automatic review settings August 26, 2026 00:24

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 hardens a flaky decdn-node integration test under cargo llvm-cov by increasing per-candidate deadlines and making the stall-metric assertion tolerant to scrape lag, and it updates nextest timeouts to accommodate the longer derived outer deadline.

Changes:

  • Increased per_candidate and stall_budget from 2s to 5s in silent_upstreams_do_not_starve_the_candidate_loop.
  • Replaced a strict node_pull_stalled_total == 2 assertion with a short polling loop to absorb metrics scrape lag.
  • Raised the nextest slow-timeout override for package(decdn-node) to 120s.

Reviewed changes

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

File Description
crates/node/tests/node_origin_pull.rs Adjusts test timing budgets and changes the stalled-counter assertion to poll under coverage slowdown.
.config/nextest.toml Increases nextest timeout for decdn-node tests and updates accompanying rationale comments.

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

Comment thread .config/nextest.toml Resolved
Comment thread crates/node/tests/node_origin_pull.rs Resolved
…al (2c+3)

2c: two_concurrent_pulls_to_one_provider_share_the_channel_ledger now
distinguishes StaleNonce vs CHANNEL_OPEN_CALLER_BUDGET expiry by
surfacing pending/timeout/stalled counters and recorded/retired
ledger state in the failure message, and bounds the join with a
30s timeout that reports pool_open_pending budget expiry instead
of the nextest slow-timeout. concurrent_pulls_resume_at_their_own_frontier
adds the same diagnostic context (topup log, stalled/pending) so a
NotFound from frontier overshoot is separable from a stalled/timeout.

3: g_node_04 removal_lifts_the_deny_but_eviction_is_sticky extends the
HashRemoved convergence window 90s->180s (survives 10s RPC timeout +
eth_getLogs jitter under --test-threads 2) and lifts the journey
overall timeout STANDARD->HEAVY (270s ladder vs 240s deploy), with
last-refusal surfacing for the assert.
@thiras thiras changed the title fix(node): harden silent_upstreams flaky under coverage (2b) fix(node,e2e): harden CI flakes (2b+2c+3) Aug 26, 2026
…t math and keep stalled guard strict

- nextest: global backstop is 60s×5=300s, override is 60s×3=180s (not 180s global / 120s override). Fix wording to 180s still leaves room, 120s sooner than 300s global, first SLOW at 60s. Revert period 120s→60s — 77.5s outer still fits in 180s, 120s×3=360s would be looser than global.
- node_origin_pull: poll for exact 2 stalled (v != 2) then assert_counter ==2 instead of >=2 — extra stalls should fail, scrape lag is the only tolerance.

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

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

Comment thread crates/node/tests/node_origin_pull.rs Resolved
…ed_assignments allow

- node_origin_pull: reference CHANNEL_OPEN_CALLER_BUDGET via imported constant
  and format its Debug value instead of hard-coding (5s), so diagnostic
  stays accurate if the budget changes.
- g_node_04: add brief reason for #[allow(unused_assignments)] — initial
  String::new() is overwritten before first read, binding must be initialized
  for post-loop assert.
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.93% (was 81.93%, ● 0.00%) — 67679/82608 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
489b8c4 81.93% ● 0.00%
25a68ae 81.93% ● 0.00%
e98c7c4 81.93% ▼ 0.01%
99095f9 (HEAD) 81.93% ● 0.00%

The anvil settlement e2e polled getWatermark (eth_call) to detect a
landed redeemMany, then immediately asserted store.get(...).registered_until
!= 0. The store write is payment_settlement.rs:1232 after TxOutcome::Landed,
so under load the eth_call wins and the assertion flakes (run 32915992488).

Poll the store instead of a single read (10s, diagnosed with auth cap/expiry
snapshot), replace the fixed 100ms sleep before the second delivery with a
deterministic poll, keep the second-lane check polled as well, and poll the
CapCountLayer capture before cap_count_for_tx so the log layer's on_event
delivery is not raced. 5/5 local runs green; clippy/fmt clean.
@thiras thiras changed the title fix(node,e2e): harden CI flakes (2b+2c+3) fix(node,e2e): harden CI flakes (2b+2c+3+settlement) Aug 26, 2026
@thiras
thiras requested a lite review from Copilot August 26, 2026 01:20

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

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

Suppressed comments (3)

crates/node/tests/node_origin_pull.rs:9790

  • matches!(second, OriginFetch::AlreadyAdmitted) moves second, but the error message formats {second:?}. Since OriginFetch is not Copy, this becomes a compile-time use-after-move.
        matches!(second, OriginFetch::AlreadyAdmitted),

crates/node/tests/node_origin_pull.rs:13365

  • matches!(got_a, OriginFetch::AlreadyAdmitted) moves got_a, but the error message formats {got_a:?}. OriginFetch is not Copy, so this will not compile.
        matches!(got_a, OriginFetch::AlreadyAdmitted),

crates/node/tests/node_origin_pull.rs:13377

  • matches!(got_b, OriginFetch::AlreadyAdmitted) moves got_b, but the error message formats {got_b:?}. OriginFetch is not Copy, so this will not compile.
        matches!(got_b, OriginFetch::AlreadyAdmitted),

Comment thread crates/node/tests/node_origin_pull.rs Resolved
thiras and others added 2 commits August 26, 2026 04:31
…and drop no-op poll

OriginFetch is not Copy (holds a stream in Found), so matches!(first,
OriginFetch::AlreadyAdmitted) moves first and the same ensure's
format string then uses {first:?} — a use-after-move that fails to
compile. Borrow in the predicate (matches!(&first, ...)) keeps the
value for the diagnostic. Same at four sites: 9776, 9790, 13365, 13377.

The second poll_until after lane_after_first in anvil_settlement_e2e
checks the same (registered_until != 0) predicate the preceding
poll already satisfied, so it returns immediately and creates no
deterministic gap for the next plan_lanes/load_all as the comment
claimed. Remove the block; the first poll already guarantees
store.set_registered_until visibility on the shared
PersistentPoolStateStore buffer.
…e diagnostics

Review follow-ups on the flake-hardening pass.

anvil_settlement_e2e: restore the 100ms settle window before the second
delivery. The window guards `cap_count_second == 0`, not store visibility
— its own note records that `store.get` already showed `registered_until`
durably set at the instant the second sweep still attached a CapabilityReg
— so the `lane_after_first` poll does not subsume it. Keep that poll; it is
a real improvement over the single read.

node_origin_pull: raise the concurrent-ledger join bound to `from_mins(1)`
and name it, so a slow-but-correct run under llvm-cov still passes while
the named verdict beats the `60s x 3` nextest cap. Print `recorded`/`retired`
as the same shape in the timeout arm as in the two ensure arms.

e2e/timeout: list the g_node_04 removal-reversal journey among the HEAVY
tier users, as the module rule requires.

Drop the redundant `#[allow(unused_assignments)]` on `last_msg`:
`String::clone_from` reads the destination to reuse its allocation, so the
initial value is live and the lint never fires.

Comments state the requirement rather than what an older value did.

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

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.69% (2575/2871 lines)
▲ +0.00pp vs base (89.69% → 89.69%)
Run: 32937526669

@thiras
thiras merged commit 3054c22 into main Aug 26, 2026
25 checks passed
@thiras
thiras deleted the fix/2b-silent-upstreams-flake branch August 26, 2026 06:29
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.

flaky: two_concurrent_pulls_to_one_provider_share_the_channel_ledger fails under coverage instrumentation

3 participants