Skip to content

fix(node,cache): capability intake/expiry visibility and fs origin fault visibility - #2815

Merged
thiras merged 4 commits into
mainfrom
claude/2631-2801-capability-and-fs-origin-visibility-d75468
Nov 3, 2026
Merged

thiras merged 4 commits into
mainfrom
claude/2631-2801-capability-and-fs-origin-visibility-d75468

Conversation

@yigitdot

@yigitdot yigitdot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

#2631: capability observability (node)

  • Expired-capability outcome. A new node-local ServeRejectReason::CapabilityExpired covers two admission refusals. The first is a lane whose capability is inside the expiry margin (dispatch.rs). The second is a Registered signer with now >= expiry (signer_refusal). It records the span reason capability_expired and decdn_serve_stream_rejected_capability_expired_total, which is also in INBOUND_FAILURE_REASONS. It still signs StreamError::Unfunded, so the wire does not change. A cap shortfall on a live registration stays signer_cap_exhausted. The docs give each refusal its own remedy: for an expired capability, the owner delegates a fresh capability.
  • Intake-drop counter. decdn_capability_intake_dropped_total{reason} is a labelled Family, with every child exported at zero from startup. Each drop arm in intake_capability increments its own label: expiry_zero, not_eoa_signature, malformed_signature, wrong_owner or invalid_signature. Log levels do not change.
  • Docs. adr/appendix-observability.md gets rows for both counters, a note on the refused outcome, and a line on why the intake split is labelled.
  • Tests. New cases in signer_refusal_tests and in the outcome-label and metrics tests. One unit test per intake label. The loopback tests client_expired_capability_is_refused_unfunded, client_zero_expiry_lane_is_refused_unfunded and client_capability_inside_the_expiry_margin_is_refused_unfunded now assert the capability_expired counter. A new loopback test, client_capability_signed_by_a_non_owner_registers_no_lane, sends a bound request with a pool view wired and a capability signed by a non-owner. It asserts the wire NotFound, the unknown-lane counter, no row in the lane store, and the wrong_owner count.

Note: INBOUND_FAILURE_REASONS gains decdn_serve_stream_rejected_capability_expired_total. The "Unattributed stream failures" panels in decdn/devops subtract that list by hand, so they need the same addition.

#2801: fs origin visibility gaps (cache)

  1. Dangling symlink. resolve_regular returns Permanent, not Ok(None), when the leaf or the shard directory is a symlink whose target is missing. A valid symlinked shard directory with no leaf under it still reads as absent. This also covers the .obao4 outboard sibling, which shares the resolve: a dangling outboard symlink is a permanent fault (pinned by a test), the range probe latches it and warns, and the serve still lands through the buffered whole-blob path.
  2. Oversize outboard. A tracing::warn! with the path or key, the length and the cap now comes before each oversize Unsupported: three sites in fs.rs, two in http.rs (at the caller of collect_capped) and two in s3.rs.
  3. Probe fault cause. probe_origin_chain returns a ChainProbe that carries the walk's last per-origin error. The "origin probe faulted; memoising the fault" warn logs it, so a permanent fault such as a symlink escape shows at the default log level. probe_origin_chain_classified merges into probe_origin_chain, and both callers, the rescan and origin_probe_presence, are updated.
  4. Unreadable file. size() opens and fstats the data object once. An open error goes through classify_io_error, so a file the process cannot read is a fault, not a size.
  5. ESTALE. StaleNetworkFileHandle is Transient in the fs classify_io_error and in retry::classify_by_kind.
  6. Stale docs. The fetch and cap_at_max_bytes docs now say an overrun is a BlobTooLargeMarker that the engine turns into CacheError::BlobTooLarge. The unused path_for_log is gone from the unfold state.

A follow-up commit from the PR review threads the first non-transient per-origin cause through ChainProbe (a later transient fault cannot shadow it), logs dangling_link's own probe errors at debug, and fixes the docs the review flagged; review follow-up issues: #2823, #2824, #2825, #2826, #2827.

Tests in fs/tests.rs: a dangling leaf symlink and a dangling shard-directory symlink (#[cfg(unix)]), plus a valid shard symlink with no leaf that stays absent; a chmod 000 file whose size() returns Permanent (the test returns early under root); classify_io_error for ESTALE; and a log-capture test, which adds tracing-subscriber as a cache dev-dependency, asserting that the fs oversize warn names the path and the cap. retry/tests.rs gets an ESTALE case.

Verification

  • cargo build && cargo clippy --workspace --all-targets -- -D warnings: pass
  • cargo fmt -- --check: pass
  • CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items: pass
  • cargo nextest run -p decdn-node -p decdn-cache --no-fail-fast: 2423 passed. dht_loopback pooled_client::an_aborted_call_unpins_its_connection was flaky and passed on retry; this PR does not touch it.
  • cargo deny check: bans, licenses and sources pass. advisories fails on RUSTSEC-2026-0387 (crypto-bigint 0.5.5, which comes in through k256). The failure is already on main: the ignore PR chore(deps): ignore RUSTSEC-2026-0387 until alloy moves to k256 0.14 #2797 was closed without merging. This PR's lockfile change adds only tracing-subscriber to the decdn-cache dev-dependencies.
  • git diff --stat origin/main -- contracts/: empty

Closes #2631
Closes #2801

🤖 Generated with Claude Code

yigitdot and others added 2 commits November 1, 2026 09:22
…ty intake drops (#2631)

An admission refusal for a capability inside the expiry margin, or for a
registered signer at or past its on-chain expiry, now records the node-local
ServeRejectReason::CapabilityExpired: span reason capability_expired and
decdn_serve_stream_rejected_capability_expired_total. It still signs
Unfunded, so the wire is unchanged. A cap shortfall on a live registration
stays signer_cap_exhausted.

Each capability intake drop counts on
decdn_capability_intake_dropped_total{reason}, with one label per drop arm
(expiry_zero, not_eoa_signature, malformed_signature, wrong_owner,
invalid_signature). Log levels are unchanged.

A loopback test sends a bound request with a capability signed by a
non-owner through dispatch with a pool view wired, and checks the wire
NotFound, the empty lane store and the wrong_owner count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A dangling symlink, as a leaf or as a shard directory, is a permanent
  fault from the filesystem origin, not an authoritative absence that
  size() memoises and the rescan drops with no log.
- size() opens the data object once and fstats it, so an unreadable file
  is a fault rather than a size that every serve fails on at open.
- ESTALE (StaleNetworkFileHandle) is transient in the fs classifier and in
  the retry classifier.
- An outboard over its cap warns with the path or key, the length and the
  cap before it degrades to Unsupported, in the fs, http and s3 origins.
- The origin probe fault warn names the walk's last per-origin error, so a
  permanent fault shows at the default log level.
- The fs cap docs name BlobTooLargeMarker and CacheError::BlobTooLarge, and
  the unused path_for_log leaves the cap stream state.

tracing-subscriber joins the cache dev-dependencies for a log-capture test.

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

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 insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-code-quality

github-code-quality Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 034f8a7 claude/2631-2801-cap... 0d3117e +/-
77% 77% 0%
View coverage of the 10 most impacted files.
File main 034f8a7 claude/2631-2801-cap... 0d3117e +/-
crates/cache/src/origin/fs.rs 75% 73% -2%
crates/node/src...ent/dispatch.rs 87% 87% 0%
crates/client/s...undle/engine.rs 65% 65% 0%
crates/node/src/metrics.rs 92% 92% 0%
crates/cache/sr.../origin/http.rs 94% 94% 0%
crates/client/src/lib.rs 89% 90% +1%
crates/node/src...s/client/mod.rs 94% 95% +1%
crates/client/src/scheduler.rs 94% 95% +1%
crates/node/src/dht/publish.rs 78% 80% +2%
crates/cache/src/error.rs 93% 95% +2%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 01, 2026 22:22 UTC

yigitdot and others added 2 commits November 2, 2026 01:06
…bility-and-fs-origin-visibility-d75468

# Conflicts:
#	crates/node/src/handlers/client/mod.rs
…lity and doc fixes

From the PR #2815 review:

- probe_origin_chain keeps the first non-transient per-origin cause, so a
  later origin's transient fault cannot shadow the operator-actionable one
  in the memoise warn; a unit test pins the cause threading, the
  transient-only cause and the walk-ceiling cause.
- dangling_link logs its own probe errors at debug instead of silently
  keeping the absent answer.
- A test pins that a dangling .obao4 symlink is a permanent fault from
  fetch_outboard, never a silent Unsupported degrade.
- The size() comment no longer claims the open cannot block: the resolve
  rules out a FIFO already in place, and a swap after the stat is #2802.
- OriginPullError docs list StaleNetworkFileHandle as transient and the
  dangling symlink as permanent.
- The capability_expired docs (enum, counter, ADR row) say the split lives
  in the counter and the serve_stream span reason, not 'only' the counter;
  the intake-drop label doc calls itself the aggregate view, since each
  drop site also logs; the probe_hold_unavailable field doc edit shrinks
  to the one needed correction.
- ADR registry: capability_expired row sits in alphabetical order, the
  intake-drop row moves out of the serve_stream_rejected block, and 'Thus'
  becomes 'So'.

Co-Authored-By: Claude Fable 5 <[email protected]>
@thiras
thiras merged commit ecdf32c into main Nov 3, 2026
40 checks passed
@thiras
thiras deleted the claude/2631-2801-capability-and-fs-origin-visibility-d75468 branch November 3, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants