Skip to content

refactor(incentive): remove unenforceable client-reputation ledger (#1552) - #1606

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/client-reputation-cleanup-1552-090f87
Aug 5, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/client-reputation-cleanup-1552-090f87

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #1552.

The triage for #1552 scoped the fix as wiring the ADR 003 client-reputation ledger into the cdn/client/v1 admission path. This PR does the opposite — it removes the ledger — because the admission control does not earn its place.

Why remove instead of wire in

  • The threat is already bounded mechanically, per-channel. Voucher-withholding / abandoning-client loss is capped at one credit window per encounter by the self-enforcing pause plus the seller-side pre-flight deposit guard (ADR 037 / node: cache-miss pull-through pays upstream for the entire blob before collecting any downstream voucher #856 / serve: hoist a pre-spend deposit check above the buffered/range/local fill tiers #1519). A node never fronts more than one window against a channel, and refuses a channel that cannot cover it. An accumulating cross-connection ledger adds nothing to a bound that already holds on the first byte.
  • It is unenforceable. Reputation keyed to channel.client accumulates against a wallet address; wallets are free, so a client at its reject threshold opens a fresh channel from a new key and resets. It only taxes clients too naive to rotate.
  • The client already pays to misbehave. Every openChannel locks USDC and costs gas — no free credit facility. An abandoning client has already sunk its deposit and downstream bandwidth; there is nothing left to deter.
  • It risks mis-punishing honest resumes. A crashed client reconnecting is indistinguishable from a withholder. Correct behavior is to resume on the same channel under the same window (bytes already pulled, served from cache) — what the channel-bound pause already does and what a client-bound penalty would get wrong.

Changes

  • Delete crates/incentive/src/client_reputation.rs (1603 lines — no constructor, no consumer; only the lib.rs re-exports referenced it) and its exports.
  • ADR 003 §Voucher withholding — state the mechanism explicitly: the pause is per-channel, waits for the next higher-nonce voucher on the same channel, is resume-safe, and accumulates no cross-connection history.
  • ADR 003 §Corrupted delivery — drop the client-reputation acceptance-policy framing. Node-selection reputation is untouched (separate, legitimate signal).

Verification

  • cargo build / cargo clippy clean across incentive, node, cli.
  • Repo-wide sweep: zero remaining ClientReputation / client_reputation references outside adr/_history/.
  • All pre-commit hooks pass (ADR reference hygiene, clippy, fmt, deny).

🤖 Generated with Claude Code

…1552)

The ADR 003 client-reputation ledger was dead code — no constructor,
no consumer, only the lib.rs re-exports. Rather than wire it into the
cdn/client/v1 admission path, remove it: the abandoning-client threat
it guarded is already bounded to one credit window per encounter by the
self-enforcing pause and the seller-side pre-flight deposit guard
(ADR 037 / #856), the bound is per-channel so a new wallet defeats any
accumulated penalty, and the client already sinks its USDC deposit on
openChannel with no free credit facility. A client-bound penalty would
also mis-punish an honest crashed client resuming a stream.

- delete crates/incentive/src/client_reputation.rs and its lib.rs exports
- ADR 003 §Voucher withholding: state the channel-bound, resume-safe
  self-enforcing pause explicitly (next higher-nonce voucher on the same
  channel; no cross-connection accumulation)
- ADR 003 §Corrupted delivery: drop the client-reputation acceptance
  policy framing; node-selection reputation is unchanged

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 5, 2026 09:54
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@alpergundogdu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 24728e7f-d7d2-43b9-920f-3a3237c69b5b

📥 Commits

Reviewing files that changed from the base of the PR and between d3e13fc and b3f7a44.

📒 Files selected for processing (3)
  • adr/003-payments.md
  • crates/incentive/src/client_reputation.rs
  • crates/incentive/src/lib.rs

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

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 removes the unused/unenforceable client-reputation ledger from the decdn-incentive crate and updates ADR 003 to document the current, per-channel mechanical bounding behavior for voucher withholding and corruption scenarios.

Changes:

  • Remove the client_reputation module and all public re-exports from crates/incentive.
  • Delete the (previously dead-code) ClientReputation* ledger implementation.
  • Update ADR 003 to describe the per-channel credit-window pause as the bounding mechanism, and drop the client-reputation framing for corrupted delivery.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/incentive/src/lib.rs Removes client_reputation module declaration and re-exports.
crates/incentive/src/client_reputation.rs Deletes the unused client-reputation ledger implementation.
adr/003-payments.md Updates threat-model text to reflect per-channel mechanical bounds and removes client-reputation admission framing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread adr/003-payments.md Resolved
@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.26% (was 80.47%, ▼ 0.21%) — 57087/71130 lines

File Coverage Lines Δ
crates/incentive/src/client_reputation.rs — — deleted
History
Commit Total Δ vs base
a5bdfa2 80.26% ▼ 0.21%
b3f7a44 (HEAD) 80.26% ▼ 0.21%

Copilot review on #1606: the "bytes already pulled are served from
cache, not re-fetched" claim overstates. On the cache-miss window
pull-through path a downstream drop calls abandon_window_serve →
tee.abandon() (crates/node/src/handlers/client/window.rs:851), dropping
the partial fill, so a reconnect re-pulls upstream. Only the direct-serve
path resumes from the store. Reword to state the client is not penalized
(pays only vouchered bytes, no accumulated black mark) without claiming
zero re-fetch; the node's per-window cost bound is unchanged either way.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu merged commit 2cafa4a into main Aug 5, 2026
24 checks passed
@alpergundogdu
alpergundogdu deleted the claude/client-reputation-cleanup-1552-090f87 branch August 5, 2026 10:02
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.

incentive: ADR 003 client-reputation admission control is dead code — #317 follow-up never landed

2 participants