Skip to content

refactor: drop two dead knobs — min-reputation floor and trusted-IP rate-limit exemption - #1456

Merged
thiras merged 3 commits into
mainfrom
refactor/1438-1440-drop-dead-selection-ratelimit-knobs
Jul 24, 2026
Merged

thiras merged 3 commits into
mainfrom
refactor/1438-1440-drop-dead-selection-ratelimit-knobs

Conversation

@thiras

@thiras thiras commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Two removals from the Protocol simplifications milestone, batched because both are pure dead-knob deletions on the node side: no contract surface, no gas snapshot, no decdn-protocol public-API snapshot regen.

Net: 24 files, +55 / −518.

refactor(selection)! — remove the minimum-reputation rejection floor (#1438)

The floor was built ahead of its consumer. The sole production call site (node_origin.rs → rank_candidates) passed DEFAULT_MIN_REPUTATION = 0.0, which short-circuits filtering entirely, and nothing ever threaded a non-zero value from config, CLI, or the client fetch path — every _with_floor entry point was reached only from unit tests.

Poor-reputation nodes are still de-prioritized by the two mechanisms that ship and stay: the reputation² score amplification and the max(reputation, 0.1) denominator clamp (REPUTATION_FLOOR). Those are a different thing from the rejection floor despite sharing the word, and their tests are untouched.

  • selection.rs: drop DEFAULT_MIN_REPUTATION, apply_reputation_floor, rank_candidates_with_floor{,_and_rng}, top_n_with_floor; collapse rank_candidates onto rank_candidates_with_rng and top_n onto rank_candidates + truncate.
  • ADR 001: the subsection becomes a headless paragraph stating reputation is a graded weight with no veto. Headless on purpose — no anchor means the dangling-link rot fixed below cannot recur.
  • ADRs 037 and 039 both asserted a floor-filtered candidate pool and linked the removed anchor. These were not in the issue's blast radius. MD051 is disabled and make -C adr check-md-anchors only checks that a cross-link carries an anchor, never that it resolves, so both would have rotted silently.
  • client-pull/src/discovery.rs: drop the proxy_warming_order "Contract not yet enforced" block documenting the floor precondition ADR 037 no longer states.
  • CHANGELOG: the entry is deleted rather than replaced with a Removed one — the whole file is [Unreleased] and the entry itself says "no config/env/CLI knob yet", so nothing published and nothing adoptable.

Test coverage: the 12 floor tests go; the REPUTATION_FLOOR clamp tests and the four top_n_* tests stay. One genuine delta — that rank_candidates keeps a negative-reputation candidate rather than dropping it — is retained as rank_candidates_keeps_negative_reputation_candidate.

No behavior change: every production path already ran with the floor disabled.

refactor(config)! — remove the trusted-IP rate-limit exemption (#1440)

probe.rate_limit.trusted_ips / dht.rate_limit.trusted_ips let an operator punch a hole in the middle (per-IP) layer of the three-layer limiter for a curated IP list. Default empty; no config in the repo sets it.

It was weakest exactly where it was most likely to be used: on the probe path the always-on ConnectionLimiter per-source bucket (security.per_source_*, default 100/s) is not bypassed, so exempting an IP only moved its effective ceiling from 50/s to 100/s — a number the operator could have set directly. Raising per_ip_rate_per_sec / per_ip_burst gives the same relief, keeps the layer's invariant that every source IP is bounded, and leaves no standing allow-list to go stale as peer IPs change.

  • rate_limit.rs: field gone from RateLimitConfig + ThreeLayerRateLimiter, both From<&Resolved*> impls, the /64 mask-into-set in new(), and the per-IP bypass branch in try_admit_one.
  • Config: gone from Dht/ProbeRateLimitConfig and ResolvedDht/ResolvedProbe; parse_trusted_ips deleted.
  • One test is rewritten, not deleted. trusted_ip_exempts_per_ip_only was the only test pinning decdn_probe_rate_limit_rejected_per_ip_total, and the hand-written ProbeRateLimitMetrics::rejected match needs that guard against an arm swap. It survives as per_ip_rejection_drives_probe_per_ip_counter with the trusted half dropped. The 4 DHT exemption tests are safe to delete — per_ip_layer_masks_ipv6_to_slash_64 independently covers source_key /64 masking.

⚠️ BREAKING — config

Both structs use #[serde(deny_unknown_fields)], so a node whose TOML still sets either key now fails to load at startup and under decdn config validate rather than ignoring it. Deliberate: a silent ignore would leave the operator believing an exemption is still in force. Verified:

Error: failed to parse config file …: TOML parse error at line 2, column 1
  |
2 | trusted_ips = ["1.2.3.4"]
  | ^^^^^^^^^^^
unknown field `trusted_ips`, expected one of `per_peer_rate_per_sec`, …

Remove the key and raise per_ip_rate_per_sec / per_ip_burst if the headroom was actually needed. No CHANGELOG entry — the key never shipped in a tagged release.

Verification

All green locally:

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets (clean; --all-targets was needed to catch three now-unused #[cfg(test)]-gated HashSet imports)
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • cargo nextest run --workspace — 2552 passed, 0 failed
  • cargo test --doc --workspace
  • make -C adr check-book-list check-bare-refs check-md-anchors check-no-section-numbers
  • grep -rn "minimum-reputation-rejection-floor" adr/ → empty (the anchor check above cannot catch this)
  • pre-commit run --all-files via the commit hooks
  • Behavioral: a stale trusted_ips key rejects as shown above; decdn config init output still parses with both [*.rate_limit] sections intact.

Not run, and not needed: contracts / anvil-e2e (no contracts/** change) and the public-api snapshot job (decdn-protocol untouched).

Notes for review

Closes #1438
Closes #1440

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changes
    • Removed trusted-IP exemptions from DHT and probe rate limiting; all applicable traffic now follows the standard layered quotas.
    • Removed related configuration fields and generated configuration entries.
    • Reputation now influences node ranking without excluding candidates through a minimum threshold.
    • Candidate discovery and multi-source fetching evaluate the full eligible holder pool.
    • Added observability for probe rate-limit rejections by enforcement layer.
    • Updated operator documentation, configuration guidance, and tests to reflect these behaviors.

thiras and others added 2 commits July 24, 2026 21:45
…floor

The floor was built ahead of any consumer: the sole production call site
(`node_origin.rs` -> `rank_candidates`) passed `DEFAULT_MIN_REPUTATION = 0.0`,
which short-circuits filtering entirely, and no config, CLI, or client path
ever threaded a non-zero value. Every `_with_floor` entry point was exercised
only by unit tests.

Poor-reputation nodes are still de-prioritized by the two mechanisms that ship
and stay: the `reputation^2` score amplification and the `max(reputation, 0.1)`
denominator clamp (`REPUTATION_FLOOR`), which are unrelated to the rejection
floor despite the shared word.

* selection.rs: drop `DEFAULT_MIN_REPUTATION`, `apply_reputation_floor`,
  `rank_candidates_with_floor{,_and_rng}`, `top_n_with_floor`; collapse
  `rank_candidates` onto `rank_candidates_with_rng` and `top_n` onto
  `rank_candidates` + truncate.
* Drop the 12 floor-specific tests, keeping the distinct `REPUTATION_FLOOR`
  clamp tests. The one real coverage delta — that `rank_candidates` keeps a
  negative-reputation candidate rather than dropping it — is retained as
  `rank_candidates_keeps_negative_reputation_candidate`.
* ADR 001: replace the subsection with a headless paragraph stating reputation
  is a graded weight with no veto. Headless on purpose — no anchor means the
  dangling-link rot this commit cleans up cannot recur.
* ADRs 037 and 039 both asserted a floor-filtered candidate pool and linked the
  removed anchor; drop both clauses. `MD051` is disabled and `check-md-anchors`
  does not resolve fragments, so these would have rotted silently.
* discovery.rs: drop the `proxy_warming_order` "Contract not yet enforced" block
  documenting the floor precondition ADR 037 no longer states.
* CHANGELOG: delete the entry rather than adding a Removed one — the whole file
  is `[Unreleased]` and the entry itself says "no config/env/CLI knob yet".

No behavior change: every production path already ran with the floor disabled.

Closes #1438

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`probe.rate_limit.trusted_ips` and `dht.rate_limit.trusted_ips` let an operator
punch a hole in the middle (per-IP) layer of the three-layer token-bucket
limiter for a curated IP list. The default is empty and no config in the repo
sets it, so this removes surface rather than behavior.

The knob was also weakest exactly where it was most likely to be used: on the
probe path the always-on `ConnectionLimiter` per-source bucket
(`security.per_source_*`, default 100/s) is NOT bypassed, so exempting an IP
only moved its effective ceiling from 50/s to 100/s — a number the operator
could have set directly. Raising `per_ip_rate_per_sec` / `per_ip_burst` gives
the same relief while keeping the layer's invariant that every source IP is
bounded, and leaves no standing allow-list to go stale as peer IPs change.

* rate_limit.rs: drop the field from `RateLimitConfig` and
  `ThreeLayerRateLimiter`, both `From<&Resolved*>` impls, the /64 mask-into-set
  in `new()`, and the per-IP bypass branch in `try_admit_one` — the per-IP layer
  now always charges when an IP key is present.
* Config: drop the key from `Dht`/`ProbeRateLimitConfig` and `ResolvedDht`/
  `ResolvedProbe`, and delete the `parse_trusted_ips` resolver helper.
* Delete the 4 DHT exemption tests and the 2 resolver tests. On the probe side
  `trusted_ip_exempts_per_ip_only` is REWRITTEN, not deleted, as
  `per_ip_rejection_drives_probe_per_ip_counter`: it was the only test pinning
  `decdn_probe_rate_limit_rejected_per_ip_total`, and the hand-written
  `ProbeRateLimitMetrics::rejected` match needs that guard against an arm swap.
* Drop the two commented rows from the `decdn config init` template and the two
  ADR paragraphs (005 §Probe rate limiting, 022 §DHT Rate Limiting).

BREAKING CHANGE: both config structs use `#[serde(deny_unknown_fields)]`, so a
node whose TOML still sets `dht.rate_limit.trusted_ips` or
`probe.rate_limit.trusted_ips` now fails to load at startup and under
`decdn config validate` rather than ignoring the key. This is deliberate — a
silent ignore would leave the operator believing an exemption is still in force.
Remove the key and raise `per_ip_rate_per_sec` / `per_ip_burst` if the headroom
was actually needed.

Closes #1440

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 18:57
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 41 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: 7f2d264d-f98b-488f-a2dc-713dbd071c84

📥 Commits

Reviewing files that changed from the base of the PR and between 49f6370 and 3b8dac6.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • adr/037-regional-proxy-warming.md
  • adr/039-multi-source-parallel-fetch.md
  • crates/common/src/config/mod.rs
  • crates/common/src/config/resolved.rs
  • crates/node/src/rate_limit.rs
  • crates/node/src/selection.rs

Walkthrough

The change removes minimum-reputation filtering from default node selection and eliminates trusted-IP exemptions from DHT and probe rate limiting. Configuration schemas, resolved settings, limiter logic, tests, runtime notices, ADRs, and generated config templates are updated accordingly.

Changes

Selection policy

Layer / File(s) Summary
Remove reputation-floor selection
crates/node/src/selection.rs, adr/001-network.md, adr/037-regional-proxy-warming.md, adr/039-multi-source-parallel-fetch.md, CHANGELOG.md, crates/client-pull/src/discovery.rs
Default ranking retains negative-reputation candidates, and selection documentation no longer describes reputation-floor filtering.

Rate-limit configuration

Layer / File(s) Summary
Remove trusted-IP configuration
crates/common/src/config/{types.rs,resolved.rs,mod.rs}, crates/cli/src/commands/config.rs, crates/node/src/runtime/reload.rs
DHT and probe rate-limit schemas, resolved structures, defaults, resolvers, templates, and restart notices no longer expose trusted_ips.

Limiter behavior

Layer / File(s) Summary
Enforce per-IP limiting without exemptions
crates/node/src/rate_limit.rs, crates/node/src/dht/rate_limit.rs, crates/node/src/handlers/{probe.rs,probe_rate_limit.rs}
The shared limiter removes trusted-IP state and checks the per-IP layer whenever an IP key exists; tests now cover per-IP rejection metrics and remaining limiter behavior.

Protocol and integration alignment

Layer / File(s) Summary
Update protocol records and fixtures
adr/005-protocol.md, adr/022-content-discovery.md, crates/node/tests/{dht_*,probe_*,self_hosted_discovery.rs}
Protocol records remove trusted-IP exemption text, probe observability records layer-specific rejection metrics, and integration helpers stop initializing the removed field.

Estimated code review effort: 3 (Moderate) | ~25 minutes


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 two unused/dead operator/client “knobs” in the node codebase and reconciles the surrounding docs/tests accordingly: (1) the minimum-reputation rejection floor in node selection, and (2) the trusted-IP exemption that bypassed only the per-IP tier of the probe/DHT three-layer rate limiter. It simplifies selection and rate-limiting surfaces without changing any production behavior that was previously reachable.

Changes:

  • Remove the minimum-reputation rejection floor APIs from crates/node/src/selection.rs and keep only the graded reputation weighting/clamp behavior.
  • Remove trusted_ips from probe/DHT rate limit config + limiter engine, including resolver plumbing and tests.
  • Update ADRs, CLI default config template, and changelog/docs to remove now-invalid references/anchors.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/node/src/selection.rs Deletes min-reputation floor filtering APIs/tests; keeps ranking + clamp semantics.
crates/node/src/rate_limit.rs Removes trusted-IP bypass field and per-IP exemption branch from the shared limiter engine.
crates/common/src/config/types.rs Drops trusted_ips from config types and removes ADR references to that knob.
crates/common/src/config/resolved.rs Drops resolved trusted_ips sets from ResolvedDht/ResolvedProbe.
crates/common/src/config/mod.rs Removes trusted-IP parsing/validation and wiring into resolved configs + tests.
crates/node/src/handlers/probe.rs Updates probe handler docs to reflect no trusted-IP exemption.
crates/node/src/handlers/probe_rate_limit.rs Updates wrapper docs and rewrites the per-IP rejection metrics guard test without trusted IPs.
crates/node/src/dht/rate_limit.rs Updates wrapper docs and deletes trusted-IP-specific tests/fixtures.
crates/node/src/runtime/reload.rs Updates hot-reload warning text to remove trusted-IP mention for DHT rate-limit sections.
crates/client-pull/src/discovery.rs Removes stale “contract not yet enforced” note tied to the removed reputation floor.
crates/cli/src/commands/config.rs Removes commented trusted_ips lines from the generated default config template.
crates/node/tests/self_hosted_discovery.rs Updates permissive probe rate limiter test config to remove trusted_ips.
crates/node/tests/probe_loopback.rs Updates permissive probe rate limiter test configs to remove trusted_ips.
crates/node/tests/probe_0rtt.rs Updates permissive probe rate limiter test config to remove trusted_ips.
crates/node/tests/dht_loopback.rs Updates permissive DHT rate limiter test configs/comments to remove trusted_ips.
crates/node/tests/dht_lookup.rs Updates permissive DHT rate limiter test config to remove trusted_ips.
crates/node/tests/dht_integration.rs Updates permissive DHT rate limiter test config to remove trusted_ips.
crates/node/tests/dht_bootstrap.rs Updates permissive DHT rate limiter test config to remove trusted_ips.
CHANGELOG.md Removes unreleased changelog entry describing the (now-removed) min-reputation floor APIs.
adr/001-network.md Replaces the min-reputation rejection-floor subsection with a headless paragraph clarifying reputation is not a veto.
adr/005-protocol.md Removes the probe-side trusted-IP exemption paragraph.
adr/022-content-discovery.md Removes the DHT-side trusted-IP exemption paragraph.
adr/037-regional-proxy-warming.md Removes references/link to the removed min-reputation floor anchor.
adr/039-multi-source-parallel-fetch.md Removes references/link to the removed min-reputation floor anchor.

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

@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.07% (was 81.07%, ▼ 0.01%) — 52383/64616 lines

File Coverage Lines Δ
crates/cli/src/commands/config.rs 74.68% 233/312 ● 0.00%
crates/client-pull/src/discovery.rs 96.38% 718/745 ● 0.00%
crates/common/src/config/mod.rs 97.03% 6818/7027 ▲ +0.03%
crates/common/src/config/resolved.rs 100.00% 33/33 ● 0.00%
crates/node/src/dht/rate_limit.rs 100.00% 483/483 ● 0.00%
crates/node/src/handlers/probe.rs 87.59% 254/290 ● 0.00%
crates/node/src/handlers/probe_rate_limit.rs 78.95% 90/114 ▼ 0.88%
crates/node/src/rate_limit.rs 85.15% 195/229 ▲ +0.28%
crates/node/src/runtime/reload.rs 96.63% 1663/1721 ● 0.00%
crates/node/src/selection.rs 97.39% 447/459 ▼ 0.53%
History
Commit Total Δ vs base
49f6370 81.08% ▲ +0.01%
3b8dac6 (HEAD) 81.07% ▼ 0.01%

Five reviewers swept the branch. The mechanical removals verified clean —
both "no behavior change" claims were confirmed by hand-tracing, and the
`try_admit_one` rewrite turns out to strictly *widen* `maybe_prune_per_ip`
(a trusted IP previously skipped the prune, a latent keyspace gap). What
they found was survivors: prose the deletion missed because it carried no
markdown link for the anchor-driven sweep to catch.

* ADR 037 acceptance criterion 2 and ADR 039 lines 57, 102, 117 still
  required, credited, or gated on the removed reputation floor. AC 2 and
  ADR 039's AC 1 are normative, so both ADRs mandated a mechanism ADR 001
  now explicitly denies. ADR 039's "selection floor" becomes "admissible",
  matching the term already used in its source-selection paragraph.
* `resolve_dht_into`'s doc still promised "trusted IPs are parsed once at
  resolution; malformed entries fail fast under the bag pattern". The probe
  twin was fixed; the DHT one was missed — and `resolve_probe_into` says
  "Mirrors `resolve_dht_into`", pointing readers straight at it.
* CHANGELOG: add the `### Changed (BREAKING)` entry for the config-breaking
  removal, per the file's own convention (line 14) and the `gossip.allowlist`
  precedent. The prior call to omit it was wrong: the startup failure is
  operator-visible regardless of whether the key was ever changelogged, and
  `decdn config init` shipped `# trusted_ips = []` in its template, so anyone
  who uncommented it has a node that no longer boots. The migration text was
  in the commit body — i.e. only in git history, not the operator artifact.
* `rate_limit.rs`: the "lets the compiler catch a field transposition" claim
  is false — all eight remaining fields are `f64`/`u32`/`usize`, so any
  same-typed swap compiles. Corrected to what the literals actually buy
  (arity), with the real gap tracked in #1457; a `per_peer`/`per_ip` swap in
  the probe impl would loosen an unauthenticated cap from 5 to 50 req/s.
* `ResolvedDht`: restore an invariant sentence covering the validation that
  survived. The removed trusted-IP clause was the only place the type doc
  claimed any resolver guarantee.
* `selection.rs`: add `score_nan_reputation_clamps_to_floor`. The deleted
  floor tests were the only NaN-reputation coverage, and `compute_score`
  silently depends on `f32::max` implementing IEEE `maxNum` (ignores NaN).
  A "cleanup" to `.clamp()` would propagate NaN, which `total_cmp` sorts
  last and `tie_group_end` then sweeps into the preceding tie group — a
  garbage candidate winning a tie-break tier. Mutation-checked: the test
  fails against `.clamp(REPUTATION_FLOOR, 1.0)` and passes as written.
* `top_n`: its doc advised `n = MAX_PROVIDER_ATTEMPTS` for the fetch path,
  which is what #1165 fixed — that budget is fetch-wide, not per-list, and
  `node_origin`'s ranker deliberately does not truncate.

Follow-ups filed rather than widening a deletion PR: #1457 (From-impl
transposition tests), #1458 (reputation has no upper bound; `f32::INFINITY`
wins unconditionally), #1459 (`Some(0)` stake outranks `None` at tie-break
tier 2, contradicting its own comment).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@thiras

thiras commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Review pass applied — 3b8dac63

Ran a five-agent review (general, tests, comments, error-handling, type-design). Both "no behavior change" claims were confirmed by hand-tracing, so the core removals stand as described:

  • try_admit_one: with an empty set !contains was always true, so the unconditional form is equivalent. One bonus — maybe_prune_per_ip was inside the removed wrapper, so this strictly widens pruning; a trusted IP previously skipped the prune entirely, a latent keyspace gap this closes.
  • rank_candidates / top_n: rand::rng() is created the same number of times on both paths, so tie-break determinism is untouched. apply_reputation_floor early-returned unmodified at <= 0.0.
  • Reload path checked end-to-end: load_file_config is the first statement of RuntimeReloadState::reload, before the lock and before any state is touched. A stale-key parse error aborts with the full message via both SIGHUP and the admin RPC — no silent no-op, and warn_ignored("dht.* (rate-limit)") is unreachable in that scenario so it can't mask the real error.

Fixed in this push

Stragglers the anchor-driven sweep missed — all plain prose with no markdown link, which is exactly why they survived:

  • adr/037:163 — acceptance criterion 2 still required "measured RTT and the reputation floor". Normative, and it contradicted both ADR 001 as rewritten here and its own "Ranking key is measured RTT only" bullet.
  • adr/039:102 — Risks section credited the floor as a live eclipse mitigation, understating residual risk.
  • adr/039:57, :117 — "clear the selection floor", including in AC 1, leaving a term defined nowhere. Now "admissible", matching the wording already used in that ADR's source-selection paragraph.
  • crates/common/src/config/mod.rs — resolve_dht_into's doc still promised "trusted IPs are parsed once at resolution; malformed entries fail fast". I fixed the probe twin and missed the DHT one — and resolve_probe_into says "Mirrors resolve_dht_into", pointing readers right at it.

CHANGELOG — added the ### Changed (BREAKING) entry. My earlier call to omit it was wrong. The file's own convention (line 14) says config-breaking changes name the field, there's an exact gossip.allowlist precedent at :388, and the migration text existed only in a commit body. The at-risk population is real: decdn config init shipped # trusted_ips = [] as a template row, so anyone who uncommented it now has a node that won't boot.

rate_limit.rs — the "lets the compiler catch a field transposition" comment is false now that all eight fields are f64/u32/usize. Corrected to what the exhaustive literals actually buy (arity), with the real gap tracked separately.

selection.rs — added score_nan_reputation_clamps_to_floor. The deleted floor tests were the only NaN-reputation coverage, and compute_score silently depends on f32::max implementing IEEE maxNum (ignores NaN). A "cleanup" to .clamp() propagates NaN → total_cmp sorts it last → tie_group_end sweeps it into the preceding tie group → a garbage candidate can win a tie-break tier. Mutation-checked: the test fails against .clamp(REPUTATION_FLOOR, 1.0) and passes as written. Also fixed top_n's doc, which advised n = MAX_PROVIDER_ATTEMPTS — the thing #1165 fixed, since that budget is fetch-wide, not per-list.

ResolvedDht — restored an invariant sentence for the validation that survived; the removed trusted-IP clause was the only resolver guarantee the type doc stated.

Deliberately deferred, not widening a deletion PR

Reviewers also raised top_n being pub with zero non-test callers. Leaving it: it's pre-existing, and pub(crate) with only #[cfg(test)] callers would trip dead_code in release builds. Its doc now says what not to use it for.

Verification after the fixes: cargo nextest run --workspace 2553 passed / 0 failed (+1 for the new test), clippy --all-targets clean, rustdoc -D warnings --document-private-items clean, all four ADR make-checks, pre-commit green. The previous push was already fully green in CI including both anvil e2e suites.

@thiras
thiras merged commit 19a3964 into main Jul 24, 2026
24 checks passed
@thiras
thiras deleted the refactor/1438-1440-drop-dead-selection-ratelimit-knobs branch July 24, 2026 20:49
thiras pushed a commit that referenced this pull request Jul 25, 2026
…hive

Rebased onto main after #1456 landed the min-reputation rejection-floor
removal (#1438). The code removal, ADR 001's headless "graded weight, not a
veto" paragraph, ADR 037's candidate-pool wording, and the CHANGELOG entry
are all already on main and are dropped from this branch. What remains is
the two stale-reference sites #1456 did not cover.

- ADR 039 § Source set and selection: the floor was the only path by which
  reputation entered multi-source admission, so removing it left the
  admitted set ranked on RTT and rate alone — contradicting this ADR's own
  Cross-ADR Impact entry, which states selection uses the same RTT, price,
  reputation, and diversity inputs as ADR 001. Rank by the ADR 001 unified
  selection score instead, which carries reputation as the graded weight
  the removal keeps. #1456 removed the floor clause from this sentence but
  left "preferring lower RTT and lower rate" in its place.
- adr/_history/alternatives-pre-launch.md: two rejected-alternative entries
  cited "ADR 008's hard floor" / "ADR 008's hard reputation floor" as the
  thing a collusive-reporting vector would attack. No such floor exists —
  ADR 008 § Score Decay pins the minimum score at 0.0, with the selection
  algorithm clamping the denominator at 0.1. Cite the weighting instead.
  The rejections themselves are unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
thiras pushed a commit that referenced this pull request Jul 25, 2026
… vector

Rebased onto main after #1456 landed the min-reputation rejection-floor
removal (#1438). The code removal, ADR 001's "graded weight, not a veto"
paragraph, ADR 037's candidate-pool wording, and the CHANGELOG entry are all
already on main and are dropped from this branch. What remains are the stale
reference sites #1456 did not cover, plus one #1418 left behind.

ADR 039 § Source set and selection. The floor was the only path by which
reputation entered multi-source admission. #1456 removed the floor clause but
left "preferring lower RTT and lower rate" in its place, so the admitted set
ranked on RTT and rate alone — contradicting this ADR's own Cross-ADR Impact
entry, which states selection uses the same RTT, price, reputation, and
diversity inputs as ADR 001. Cite ADR 001's unified selection score instead
(its own term, defined at ADR 001 § Node Selection Algorithm), which carries
reputation as the graded weight the removal keeps. Citing the formula rather
than paraphrasing it also removes a standing rot vector: the old wording was
already a lossy restatement that silently dropped reputation, wrong against
ADR 001 even before #1456.

The collusive-reporting vector no longer exists. Two rejected-alternative
entries in adr/_history/alternatives-pre-launch.md and one live paragraph in
adr/appendix-blob-cache-eviction.md argued that coupling reputation to
eviction "creates a collusive-reporting vector". That vector was a coalition
sending negative ReputationReport messages to push a competitor below an
eviction threshold — and #1418 deleted ReputationReport, the cdn/reputation/v1
topic, and all cross-node aggregation. Reputation is local-only; no peer can
move another node's score, so the premise is gone. #1418 removed the argument
from appendix-peer-table-eviction.md but missed its two archive compressions
and the parallel claim in appendix-blob-cache-eviction.md, which it never
touched. Drop the clause in all three places, leaving the two rationales the
live appendix still states (conflates discovery with selection; reputation is
noisy in the tail). The rejections themselves are unchanged.

Docs only. Not fixed here: "admissible" at ADR 039 §§ 25/55/116 lost its
definition when #1456 removed the floor it referred to, and the archive's
bare section refs (§1, §3, §4, §6-§11) predate #610 dropping ADR section
numbering — both pre-existing and wider than this change.

Co-Authored-By: Claude Opus 5 <[email protected]>
thiras pushed a commit that referenced this pull request Jul 25, 2026
… vector (#1452)

Rebased onto main after #1456 landed the min-reputation rejection-floor
removal (#1438). The code removal, ADR 001's "graded weight, not a veto"
paragraph, ADR 037's candidate-pool wording, and the CHANGELOG entry are all
already on main and are dropped from this branch. What remains are the stale
reference sites #1456 did not cover, plus one #1418 left behind.

ADR 039 § Source set and selection. The floor was the only path by which
reputation entered multi-source admission. #1456 removed the floor clause but
left "preferring lower RTT and lower rate" in its place, so the admitted set
ranked on RTT and rate alone — contradicting this ADR's own Cross-ADR Impact
entry, which states selection uses the same RTT, price, reputation, and
diversity inputs as ADR 001. Cite ADR 001's unified selection score instead
(its own term, defined at ADR 001 § Node Selection Algorithm), which carries
reputation as the graded weight the removal keeps. Citing the formula rather
than paraphrasing it also removes a standing rot vector: the old wording was
already a lossy restatement that silently dropped reputation, wrong against
ADR 001 even before #1456.

The collusive-reporting vector no longer exists. Two rejected-alternative
entries in adr/_history/alternatives-pre-launch.md and one live paragraph in
adr/appendix-blob-cache-eviction.md argued that coupling reputation to
eviction "creates a collusive-reporting vector". That vector was a coalition
sending negative ReputationReport messages to push a competitor below an
eviction threshold — and #1418 deleted ReputationReport, the cdn/reputation/v1
topic, and all cross-node aggregation. Reputation is local-only; no peer can
move another node's score, so the premise is gone. #1418 removed the argument
from appendix-peer-table-eviction.md but missed its two archive compressions
and the parallel claim in appendix-blob-cache-eviction.md, which it never
touched. Drop the clause in all three places, leaving the two rationales the
live appendix still states (conflates discovery with selection; reputation is
noisy in the tail). The rejections themselves are unchanged.

Docs only. Not fixed here: "admissible" at ADR 039 §§ 25/55/116 lost its
definition when #1456 removed the floor it referred to, and the archive's
bare section refs (§1, §3, §4, §6-§11) predate #610 dropping ADR section
numbering — both pre-existing and wider than this change.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

Remove the trusted-IP rate-limit exemption (ADR 005/022) Remove the min-reputation rejection floor (ADR 001)

2 participants