Repository navigation
fix(node): attribute every reputation outcome to its peer (#1987) - #2001
Merged
Merged
Conversation
`record_outcome` is the single choke point for local reputation writes. It now emits a `decdn::reputation` debug event carrying the peer, the outcome, and the post-fold score that `LocalReputation::record` already returned and the caller discarded. The probe-failure `Unreachable` line gains the peer id and the resolvable operator address, and the other scoring lines gain `peer` as a join key. The `node_pull_*` counters stay unlabeled: a peer-id label is unbounded cardinality and breaks the sibling-counter convention (#1475). The runbook names the `RUST_LOG=info,decdn::reputation=debug` filter that attributes a counter rise instead. Closes #1987 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013p4vAEc4scVHADBqA44K9j
There was a problem hiding this comment.
🟡 Changes recommended
RegionLatencyMismatch still records reputation directly, bypassing the required attribution event.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request adds per-peer debug attribution for node-origin reputation changes and documents the corresponding log filter.
Changes:
- Logs peer, outcome, and post-fold score details.
- Adds peer context to probe and pull failure handling.
- Documents the reputation logging filter and adds test coverage.
- A
RegionLatencyMismatchupdate still bypasses the attribution path.
File summaries
| File | Summary |
|---|---|
docs/runbook.md |
Documents per-peer reputation attribution. |
crates/node/src/node_origin/mod.rs |
Adds attribution logging, failure context, and tests; retains one direct reputation update that needs routing through record_outcome. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…tcome `probe_candidate` folded `RegionLatencyMismatch` into the local score directly, so that penalty skipped the `decdn::reputation` attribution event. It now goes through `record_outcome` like every other outcome. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013p4vAEc4scVHADBqA44K9j
A reload rebuilds the tracing filter from `observability.log_level` and drops any `RUST_LOG` per-target setting, so the runbook and the `REPUTATION_LOG_TARGET` doc now say to restart with `RUST_LOG` set. The wording narrows "every score change" to "every recorded outcome", since idle decay moves scores without an event, and `probe_candidate` lists the ADR 030 region penalty among its side effects. The test pins the target string the runbook quotes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013p4vAEc4scVHADBqA44K9j
Coverage reportTotal: 82.74% (was 82.86%, ▼ 0.12%) — 76995/93054 lines
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A failed probe or pull lowers a peer's local reputation score, but nothing recorded which peer took the hit. This PR adds that record.
record_outcomeis the single choke point for reputation writes. It now callsfold_outcome, which emitsdebug!(target: "decdn::reputation", peer, ?outcome, score).scoreis the post-fold value thatLocalReputation::recordalready returned; the caller used to discard it.probe_candidate): now carriespeerand the operator address when it resolves (provider_addris anOption).Unreachable): gainpeeras a join key.RUST_LOG=info,decdn::reputation=debug.debug!, notinfo!: a dead peer gets re-probed on every cache miss, so aninfo!per penalty would flood the default log. To investigate, watch the counter rise, then turn on that one log target.Deliberately not done
node_pull_*. A label keyed on peer id has no upper bound on the number of series, and it breaks the sibling-counter convention (metrics: decide whether the remaining reason-splits follow probe-hold onto {reason} labels #1475,adr/appendix-observability.md). The log target gives per-peer detail without a series per peer.scorefield answers "what is the peer's score now".Test plan
a_reputation_penalty_names_the_peer_and_its_new_score: captures the tracing output and checks the target,peer=, the outcome, and that the logged score matches the stored score. It also checks the aggregate counter.cargo nextest run -p decdn-node node_origin: 79 passedcargo nextest run -p decdn-node --test node_origin_pull: 66 passed-D warnings, fmt, rustdoc-D warnings, pre-commit hooksCloses #1987
🤖 Generated with Claude Code
https://claude.ai/code/session_013p4vAEc4scVHADBqA44K9j