Skip to content

fix(node): log the full error chain when the capacity-bond registry resync fails - #2259

Merged
yigitdot merged 2 commits into
mainfrom
fix/2255-resync-warn-error-chain
Oct 1, 2026
Merged

yigitdot merged 2 commits into
mainfrom
fix/2255-resync-warn-error-chain

Conversation

@yigitdot

@yigitdot yigitdot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The capacity-bond registry resync WARN logged error = %err, which prints only the outer getRegisteredNodes(offset=…, limit=…) context. It now logs sanitize_err_chain(&err), like the nodeIdOf warning in the same file, so the RPC cause (timeout, dRPC code 19, decode error) reaches Loki.
  • The node-origin pool-open warnings in node_origin/mod.rs (the LocalFault arm and both outside-the-task arms) had the same loss: the outermost context is the LocalPullFault marker or the PoolOpenFailureReason. They now log sanitize_err_chain(err) too.
  • The test stub's full_snapshot error carries the same page context the real reader adds, built from PAGE_SIZE, so the cause sits below the outermost message as it does in production.
  • Audit of the other chain-read WARN sites in crates/node/src/dht/, crates/node/src/*watcher*.rs, and crates/node/src/chain_events/: no further changes. slash_watcher.rs, blacklist_watcher.rs, multiplexed_poller.rs, and boot_retry.rs already use sanitize_err_chain. The remaining plain %err sites are sol log-decode errors, JoinErrors, local checkpoint-store errors, DHT RPC errors, or non-anyhow errors (fee_shares_watcher.rs).
  • Out of scope: payment_settlement.rs (owned by node: service-level test that the shutdown redeem sweep applies the configured floor #2235). RPC URL redaction for raw alloy errors is tracked in fix(node): redact RPC URLs in chain-read warnings #2264.

Test plan

  • resync_failure_logs_the_full_error_chain asserts the WARN carries both the context and the cause (fails before the fix: the line ends at error=getRegisteredNodes(offset=0, limit=100))
  • cargo nextest run -p decdn-node capacity_bond_registry node_origin
  • cargo clippy --workspace --all-targets -- -D warnings, cargo fmt -- --check, cargo doc with -D warnings

Closes #2255

🤖 Generated with Claude Code

…esync fails

The resync WARN rendered the anyhow error with plain Display, which
prints only the outer getRegisteredNodes(offset=…, limit=…) context and
drops the RPC cause. Log sanitize_err_chain(&err) instead, matching the
nodeIdOf warning in the same file.

Closes #2255

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 02:21

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 1, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit e2da6e1 in the fix/2255-resync-warn... branch remains at 87%, unchanged from commit cb83e28 in the main branch.


Updated October 01, 2026 17:18 UTC

@alpergundogdu

Copy link
Copy Markdown
Contributor

Review: approve with nits

The fix is correct: sanitize_err_chain formats with {err:#} and strips URLs, so the resync WARN at capacity_bond_registry.rs:609 now carries both the getRegisteredNodes(...) context and the RPC cause, matching the nodeIdOf warning at :342 and ef4bb89. The test fails without the fix and checks level, context and cause. CI is green.

Findings

  1. The node_origin/ audit missed sites with the same bug.

    • node_origin/mod.rs:305 (LocalFault arm): the outermost context is the LocalPullFault marker (e.g. buyer_channel.rs:848, funder.rs:201), so the line prints only "local buyer-side fault (not attributable to the upstream)".
    • node_origin/mod.rs:347: the reason is attached with .context(reason) (client/buyer_pool.rs:475/483/491), so it can print just "pool-open failure reason: rpc_error".
    • Fix: error = %sanitize_err_chain(&err) at :305, :347 and :355.
  2. Raw alloy errors logged with %err can leak the RPC URL (and its key). binding_check.rs:106, buyer_channel.rs:841, buyer_channel.rs:1778.
    Fix: use %sanitize_rpc_display(&err) (the helper documented at redact.rs:141). Separate concern from this PR; fine as a follow-up.

Nits

  • The stub at capacity_bond_registry.rs:~1164 hardcodes "getRegisteredNodes(offset=0, limit=100)". Build it with format! from PAGE_SIZE so the test cannot drift from the constant at :89.
  • CapturedLog is now the third copy of the same log-capture writer (node_origin/mod.rs:3969, commands/mod.rs:316). Worth moving into one shared test util.

@alpergundogdu

Copy link
Copy Markdown
Contributor

Decisions on the review findings

  • node_origin/ sites (finding 1): please fix in this PR (node_origin/mod.rs:305, :347, :355 with %sanitize_err_chain(&err)), since they are the same bug the PR audits for.
  • RPC URL redaction (finding 2): separate issue and PR, linked below.
  • PAGE_SIZE stub nit: please fix in this PR.
  • CapturedLog dedupe: leave as is.

Redaction follow-up: #2264

The LocalFault and outside-the-task pool-open warnings rendered the
anyhow error with plain Display, which prints only the outermost
context (the LocalPullFault marker or the PoolOpenFailureReason) and
drops the cause. Log sanitize_err_chain instead. The registry test stub
builds its page context from PAGE_SIZE so it tracks the constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yigitdot
yigitdot requested a review from alpergundogdu October 1, 2026 17:49
@yigitdot
yigitdot merged commit 5539cd0 into main Oct 1, 2026
30 checks passed
@yigitdot
yigitdot deleted the fix/2255-resync-warn-error-chain branch October 1, 2026 21:07
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.

node: the capacity-bond registry resync warning logs only its outer context, so the RPC cause is lost

3 participants