Skip to content

cmd/wtclient: Enhance help text for session and terminate subcommands #9765

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gap-editor
Copy link

@gap-editor gap-editor commented Apr 25, 2025

resolves #9583

Change Description

This PR enhances the wtclient subcommands by adding user-friendly help text and improving argument naming:

  • sessionCommands:

    • Added Usage: "Manage watchtower client sessions."
    • Added Description: "Manage sessions with the watchtower client, including terminating sessions."
  • terminateSessionCommand:

    • Added Usage: "Terminate a watchtower client session."
    • Added Description: "Terminate an active session with the watchtower client by ID."

No functional behavior was changed. This is purely documentation/CLI-UX improvement.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering both positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

  • The change is not insubstantial (no single-character or typo-only commits).
  • All new comments and help text wrap at 80 columns.
  • Commits follow the Ideal Git Commit Structure.
  • Any new lncli commands have appropriate comments/tags in the proto file.
  • Release notes are updated, or [skip ci] is included for small changes.

Copy link
Contributor

coderabbitai bot commented Apr 25, 2025

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gap-editor
Copy link
Author

Hi!, guys! I saw in the contribution guidelines that commits should be squashed before merging.

If the PR is good to go, would you mind squashing the commits on your end during the merge? I’d really appreciate it.

@ellemouton
Copy link
Collaborator

ellemouton commented Apr 26, 2025

@gap-editor - is this perhaps a duplicate of #9588?

If the PR is good to go, would you mind squashing the commits on your end during the merge? I’d really appreciate it.

The PR author is expected to get the commits in the correct structure before merge.

Commented the same on the duplicate pr: commit naming conventions must please be followed as per our guidelines

@gap-editor gap-editor force-pushed the master branch 2 times, most recently from 98f2791 to 3404f6a Compare April 27, 2025 09:59
@gap-editor
Copy link
Author

@ellemouton do i need to squash commits?

@guggero
Copy link
Collaborator

guggero commented Apr 28, 2025

@ellemouton do i need to squash commits?

Fixup commits or commits that don't make logical sense on their own should be squashed. But generally changes should be committed in small logical units (commits). What @ellemouton was hinting at was the commit messages themselves.

@gap-editor
Copy link
Author

@ellemouton do i need to squash commits?

Fixup commits or commits that don't make logical sense on their own should be squashed. But generally changes should be committed in small logical units (commits). What @ellemouton was hinting at was the commit messages themselves.

I have changed commit messages already so based on what you wrote, I don't see the point in doing squash commits because, de facto, one commit is for code changes and the other is for changes in the release note. If you think differently, let me know, and I will listen and do it the right way.

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 1, 2025

I have changed commit messages already so based on what you wrote,

Hey @gap-editor, Thanks for your contribution! It looks like there something missed regards the git commit message. What @ellemouton was hinting specifically in the commit message is package prefixes and may be other nuances here in the contribution guidelines:

https://github.com/lightningnetwork/lnd/blob/master/docs/code_contribution_guidelines.md#development-guidelines

Your commits could be structured like:
1️⃣ cmd: add usage and desc to wtclient session
2️⃣ docs: update release-notes-0.19.0.md

You could observe the merged git commits here and gaining some insights about structure of git commits:
https://github.com/lightningnetwork/lnd/commits/master/

Also, it appears PR #9588 addresses the same issue and submitted prior to yours. Consider collaborating with that author for example using the Co-authored-by feature in your commit messages but letting them know before.

ArgsUsage: "id",
Usage: "Terminate a watchtower client session.",
Description: "Terminate an active session with the watchtower client by ID.",
ArgsUsage: "session_id",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this change is necessary. Users already run lncli wtclient session terminate <id> and can tell it's a session-related ID from context

The `session` command now includes a comprehensive explanation of its role in managing watchtower client sessions.
The `terminate` command offers clear instructions for ending an active session using its unique session ID.

Want it more technical or more casual?
Copy link
Contributor

@mohamedawnallah mohamedawnallah May 1, 2025

Choose a reason for hiding this comment

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

It looks like it would be better to be under Tooling and Documentation section instead. Please also maintain the 80-character line limit where possible as per contribution guidelines

The `session` command now includes a comprehensive explanation of its role in managing watchtower client sessions.
The `terminate` command offers clear instructions for ending an active session using its unique session ID.

Want it more technical or more casual?
Copy link
Contributor

@mohamedawnallah mohamedawnallah May 1, 2025

Choose a reason for hiding this comment

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

It looks like this comment doesn't belong here?

@gap-editor gap-editor force-pushed the master branch 3 times, most recently from 238a2ff to d4f3ad0 Compare May 1, 2025 18:26
@gap-editor
Copy link
Author

@mohamedawnallah , done!

@mohamedawnallah
Copy link
Contributor

I noticed that the current git commit order appears to be in reverse. Typically, release notes are added after the corresponding coding changes. In current case, It seems the release notes were added before the changes they describe.

On a related note, I observed that you used the master branch on your fork. While it’s generally good practice to use a feature-specific branch for contributions, I think it’s okay for this PR since you have to open another PR otherwise.

@mohamedawnallah
Copy link
Contributor

Apart from the proposed changes above, the PR LGTM!

@gap-editor
Copy link
Author

@mohamedawnallah thank you ! And just wanted to ask — would you prefer if I squash the commits, or is it important to keep your name visible as a co-author in the commit history?

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 2, 2025

would you prefer if I squash the commits, or is it important to keep your name visible as a co-author in the commit history?

@gap-editor feel free to squash git commits and as I mentioned before make sure the git commit for release note is the last one

@gap-editor gap-editor force-pushed the master branch 2 times, most recently from 90d46b3 to f743e49 Compare May 2, 2025 14:55
@gap-editor
Copy link
Author

would you prefer if I squash the commits, or is it important to keep your name visible as a co-author in the commit history?

@gap-editor feel free to squash git commits and as I mentioned before make sure the git commit for release note is the last one

@mohamedawnallah done! please check

@@ -377,13 +377,17 @@ func policy(ctx *cli.Context) error {

var sessionCommands = cli.Command{
Name: "session",
Usage: "Manage watchtower client sessions.",
Description: "Manage sessions with the watchtower client, including terminating sessions.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like theDescription line is over 80 characters limit. Look for policy command legacy usage in the same file and see how the lines are splitted using + before 80 characters limit

Subcommands: []cli.Command{
terminateSessionCommand,
},
}

var terminateSessionCommand = cli.Command{
Name: "terminate",
Usage: "Terminate a watchtower client session.",
Description: "Terminate an active session with the watchtower client by ID.",
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Comment on lines 533 to 534
explanation of its role in managing watchtower client sessions. The `terminate`
command offers clear instructions for ending an active session using its unique
Copy link
Contributor

@mohamedawnallah mohamedawnallah May 2, 2025

Choose a reason for hiding this comment

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

It looks like unique and terminate based on my proposed change before is over 80 characters as well they could be moved on the next line

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 2, 2025

@gap-editor – The code commits structure looks good to me. Please look for my additional proposed changes and I think it would be good to go

@gap-editor
Copy link
Author

@gap-editor – The code commits structure looks good to me. Please look for my additional proposed changes and I think it would be good to go

@mohamedawnallah done! check is everything good, please!

Copy link
Contributor

@mohamedawnallah mohamedawnallah left a comment

Choose a reason for hiding this comment

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

LGTM 🎉. That being said the CI needs to be approved to run. I am also not familiar with resolution strategies in case of there are multiple community PRs resolving the same issue. Till then feel free to pick up good-first-issues and ping me and I would be happy to review when I have got time for it:
https://github.com/lightningnetwork/lnd/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22%20no%3Aassignee

cc @ellemouton, @guggero

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 5, 2025

As CI tests run. It looks like this is unrelated to the changes in this PR:
itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)
https://github.com/lightningnetwork/lnd/actions/runs/14798078428/job/41635770204?pr=9765

--- FAIL: TestLightningNetworkDaemon (1685.74s)
    harness_setup.go:25: Setting up HarnessTest...
    harness_setup.go:38: Prepare the miner and mine blocks to activate segwit...
    harness_setup.go:46: Connecting the miner at 127.0.0.1:10021 with the chain backend...
    --- FAIL: TestLightningNetworkDaemon/tranche05/206-of-294/bitcoind/sweep_cpfp_anchor_incoming_timeout (152.15s)
        harness_node.go:403: Starting node (name=Alice) with PID=46221
        harness_node.go:403: Starting node (name=Bob) with PID=46438
        harness_node.go:403: Starting node (name=Carol) with PID=46678
        lnd_sweep_test.go:610: Bob(position=3): txWeight=722 wu, expected: [fee=7686, feerate=10645 sat/kw], got: [fee=7692, feerate=10[639](https://github.com/lightningnetwork/lnd/actions/runs/14798078428/job/41635770204?pr=9765#step:6:640)] in tx 4bf88102919f9ae68ff608ce567df66af265ffda66dfb8b774bacb98b53f8aa7
        lnd_sweep_test.go:610: Bob(position=2): txWeight=722 wu, expected: [fee=13567, feerate=18791 sat/kw], got: [fee=13571, feerate=18770] in tx 8ef5e96a8daff305da584cf1990f66a8bb30c4368c66fe99924496bf2c5a2a60
        lnd_sweep_test.go:610: Bob(position=1): txWeight=722 wu, expected: [fee=19448, feerate=26936 sat/kw], got: [fee=19451, feerate=26903] in tx 82748ba3874ca3dacd8150313c83d66b0e73b2bbbdb404fe5b7ec7b705ddebd3
        miner.go:223: 
            	Error Trace:	/home/runner/work/lnd/lnd/lntest/miner/miner.go:223
            	            				/home/runner/work/lnd/lnd/lntest/harness_miner.go:222
            	            				/home/runner/work/lnd/lnd/lntest/harness_miner.go:104
            	            				/home/runner/work/lnd/lnd/itest/lnd_sweep_test.go:675
            	            				/home/runner/work/lnd/lnd/lntest/harness.go:303
            	            				/home/runner/work/lnd/lnd/itest/lnd_test.go:130
            	Error:      	Received unexpected error:
            	            	want 1, got 0 in mempool: []
            	Test:       	TestLightningNetworkDaemon/tranche05/206-of-294/bitcoind/sweep_cpfp_anchor_incoming_timeout
            	Messages:   	assert tx in mempool timeout
        harness.go:381: finished test: sweep_cpfp_anchor_incoming_timeout, start height=760, end height=802, mined blocks=42
        harness.go:403: !============================================!
            Too many blocks (42) mined in one test! Tips:
            1. break test into smaller individual tests, especially if this is a table-drive test.
            2. use smaller CSV via `--bitcoin.defaultremotedelay=1.`
            3. use smaller CLTV via `--bitcoin.timelockdelta=18.`
            4. remove unnecessary CloseChannel when test ends.
            5. use `CreateSimpleNetwork` for efficient channel creation.
            
        harness.go:340: test failed, skipped cleanup
    lnd_test.go:138: Failure time: 2025-05-05 09:09:09.015
FAIL

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 5, 2025

Hey @gap-editor, the CI has run Feel free to fix the code formatting as appear in the CI. You could use make fmt locally and after this you could run make lint locally to see if linting issues no longer exist :
https://github.com/lightningnetwork/lnd/actions/runs/14798078428/job/41635770133?pr=9765

@mohamedawnallah
Copy link
Contributor

mohamedawnallah commented May 5, 2025

As CI tests run. It looks like this is unrelated to the changes in this PR: itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres) https://github.com/lightningnetwork/lnd/actions/runs/14798078428/job/41635770204?pr=9765

--- FAIL: TestLightningNetworkDaemon (1685.74s)
    harness_setup.go:25: Setting up HarnessTest...
    harness_setup.go:38: Prepare the miner and mine blocks to activate segwit...
    harness_setup.go:46: Connecting the miner at 127.0.0.1:10021 with the chain backend...
    --- FAIL: TestLightningNetworkDaemon/tranche05/206-of-294/bitcoind/sweep_cpfp_anchor_incoming_timeout (152.15s)
        harness_node.go:403: Starting node (name=Alice) with PID=46221
        harness_node.go:403: Starting node (name=Bob) with PID=46438
        harness_node.go:403: Starting node (name=Carol) with PID=46678
        lnd_sweep_test.go:610: Bob(position=3): txWeight=722 wu, expected: [fee=7686, feerate=10645 sat/kw], got: [fee=7692, feerate=10[639](https://github.com/lightningnetwork/lnd/actions/runs/14798078428/job/41635770204?pr=9765#step:6:640)] in tx 4bf88102919f9ae68ff608ce567df66af265ffda66dfb8b774bacb98b53f8aa7
        lnd_sweep_test.go:610: Bob(position=2): txWeight=722 wu, expected: [fee=13567, feerate=18791 sat/kw], got: [fee=13571, feerate=18770] in tx 8ef5e96a8daff305da584cf1990f66a8bb30c4368c66fe99924496bf2c5a2a60
        lnd_sweep_test.go:610: Bob(position=1): txWeight=722 wu, expected: [fee=19448, feerate=26936 sat/kw], got: [fee=19451, feerate=26903] in tx 82748ba3874ca3dacd8150313c83d66b0e73b2bbbdb404fe5b7ec7b705ddebd3
        miner.go:223: 
            	Error Trace:	/home/runner/work/lnd/lnd/lntest/miner/miner.go:223
            	            				/home/runner/work/lnd/lnd/lntest/harness_miner.go:222
            	            				/home/runner/work/lnd/lnd/lntest/harness_miner.go:104
            	            				/home/runner/work/lnd/lnd/itest/lnd_sweep_test.go:675
            	            				/home/runner/work/lnd/lnd/lntest/harness.go:303
            	            				/home/runner/work/lnd/lnd/itest/lnd_test.go:130
            	Error:      	Received unexpected error:
            	            	want 1, got 0 in mempool: []
            	Test:       	TestLightningNetworkDaemon/tranche05/206-of-294/bitcoind/sweep_cpfp_anchor_incoming_timeout
            	Messages:   	assert tx in mempool timeout
        harness.go:381: finished test: sweep_cpfp_anchor_incoming_timeout, start height=760, end height=802, mined blocks=42
        harness.go:403: !============================================!
            Too many blocks (42) mined in one test! Tips:
            1. break test into smaller individual tests, especially if this is a table-drive test.
            2. use smaller CSV via `--bitcoin.defaultremotedelay=1.`
            3. use smaller CLTV via `--bitcoin.timelockdelta=18.`
            4. remove unnecessary CloseChannel when test ends.
            5. use `CreateSimpleNetwork` for efficient channel creation.
            
        harness.go:340: test failed, skipped cleanup
    lnd_test.go:138: Failure time: 2025-05-05 09:09:09.015
FAIL

It looks like this CI test failed here regards postgresql as well in this PR #9780:
https://github.com/lightningnetwork/lnd/actions/runs/14811617858/job/41586990089?pr=9780

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.

[bug]: missing description to wtclient command "session" and "terminate" command option
4 participants