fix(engine): dedupe provider signals per target in computeProviderTrackRecords - #8954
Conversation
…ckRecords The aggregation loop iterated the raw signals array, incrementing signals/decided/shared/consensus once per signal rather than once per distinct (provider, targetKey) pair. Because loadLiveProviderTrackRecords reads raw audit rows with no dedup, a provider re-reviewing the same PR (common after a new push) had its precision/agreement stats inflated proportionally to its revote count, while its consensus stance reflected only the last vote. Dedupe to one signal per (provider, targetKey) pair with latest-vote-wins -- reusing the same last-write semantics the stancesByTarget map already applies -- before the aggregation loop, so each distinct pair contributes exactly once. Adds a test asserting two same-provider votes on one target contribute once to signals/decided/consensus, on both the engine's own suite and the Codecov-graded vitest suite. Closes JSONbored#8876
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8954 +/- ##
==========================================
+ Coverage 90.56% 93.87% +3.31%
==========================================
Files 96 807 +711
Lines 22490 80439 +57949
Branches 3884 24388 +20504
==========================================
+ Hits 20367 75509 +55142
- Misses 1945 3561 +1616
- Partials 178 1369 +1191
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 14:40:38 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Held for manual review: the gate and required CI are green, but GitHub reports this pull request's mergeable state as |
What & why
Closes #8876.
packages/loopover-engine/src/calibration/provider-track-record.ts'scomputeProviderTrackRecordsbuilt a
stancesByTargetmap that collapses a provider's multiple signals on onetargetKeyto thelatest vote, but the aggregation loop iterated the raw
signalsarray — incrementingsignals/decided/shared/consensusonce per signal instead of once per distinct(provider, targetKey)pair. SinceloadLiveProviderTrackRecordsreads raw audit rows with no dedup,a provider re-reviewing the same PR (common after a new push) had its precision/agreement stats
inflated proportionally to its revote count, while its consensus stance reflected only the last vote.
Change
Dedupe to one signal per
(provider, targetKey)pair with latest-vote-wins — the same last-writesemantics
stancesByTargetalready applies — before the aggregation loop, so each distinct paircontributes exactly once.
Validation
pass+ laterfailon one target contributessignals: 1(not 2), resolving to the latest
fail(so precision stays 1), while distinct pairs still eachcount — on both the engine's own suite and the Codecov-graded vitest suite.
in both runners.