Skip to content

add partial import export and config preview#960

Open
tylerpieper wants to merge 2 commits into
meshtastic:masterfrom
tylerpieper:master
Open

add partial import export and config preview#960
tylerpieper wants to merge 2 commits into
meshtastic:masterfrom
tylerpieper:master

Conversation

@tylerpieper

@tylerpieper tylerpieper commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Added the -y/--yes argument to skip prompts (used during config import)
Added --include-settings and --exclude-settings and filter to the binary protobuf both upon export and import. When configuring using a .cfg file and -y is omitted, the CLI will now output the config differences and prompt "Apply these changes to the node? [y/N]" before modifying any hardware settings. YAML files are skipped from the preview flow.

Summary by CodeRabbit

  • New Features
    • Added options to selectively include or exclude settings during configuration import and export.
    • Added a confirmation prompt before applying binary configuration profiles, with a --yes option to bypass confirmation.
    • Exported configuration files in binary/protobuf mode can now be subset-filtered to include only the selected settings.

Added the -y/--yes argument to skip prompts.
Added --include-settings and --exclude-settings and filter to the binary protobuf both upon export and import.
When configuring using a .cfg file and -y is omitted, the CLI will now output the config differences and prompt "Apply these changes to the node? [y/N]" before modifying any hardware settings. YAML files are skipped from the preview flow.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a738fbb8-59ea-408a-a9cb-0659a7739403

📥 Commits

Reviewing files that changed from the base of the PR and between d287c41 and 13b7d16.

📒 Files selected for processing (1)
  • meshtastic/__main__.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • meshtastic/main.py

📝 Walkthrough

Walkthrough

Adds selective DeviceProfile configuration import/export through include/exclude selectors, confirmation for binary profile application, and a --yes bypass option.

Changes

Selective configuration profiles

Layer / File(s) Summary
CLI options and configuration entry points
meshtastic/__main__.py
Adds --include-settings, --exclude-settings, and -y/--yes, then filters imported profiles before application.
DeviceProfile filtering
meshtastic/__main__.py
Adds filter_profile to map aliases and nested selectors while clearing unselected or excluded protobuf fields.
Binary import and export integration
meshtastic/__main__.py
Requires confirmation before applying filtered binary profiles and applies filtering before binary serialization.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant filter_profile
  participant export_profile
  participant ProtobufSerializer
  CLI->>filter_profile: Apply include/exclude selectors
  filter_profile-->>CLI: Return filtered DeviceProfile
  CLI->>CLI: Confirm binary profile application
  CLI->>export_profile: Export with selectors
  export_profile->>filter_profile: Filter constructed profile
  filter_profile-->>export_profile: Return filtered profile
  export_profile->>ProtobufSerializer: Serialize filtered profile
Loading

Possibly related PRs

  • meshtastic/python#944: Both changes modify binary/protobuf DeviceProfile export handling in meshtastic/__main__.py.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: partial import/export support with config preview confirmation.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@meshtastic/__main__.py`:
- Around line 1497-1580: Fix filter_profile so overlapping include entries merge
safely, preserving all-subfields semantics when a base is included alongside
specific subfields instead of calling add on None. Group top-level aliases by
their mapped protobuf field and clear each underlying field only when none of
its aliases are included. Normalize include bases consistently when matching
config and module_config fields, including underscore-less aliases, and use the
normalized key to apply subfield filtering. Apply the same normalization and
alias-aware lookup in the excludes branch so underscore-less and camel-case base
or subfield names clear the intended fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ff7baf7-c32a-41bd-9f2e-a0476bd531d6

📥 Commits

Reviewing files that changed from the base of the PR and between 19d0669 and d287c41.

📒 Files selected for processing (1)
  • meshtastic/__main__.py

Comment thread meshtastic/__main__.py
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.

1 participant