Skip to content

fix(client,cli): lane faults at WARN; typed RPC errors keep their failure class - #2370

Merged
thiras merged 6 commits into
mainfrom
fix/2331-2277-log-levels-error-chains
Oct 9, 2026
Merged

thiras merged 6 commits into
mainfrom
fix/2331-2277-log-levels-error-chains

Conversation

@yigitdot

@yigitdot yigitdot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#2331: lane faults at WARN. These lines logged at INFO. So a log monitor that filters on WARN and ERROR missed every provider refusal, stall and dropped stream. The level now follows the fault class (Fault::warns):

  • Source and Fatal log at WARN. This covers a lane faulted… and a source faulted (source_set::record_fault), and an extra stream of a lane faulted… when bytes landed (scheduler::log_extra_fault).
  • Unaffordable (a deposit wait) and Transient (a chain-side retry) log at INFO. Neither means a provider is failing.
  • An extra stream that faults before any verified byte stays at DEBUG.
  • A small warn_or_info! macro in fault.rs lets both levels share one field list.

Lane-fault lines no longer leak the RPC URL. These lines logged the raw {err:#}. A lane-build or top-up fault (LaneBuildFault, EscrowUntracked) wraps the alloy transport error, and its reqwest layer prints for url (<rpc_url>). That URL can carry an API key. The error fields now go through sanitize_err_chain, which the lane-build line already uses.

#2277: typed errors keep their failure class.

  • sanitize_rpc_display → sanitize_error_sources(&e) for typed errors: the pool.rs getPool reads, the doctor/origin.rs reqwest HEAD, and the discovery.rs registry retry. The anyhow build_provider error uses sanitize_err_chain(&e).
  • Fifteen more sites flattened a typed alloy error with anyhow!("…: {e}") or bail! before main sanitized it. They now keep the source as anyhow::Error::new(e).context(…). The sites are in pool.rs, fetch.rs, bundle_pull.rs and incentive/payment_pool.rs. Three pool.rs sweep sites now call sanitize_error_sources(&e) directly.

Example: an RPC that refuses the connection printed getPool failed: error sending request. It now prints the connect failure, … Connection refused. URLs are still stripped from every layer.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt -- --check
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • cargo nextest run -p decdn-client -p decdn-cli -p decdn-common -p decdn-incentive: 2337 passed, after merging main (feat!: scope node refusals to three classes and recover funding once per fetch #2354)
  • New: scheduler::tests::extra_stream_fault_level_follows_landed_and_class and fault::tests::only_source_and_fatal_faults_warn. source_set::tests::the_lane_fault_line_names_the_holder_record now asserts the levels, and asserts that a LaneBuildFault naming https://rpc.example/v3/secret leaves no URL in either record_fault line. Reverting the sanitize call fails it. pool_lifecycle::reclaim_pool_reads_chain_before_store_or_keystore asserts that connection refused survives.

Follow-up: #2371 (needs a review to decide whether it is still needed).

Closes #2331
Closes #2277

🤖 Generated with Claude Code

yigitdot and others added 2 commits October 8, 2026 04:38
A source fault or a fatal one is what an operator watches for, so its
lane-fault line (source_set `a lane faulted` / `a source faulted`,
scheduler `an extra stream of a lane faulted` with bytes landed) is at
warn. A deposit wait (Unaffordable) or chain-side retry (Transient)
stays at info; a refused extra stream with nothing landed stays at debug.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es (#2277)

sanitize_rpc_display prints only the top Display, so an alloy or reqwest
error lost its failure class (timeout, refused, DNS, TLS) once the URL
was stripped. Typed errors now go through sanitize_error_sources and the
anyhow build_provider error through sanitize_err_chain. The three
pool.rs sites that flattened a ContractError via anyhow!("{e}") before
sanitize_err_chain had the same loss and take the typed walker too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 01:39
@yigitdot yigitdot self-assigned this Oct 8, 2026

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-code-quality

github-code-quality Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit c29918e in the fix/2331-2277-log-le... branch remains at 75%, unchanged from commit 13373c8 in the main branch.

Show a line coverage summary of the most impacted files.
File main 13373c8 fix/2331-2277-log-le... c29918e +/-
crates/client/src/scheduler.rs 93% 93% 0%
crates/cli/src/...ommands/pool.rs 53% 53% 0%
crates/cli/src/...mmands/fetch.rs 55% 55% 0%
crates/cache/src/engine.rs 91% 91% 0%
crates/protocol/src/framing.rs 93% 93% 0%
crates/node/src...gin/pull_leg.rs 85% 85% 0%
crates/client/src/fault.rs 96% 96% 0%
crates/incentiv...payment_pool.rs 97% 97% 0%
crates/client/s...c/source_set.rs 93% 94% +1%

Updated October 09, 2026 05:29 UTC

Lane-fault lines logged the raw error chain. A top-up fault wraps the
alloy transport error, whose reqwest layer names the RPC URL, so a key
in rpc_url reached the log. Those fields now go through
sanitize_err_chain.

An extra stream's fault is at debug only when it is a refusal before any
verified byte. A stall or dropped stream before the first byte follows
its class, so it reaches warn.

Typed alloy errors that were flattened with anyhow!("…: {e}") keep
their source() chain as anyhow::Error::new(e).context(…), so the
transport class survives to the sanitized print in main. This covers
the pool, fetch, bundle pull and incentive getPools reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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.

🟢 Approval recommended

The logging and error-chain changes are consistent, appropriately sanitized, and covered by targeted tests.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

yigitdot and others added 2 commits October 8, 2026 06:29
An extra stream that faults before any verified byte logs at debug
again, whatever the error. Its error field stays sanitized.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yigitdot
yigitdot requested a review from thiras October 8, 2026 10:45

@thiras thiras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update for the latest merge

…els-error-chains

# Conflicts:
#	crates/client/src/fault/tests.rs
#	crates/client/src/scheduler/tests.rs
@thiras
thiras merged commit a09720a into main Oct 9, 2026
30 checks passed
@thiras
thiras deleted the fix/2331-2277-log-levels-error-chains branch October 9, 2026 05:38
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.

chore(client): log lane faults at WARN, not INFO cli, client: log typed RPC errors through sanitize_error_sources so the failure class survives

3 participants