Skip to content

Fix configuration field-name resolution and reject invalid YAML imports - #995

Merged
ianmcorvidae merged 1 commit into
meshtastic:masterfrom
ftc2:config-field-resolution
Nov 20, 2026
Merged

ianmcorvidae merged 1 commit into
meshtastic:masterfrom
ftc2:config-field-resolution

Conversation

@ftc2

@ftc2 ftc2 commented Oct 16, 2026 •

Copy link
Copy Markdown

Exporting a configuration with the 12-hour clock enabled produces display.use12hClock: true. Reimporting that YAML currently converts the name to use12h_clock instead of use_12h_clock, silently omitting the setting.

Resolve configuration names using protobuf descriptors, accepting both canonical field names and JSON names while preserving previously accepted spellings through the existing conversion fallback. Share this lookup across YAML imports, --set, --get, and --ch-set. Also correct nested setter traversal, make assignment confirmations consistent, and preserve the original query in unknown-field errors.

YAML imports now reject unknown top-level keys, unknown configuration fields, and failed assignments before starting a settings transaction. Existing aliases remain supported. Profiles containing obsolete fields or extra metadata will now fail instead of silently skipping those entries. Update both shipped examples and add tests that import their actual contents.

Validation:

  • 224 focused tests passed, covering profile round trips, field-name aliases, CLI reads and writes, shipped examples, and import failures. The four clock round-trip regressions fail on the upstream base.
  • Upstream mypy and Pylint checks pass with Python 3.14.8 and locked dependencies.
  • One existing tunnel test was excluded because of a leaking reader thread; full-suite validation remains incomplete locally.
  • Verified clock imports using both spellings, export/reimport, and persistence after reboot on a LILYGO T-Beam S3 Core reporting firmware 2.8.2.a2a27f4.

This change does not address existing value-conversion failures or failures encountered while writing otherwise valid profiles to the device.

Summary by CodeRabbit

  • Configuration
    • Updated the example configuration to use the new configuration layout, set the region to US, and keep the screen on for an extended period. The mesh SDS timeout setting is no longer included.
    • Configuration fields can be entered using protobuf field names, JSON names, or camelCase names.
  • Bug Fixes
    • Invalid configuration fields and profile sections now produce clear errors before settings are written.
    • Nested configuration values are resolved and validated consistently across profile imports and CLI commands.

@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI resolves configuration fields through protobuf descriptors, accepts protobuf, JSON, and legacy camel-case names, and validates nested assignments and YAML profile sections. Example configurations and offline tests cover aliases, profile loading, round-trips, and invalid input.

Changes: Configuration field resolution and YAML profiles

Layer / File(s) Summary
Resolve and set configuration fields
meshtastic/__main__.py, meshtastic/tests/test_config_profile.py, meshtastic/tests/test_main.py
Configuration lookup and assignment resolve protobuf, JSON, and legacy camel-case field names. Nested paths are validated, and CLI output uses resolved field names. Tests cover local and module configuration, --set, and --get behavior.
Validate and load YAML profiles
meshtastic/__main__.py, exampleConfig.yaml, example_config.yaml, meshtastic/tests/test_config_profile.py
YAML profile loading rejects unsupported top-level keys and invalid configuration sections. Example configurations and tests cover profile loading, alias handling, round-trips, and invalid input.

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

Change: Bug fix

Suggested reviewers: ianmcorvidae

Merge Risk: Minimal · up to 3a276

Configuration field names are now resolved through protobuf descriptors, and YAML profiles with unknown keys or fields are rejected before any settings are written. No concrete merge-blocking risk was found. The stricter import behavior is intentional and documented in the PR.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes in the PR: fixing configuration field-name resolution (protobuf descriptor-based lookup for YAML imports and --set/--get) and rejecting invalid YAML imports (unkno…
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.
Full details: Title check

Explanation

The title names the two main changes in the PR: fixing configuration field-name resolution (protobuf descriptor-based lookup for YAML imports and --set/--get) and rejecting invalid YAML imports (unknown top-level keys and invalid sections). The raw summary and objectives both center on these two points, so the title matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dbc3c08 and 3a276c7.

Files selected for processing: 2

  • meshtastic/__main__.py
  • meshtastic/tests/test_main.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Accept canonical protobuf field names and JSON names while retaining legacy
camel-to-snake lookup compatibility. Fix the use12hClock profile round trip,
share name resolution with CLI reads and writes, and keep nested assignments
on the current submessage.

Reject unknown YAML profile keys and failed assignments before starting
configuration writes. Preserve supported aliases, update shipped examples,
and provide consistent confirmations and original-input lookup errors.

Add offline regression coverage for imports, exports, CLI field aliases,
examples, nested paths, channel settings, and validation failures.
@ianmcorvidae
ianmcorvidae force-pushed the config-field-resolution branch from dbc3c08 to 3a276c7 Compare November 20, 2026 18:22
@ianmcorvidae
ianmcorvidae added this pull request to the merge queue Nov 20, 2026
Merged via the queue into meshtastic:master with commit a2e93c1 Nov 20, 2026
13 checks passed
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.

3 participants