Skip to content

ADR 039 § Source set describes a client ranker that does not exist — DHT candidates, unified score, per-source reputation EWMA #1989

Closed

Description

@yigitdot

ADR 039 § "Source set and selection" (line 37) and § "Source diversity and reputation" (lines 63, 79-81, 136) describe client behaviour that is not implemented and, in one case, cannot be with the current dependency graph. Under the present-tense-canon rule this is a spec defect. Verified against main @ 8b437de.

Divergences

ADR 039 Code
:37 — candidate set is "the holders that cdn/dht/v1 FIND_VALUE returns" crates/client-pull/src/discovery.rs:354-382 reads the CapacityBond registry, or the peer store (crates/cli/src/commands/fetch.rs:717-763). The client never issues a DHT lookup.
:37 — admits "ranked by the unified selection score ... over rate, RTT, and reputation" fetch.rs:622 and :644 sort on rtt_ms.total_cmp alone. rate_per_mb enters only as an optional hard ceiling (--max-rate-per-mb, default 0 = off; crates/common/src/cli/fetch.rs:269-276), never as an ordering key.
:79-81 — "per-source outcomes feed the local reputation EWMA (ADR 008)"; :63, :136 — a verification failure "lowers the source's local reputation score" No client reputation exists. decdn-reputation is not a dependency of crates/cli or crates/client-pull (only crates/node links it). What exists is a latency EWMA (peer_store.rs:11, α 0.3, TTL 600 s) plus binary 300 s failure suppression (peer_store.rs:19). Probe-verification failures are deliberately unscored (fetch.rs:404-407).

Also wrong in code: the probe_and_order doc comment (fetch.rs:391-392) says selection reads rate_per_mb off the response. It does not — the value goes only into probed_samples (:509) for the store harvest.

Why the code is the considered position

  • ADR 037:29 makes RTT-only ranking deliberate for warming candidates (region is self-attested; measured RTT cannot be forged).
  • ADR 037:50 says price/reputation-aware client selection is "not required for correctness".
  • Drop aggregated reputation; make ADR 008 reputation local-only #1419 deliberately deleted the client-side reputation surfaces.

ADR 039 is the stale artifact, not the code.

Residual conflict to settle while editing

ADR 001 § Node Selection Algorithm says the unified score "is used in Content Discovery above and in all other node selection contexts". ADR 037:154 carves the client out. One of those sentences is wrong; the amendment should pick one.

Fix direction

Amend ADR 039 § "Source set and selection" and § "Source diversity and reputation" to describe the shipped client: registry/peer-store candidates, RTT-ordered, one-per-operator admission (admit_sources), latency EWMA + failure suppression as the only per-peer memory. Fix the fetch.rs:391-392 doc comment. Reconcile ADR 001 / ADR 037 on client applicability of the unified score. In-place edits, no tombstone text.

Activity

  1. added
    kind:docs
    design:consistency
    design:adr
    prio:medium
    area:cli
    on Sep 11, 2026
  2. moved this from Backlog to In progress in deCDNon Sep 11, 2026
  3. added a commit that references this issue on Sep 11, 2026
    a86535a
  4. moved this from In progress to Done in deCDNon Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clidesign:adrdesign:consistencykind:docsprio:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions