Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for range voting e.g. "70802-9" #136

Merged
merged 8 commits into from
Sep 27, 2022
Merged

Conversation

jplevyak
Copy link
Contributor

Description

Add support for proposal ranges into the neuron-manage --register-vote command.

Fixes # (issue)

How Has This Been Tested?

Manual testing and an automated test.

Checklist:

  • [ X] I have made corresponding changes to the documentation in src/docs.

Signed-off-by: John Plevyak <[email protected]>
Signed-off-by: John Plevyak <[email protected]>
@jplevyak jplevyak requested a review from a team as a code owner September 21, 2022 20:56
Signed-off-by: John Plevyak <[email protected]>
Signed-off-by: John Plevyak <[email protected]>
}
if proposals.is_empty() {
return Err(anyhow!(
"Proposal ranges must be less than 100 and in the form XXX-YY."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message is confusing at best: it claims the format HAS to be XXX-YY, but if the XXX part was as strictly enforced as the YY part it wouldn't allow me to specify any proposals larger than 999.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions? Perhaps just X-Y ?

Copy link
Member

@ericswanson-dfinity ericswanson-dfinity Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start with <a number>-<a number greater than the first number> as valid. So these are ok:

  • 465-475
  • 11033-11270
    We can consider forms of shorthand once those are supported, but I think we should be sure that it's worth it / likely to be used. While one might see shorthand like "349-51" on a piece of paper, I'm not sure how many would expect that to be valid input for a command line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use 78825-8 for example all the time. We often have small ranges in sets of upgrade or replace proposals. I think that X-Y encourages the natural interpretation which is the unambiguous suffix semantics e.g. 123-5 123-25 123-125 are all the same and 123-1 is the empty range i.e. there is no natural interpretation that it might be say 131 based on some notion carry. For documentation like this I think less is more sometimes. If someone doesn't use the additional suffix capability it isn't the worst thing.

@ericswanson-dfinity ericswanson-dfinity dismissed their stale review September 23, 2022 17:23

Dismissing because I am going on PTO.

Copy link
Member

@ericswanson-dfinity ericswanson-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've dismissed my review requesting changes, only because I'm going on PTO.

There are two questions to be answered here:

  1. Is the proposed interface acceptable from a UX perspective?
  2. Is the implementation clear, and free of defects?

For (1), I would answer no. There are two reviewers offering the opinion that the interface is not intuitive. It would be nice if the submitter would take that into consideration. Can the submitter point to another command-line interface that provides such an interface? We shouldn't add a special-case interface that only the submitter of this PR will use.

For (2), I would also answer no. As written, in my opinion the supported UX is not at all clear from a reading of the code. At minimum the range selection code should be refactored into a separate function, with unit tests, but beyond that, it's not obvious what is going on with the replace_range and resize_with calls.

@jplevyak jplevyak requested a review from sesi200 September 24, 2022 05:28
jplevyak and others added 2 commits September 26, 2022 08:01
Signed-off-by: John Plevyak <[email protected]>
@jplevyak jplevyak requested a review from sesi200 September 26, 2022 15:25
@jplevyak jplevyak merged commit 605ddbf into master Sep 27, 2022
@sesi200 sesi200 deleted the range-vote-jplevyak branch September 27, 2022 16:56
ericswanson-dfinity added a commit that referenced this pull request Oct 12, 2022
jplevyak added a commit to jplevyak/quill that referenced this pull request Nov 22, 2022
* Add support for range voting e.g. "70802-9".

Signed-off-by: John Plevyak <[email protected]>
Co-authored-by: Severin Siffert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants