-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lncli: fix misleading default values in updatechanpolicy help #10499
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
base: master
Are you sure you want to change the base?
lncli: fix misleading default values in updatechanpolicy help #10499
Conversation
Summary of ChangesHello @yashbhutwala, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a long-standing usability issue in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses a usability issue in the updatechanpolicy command by replacing numeric flags with string flags. This change prevents the display of misleading (default: 0) help text for required fields, leading to a more intuitive command-line experience. The implementation is solid, with appropriate updates to flag definitions and parsing logic. I have included a couple of minor suggestions to align code formatting with the repository's style guide for function calls, enhancing readability and maintainability.
13bf325 to
3213f20
Compare
3213f20 to
6677b15
Compare
|
Hi @yashbhutwala, thanks for your fixes! In my opinion we should correctly display the default values rather then removing them. I think we could read defaults from the config file, if they are set? |
Thanks for the feedback @hieblmi! I appreciate the suggestion, but I think showing defaults doesn't quite fit the semantics of
The proper solution is in the companion PR #10500, which:
This makes defaults meaningful - if you omit This PR (#10499) is a minimal fix that accurately reflects the current behavior: these fields ARE required today. Once #10500 is merged, the fields become truly optional with sensible defaults. Does that make sense? |
This commit fixes issue lightningnetwork#1523 where the `updatechanpolicy` command displayed misleading "(default: 0)" text for required numeric flags. The problem was that `cli.Int64Flag` and `cli.Uint64Flag` automatically append "(default: 0)" to help text, which confused users because: 1. These fields are actually required, not optional 2. For time_lock_delta, 0 is not even a valid value (minimum is 18) The fix converts `base_fee_msat`, `fee_rate_ppm`, and `time_lock_delta` from numeric flag types to `StringFlag`, following the existing pattern used by `fee_rate` which was already a StringFlag. Changes: - Convert base_fee_msat from Int64Flag to StringFlag - Convert fee_rate_ppm from Uint64Flag to StringFlag - Convert time_lock_delta from Uint64Flag to StringFlag - Add "[required]" prefix to usage text for required fields - Add example values and valid ranges to help users - Update parsing logic to use explicit strconv functions The help output now clearly shows: - --base_fee_msat: "[required]" with example "(e.g., 1000)" - --fee_rate/fee_rate_ppm: "Either fee_rate or fee_rate_ppm is required" - --time_lock_delta: "[required]" with range "Must be between 18 and 65535" Fixes lightningnetwork#1523
6677b15 to
77029f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses issue #1523 by fixing misleading default values in the updatechanpolicy help text. The conversion of base_fee_msat, fee_rate_ppm, and time_lock_delta to StringFlags, along with the updated usage messages, significantly improves the user experience by accurately reflecting that these fields are required and providing helpful examples. The corresponding changes to the parsing logic using strconv functions are correctly implemented with appropriate error handling. The release notes have also been updated to reflect these changes. No critical, high, or medium severity issues were found in this review.
|
@hieblmi can you please review my comment? 🙏 |
|
@yashbhutwala, remember to re-request review from reviewers when ready |
Summary
This PR fixes issue #1523 where the
updatechanpolicycommand displayed misleading "(default: 0)" text for required numeric flags.base_fee_msat,fee_rate_ppm,time_lock_deltatoStringFlag[required]prefix and example values to help textRelated PR
*_specifiedproto flags (more invasive but complete solution)Problem
cli.Int64Flagandcli.Uint64Flagautomatically append "(default: 0)" to help text, which confused users because:time_lock_delta, 0 is not even a valid value (minimum is 18)Solution
Convert numeric flags to
StringFlag(following the existing pattern used byfee_ratewhich was already a StringFlag), and add clear[required]labels.Changes
base_fee_msatfromInt64FlagtoStringFlagfee_rate_ppmfromUint64FlagtoStringFlagtime_lock_deltafromUint64FlagtoStringFlag[required]prefix to usage text for required fieldsstrconvfunctionsBefore vs After
Before:
After:
Why StringFlag?
fee_ratewas already aStringFlagin this same commandtime_lock_delta >= 18, so sending 0 to mean "don't change" would failSee detailed analysis of previous attempts in PR #6762 and #8673.
Test Plan
go build ./cmd/lncli- compiles successfullygo test ./cmd/commands/...- all tests passgo vet ./cmd/commands/...- no issuesFixes #1523