refactor: inline single-use _zero_for_duplicate_penalty#870
Open
bitcompass wants to merge 2 commits intoentrius:testfrom
Open
refactor: inline single-use _zero_for_duplicate_penalty#870bitcompass wants to merge 2 commits intoentrius:testfrom
bitcompass wants to merge 2 commits intoentrius:testfrom
Conversation
…nd_penalize_miners_sharing_github
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
Inlines
_zero_for_duplicate_penaltyinto its single call site indetect_and_penalize_miners_sharing_github(gittensor/validator/oss_contributions/inspections.py) and removes the helper.
The helper existed for readability, but it had exactly one caller and the field-list lived behind a function jump. The function's own docstring already warned: "when adding new score-bearing fields to MinerEvaluation, update this function so the penalty stays comprehensive — a forgotten field would let a penalized miner retain partial credit in that dimension." Inlining makes that risk self-evident at code review time: adding a new score field to
MinerEvaluationnow lands next to the zeroing block in the same diff hunk.The reminder comment is preserved next to the inlined block.
No behavioural change. Same fields zeroed in the same order.
Related Issues
Fixes #869
Type of Change
Testing
The existing test
tests/validator/test_duplicate_penalty_propagation.pyexercisesdetect_and_penalize_miners_sharing_githubend-to-end and covers the zeroing block via its public entry point. No new tests areneeded because the refactor is mechanical (function body moved verbatim into the loop body); test surface and assertions are
unchanged.
Verified locally: