Skip to content

Adding error for network mismatch between CLI and config#1950

Open
sergey3bv wants to merge 1 commit intolightninglabs:mainfrom
sergey3bv:feat/network-missmatch-error
Open

Adding error for network mismatch between CLI and config#1950
sergey3bv wants to merge 1 commit intolightninglabs:mainfrom
sergey3bv:feat/network-missmatch-error

Conversation

@sergey3bv
Copy link

Addressing #1070

@gemini-code-assist
Copy link

Summary of Changes

Hello @sergey3bv, 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 significantly improves the user experience by introducing robust error handling for network mismatches between CLI commands and the tapd node's configuration. It provides clear, actionable feedback to users when they attempt to interact with a node on a different network than it's configured for, preventing potential confusion and operational errors.

Highlights

  • Network Mismatch Detection: Implemented a new utility function, detectNodeNetwork, to parse the tapd.conf file and identify the network a tapd node is configured to run on.
  • Improved Error Handling: Enhanced the profileFromContext function to detect discrepancies between the network specified in a CLI command and the network configured in the tapd.conf file. If a mismatch is found, a detailed error message is now returned.
  • Actionable Error Suggestions: The network mismatch error message now includes the requested network, the node's configured network, and a suggested corrected command, making it easier for users to resolve configuration issues.
  • Comprehensive Testing: Added new unit tests (TestDetectNodeNetwork and TestNetworkMismatchError) to ensure the correct detection of network settings from config files and the accurate generation of network mismatch error messages with appropriate command suggestions.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces a helpful feature to detect and report network mismatches between the CLI and the tapd node configuration. The implementation correctly detects the network from the config file and provides a user-friendly error with a suggested command.

I've found a critical bug in the command suggestion logic that needs to be addressed. Additionally, I've included a couple of medium-severity suggestions to improve the robustness of the config parsing and the overall code quality. The new tests are well-written and cover the new functionality effectively.

@sergey3bv sergey3bv force-pushed the feat/network-missmatch-error branch from cbce47d to c263b63 Compare January 14, 2026 11:57
@Roasbeef Roasbeef requested review from a team, GeorgeTsagk and jtobin and removed request for a team January 15, 2026 00:31
@jtobin
Copy link
Member

jtobin commented Jan 21, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces a helpful feature to detect network mismatches between the CLI arguments and the configuration file, improving the user experience by providing a clear error message with a suggested command. The implementation is well-structured and includes good test coverage. However, I've identified a critical bug in the logic that constructs the suggested command, which can lead to an incorrect suggestion. I've also noted a minor formatting issue. Once the bug is addressed, this will be a solid improvement.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 20993233593

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 52 (0.0%) changed or added relevant lines in 1 file are covered.
  • 8364 unchanged lines in 122 files lost coverage.
  • Overall coverage decreased (-7.2%) to 49.731%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/commands/profile.go 0 52 0.0%
Files with Coverage Reduction New Missed Lines %
authmailbox/client.go 2 69.84%
commitment/proof.go 2 87.29%
fn/retry.go 2 92.5%
universe/interface.go 3 74.21%
commitment/encoding.go 4 68.75%
mssmt/encoding.go 4 76.67%
rpcutils/price_oracle_marshal.go 4 85.07%
tapsend/proof.go 4 85.99%
fn/recv.go 5 60.47%
rfqmsg/messages.go 5 85.52%
Totals Coverage Status
Change from base Build 20989812155: -7.2%
Covered Lines: 57158
Relevant Lines: 114935

💛 - Coveralls

Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

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

There are some existing problems in the changeset (tests failing, formatting errors, at least -- please see Gemini's reviews), but I don't think this is the correct approach for resolving the linked issue anyway. I don't think we should be manually parsing the tapd.conf file -- the ends don't really justify the means here, I think.

Simpler, and perfectly acceptable IMO, would be to literally just add something like "(wrong --network flag?)" to the existing error.

@github-project-automation github-project-automation bot moved this from 🆕 New to 👀 In review in Taproot-Assets Project Board Jan 21, 2026
@sergey3bv
Copy link
Author

Simpler, and perfectly acceptable IMO, would be to literally just add something like "(wrong --network flag?)" to the existing error.

You're absolutely right! I'll try to update the PR.

@sergey3bv sergey3bv force-pushed the feat/network-missmatch-error branch from c263b63 to 1605fb6 Compare January 21, 2026 13:18
@sergey3bv sergey3bv force-pushed the feat/network-missmatch-error branch from 1605fb6 to da625a0 Compare January 21, 2026 13:19
@sergey3bv sergey3bv requested a review from jtobin January 21, 2026 13:20
@lightninglabs-deploy
Copy link

@GeorgeTsagk: review reminder
@jtobin: review reminder
@sergey3bv, remember to re-request review from reviewers when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants