Skip to content

feat(reputation): un-saturate the speed sub-score + half-life decay for large-file selection (#1658) - #1661

Merged
alpergundogdu merged 6 commits into
mainfrom
claude/node-economics-first-pull-99e5ae
Aug 12, 2026
Merged

alpergundogdu merged 6 commits into
mainfrom
claude/node-economics-first-pull-99e5ae

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #1658.

What & why

Node selection was blind to throughput above ~80 Mbps. Reputation's speed component was min(1, actual_bps / expected_bps) with an 80 Mbps baseline, so an 80 Mbps node and a 10 Gbps node both scored 1.0 — indistinguishable. For large-file delivery (the model-delivery wedge) transfer time is throughput-dominated (10 GB is ~1000 s at 80 Mbps vs ~8 s at 10 Gbps), so the score was optimizing the near-irrelevant variable (RTT) and blind to the one that matters.

This change stays inside crates/reputation (ADR 008) — the ADR 001 selection formula rate × rtt × (1/rep²) is untouched; speed still rides through the existing 1/rep² term.

Changes

  1. Log-normalize the speed sub-score — speed = clamp(ln(1+actual_bps) / ln(1+reference_bps), 0, 1), reference default 1 GiB/s. Throughput above the old baseline is no longer saturated: a materially faster node scores strictly higher. A normal 10 MiB/s node now converges to ~0.91 instead of trivially reaching 1.0; a ~1 GiB/s node reaches ~1.0.
  2. Half-life idle-score decay — replaces the fixed 10%/week decay with a configurable half-life (default 3 days; 0 disables). Sub-weekly recovery returns transiently-dinged nodes to selection in days and stops incumbents coasting on stale reputation — both widen the serving set and favour decentralization. Reachability failures ride this decay as ordinary negative samples (no hard crater).
  3. expected_bps → reference_bps rename (field, default const, error variant) to match the new log-reference semantics.
  4. ADR 008 amended to match; node top-up test recalibrated from the old linear derivation to the log curve.

Scope notes / decisions

  • Reachability = decay, not crater, and the 0.4/0.4/0.2 weights are unchanged — a deliberate "current model carries us, just retune" call rather than a structural gate.
  • Not here (deferred, tracked): operator TOML-configurability of these knobs (the fields are already library-configurable); the fluid/decaying-max speed reference; the BudgetPacer measurement confound; the size-aware transfer-time model. This is a single-source improvement and is not a prerequisite for multi-source (ADR 039: rewrite leaner as the single multi-source home, then implement the scheduler #1164), which measures per-source throughput live.

Verification

  • cargo nextest run -p decdn-reputation — 27/27 pass
  • cargo nextest run -p decdn-node a_slow_post_topup_delivery_scores_slow_not_instant — 1/1 pass (recalibrated; threshold 0.90 separates the honest 0.867 case from the bugged 0.932 case, derived from the log formula)
  • cargo clippy -p decdn-reputation -p decdn-node --all-targets — clean
  • cargo fmt -- --check — clean

🤖 Generated with Claude Code

alpergundogdu and others added 5 commits August 12, 2026 13:31
…urve + review nits (#1658)

The node reactive-topup speed regression still derived its threshold from
the retired linear speed curve. Recalibrate to the log-normalized curve,
preserving the test's intent (a throttled post-top-up delivery scores
meaningfully lower than a saturated one) and updating its stale doc-comment.
Also address the batch of final-review minors: remove an unreachable guard
in speed_score_from_bps, reword the SECONDS_PER_WEEK doc comment, fix a
stale idle-age test comment, and split two multi-clause ADR 008 sentences
for ASD-STE100.

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

coderabbitai Bot commented Aug 12, 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: 7f8f4722-fce9-4420-87db-bcdca85d33fe

📥 Commits

Reviewing files that changed from the base of the PR and between 40a12a4 and 5c5f6c8.

📒 Files selected for processing (4)
  • adr/008-reputation.md
  • crates/node/tests/node_origin_pull.rs
  • crates/reputation/src/interaction.rs
  • crates/reputation/src/local.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.

@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.44% (was 80.46%, ▼ 0.02%) — 62432/77610 lines

File Coverage Lines Δ
crates/reputation/src/interaction.rs 100.00% 56/56 ● 0.00%
crates/reputation/src/local.rs 98.93% 555/561 ▼ 0.06%
History
Commit Total Δ vs base
234848d 80.45% ▼ 0.01%
5c5f6c8 (HEAD) 80.44% ▼ 0.02%

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

Updates the in-crate reputation model (ADR 008) to better differentiate high-throughput peers for large-file delivery, and to decay stale scores on a sub-weekly timescale without changing the higher-level node-selection formula (ADR 001).

Changes:

  • Replace linear, baseline-saturating speed scoring with a log-normalized speed sub-score parameterized by reference_bps.
  • Replace fixed weekly decay with a configurable half-life idle-score decay (decay_half_life_secs, default 3 days; 0 disables).
  • Rename expected_bps → reference_bps, recalibrate tests, and update ADR 008 to match the new semantics.

Reviewed changes

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

File Description
crates/reputation/src/local.rs Renames speed baseline config to reference_bps and switches idle decay to half-life-based decay.
crates/reputation/src/interaction.rs Implements the log-normalized speed scoring function and updates unit tests for monotonicity/non-saturation vs. the old baseline.
crates/node/tests/node_origin_pull.rs Recalibrates the post-top-up delivery speed regression test to the new log speed curve and renamed config field.
adr/008-reputation.md Updates ADR 008 to document log speed normalization and half-life decay semantics/examples.

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

Comment thread crates/reputation/src/interaction.rs Resolved
@alpergundogdu
alpergundogdu merged commit 8661260 into main Aug 12, 2026
27 checks passed
@alpergundogdu
alpergundogdu deleted the claude/node-economics-first-pull-99e5ae branch August 17, 2026 17:47
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.

Un-saturate and tune the speed component of reputation for large-file selection

2 participants