Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions 5 meshtastic/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ def requestConfig(self, configType):
p.get_config_request = configType

else:
msgIndex = configType.index
if configType.containing_type.name == "LocalConfig":
p.get_config_request = msgIndex
p.get_config_request = admin_pb2.AdminMessage.ConfigType.Value(configType.name.upper() + "_CONFIG")
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

AdminMessage.ConfigType.Value(configType.name.upper() + "_CONFIG") will raise ValueError if a LocalConfig field doesn’t have a corresponding ConfigType enum (e.g. LocalConfig.version). Because requestConfig() is reachable from the CLI via --get <field>, this becomes an uncaught exception for a user typo/unsupported field. Consider catching the error (or checking membership in the enum) and exiting with a clear message (or explicitly rejecting version).

Suggested change
p.get_config_request = admin_pb2.AdminMessage.ConfigType.Value(configType.name.upper() + "_CONFIG")
enum_name = configType.name.upper() + "_CONFIG"
# Validate that the constructed enum name exists to avoid ValueError from .Value()
if enum_name not in admin_pb2.AdminMessage.ConfigType.keys():
our_exit(
f"Unsupported configuration field '{configType.name}' cannot be requested.",
1,
)
p.get_config_request = admin_pb2.AdminMessage.ConfigType.Value(enum_name)

Copilot uses AI. Check for mistakes.
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 think the current behavior is good. Any future changes should be made together on LocalConfig and ConfigType. If there's a mismatch, this should raise an exception, to alert the developers (or the users in the worst case) that there's a bug.

else:
p.get_module_config_request = msgIndex
p.get_module_config_request = configType.index
cpatulea marked this conversation as resolved.
Show resolved Hide resolved
cpatulea marked this conversation as resolved.
Show resolved Hide resolved

self._sendAdmin(p, wantResponse=True, onResponse=onResponse)
if onResponse:
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.