fix(cli): emit consensus_threshold=0 in vote list JSON when whitelist is empty#828
Open
ebios-star wants to merge 1 commit intoentrius:testfrom
Open
fix(cli): emit consensus_threshold=0 in vote list JSON when whitelist is empty#828ebios-star wants to merge 1 commit intoentrius:testfrom
ebios-star wants to merge 1 commit intoentrius:testfrom
Conversation
… is empty
`gitt vote list --json` (cli/issue_commands/vote.py:248-249) computed
`required = (n // 2) + 1` unconditionally, so an empty validator
whitelist produced `{"count": 0, "consensus_threshold": 1}` — a
1-of-0 threshold that cannot be satisfied by any integer vote count.
Guard the calculation so `consensus_threshold == 0` when no validators
are whitelisted. JSON consumers (dashboards, monitoring scripts) can
now detect the empty-whitelist edge case from the field directly. The
human-mode branch already handles the empty case via the
"No validators whitelisted." path and stays unchanged.
Closes entrius#753.
Contributor
Author
|
@anderdc @LandynDev — friendly ping for review when you have a moment. Closes #753. When the validator whitelist is empty, Happy to rebase if needed. |
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
Closes #753.
`gitt vote list --json` (cli/issue_commands/vote.py:248-249) computed `required = (n // 2) + 1` unconditionally, so an empty validator whitelist produced `{"count": 0, "consensus_threshold": 1}` — a 1-of-0 threshold that no integer vote count can satisfy.
JSON consumers (dashboards, monitoring scripts) could not detect the empty-whitelist edge case from this field alone, even though the human-mode branch already prints "No validators whitelisted." and skips the threshold line entirely.
Now: `consensus_threshold == 0` when no validators are whitelisted; the existing `(n // 2) + 1` majority is preserved for non-empty whitelists.
Related Issues
Closes #753.
Type of Change
Testing
Checklist