Skip to content

fix(config): dashboard saves no longer clobber unrelated config keys - #172

Merged
zvx-echo6 merged 1 commit into
mainfrom
fix/config-save-preserve
Sep 17, 2026
Merged

zvx-echo6 merged 1 commit into
mainfrom
fix/config-save-preserve

Conversation

@zvx-echo6

Copy link
Copy Markdown
Owner

Summary

Dashboard config saves rewrote whole config files from the dataclass, dropping every key the schema does not declare. On 2026-09-16 a one-flag save of environmental removed the central: block and wzdx.endpoints from env_feeds.yaml.

  • Schema-aware preserve-merge for all three save_section write paths (dedicated files, meshtastic.yaml, config.yaml).
  • Unknown keys survive at any depth. Removing a notifications.destinations or toggles entry still removes it. Lists replace.
  • ${VAR} references survive an unchanged save, and secret handling is unchanged.
  • Two-level LOCAL_FIELDS (environmental.ducting.* -> local.yaml env_center) now round-trip instead of being written into env_feeds.yaml.

Known, not fixed here

  • Comments in saved files are still lost (PyYAML).
  • Other overlay values can still be written into base files on save: mesh_intelligence.regions[].lat/lon, mesh_sources[].url/host, environmental.nws.user_agent (derived from bot.contact_email), and notification rule defaults. local.yaml still overrides them on load. A proper fix needs a design for reconstructing the overlay at save time.
  • Writes are not atomic (pre-existing).

Tests

2275 passed, 0 failed (was 2263). New test_save_section_preserve.py (12 tests), including a replay of the 2026-09-16 env_feeds.yaml save.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CfJYSn4wcmPKhVb6MfSQnr

save_section replaced a dedicated section file (env_feeds.yaml,
notifications.yaml, ...) wholesale with the serialized dataclass, and did
the same one level down for meshtastic.yaml / config.yaml sections.
Anything the schema does not declare was dropped. On 2026-09-16 a PUT
/api/config/environmental that changed one flag also removed the central
block and wzdx.endpoints from env_feeds.yaml.

- New schema-aware _merge_config_node: only dataclass-declared fields
  change; unknown keys at any depth survive; dict-of-dataclass fields
  (notifications.toggles/destinations) are rebuilt to exactly the saved
  keys, so deletions still delete; lists and scalars take the new value.
- A non-secret ${VAR} reference on disk is kept when the saved value
  equals its resolution (extends the existing secret-ref behavior).
  check_secrets is unchanged.
- _extract_local_fields now walks dotted LOCAL_FIELDS paths, so
  environmental.ducting.latitude/longitude round-trip to local.yaml
  (env_center) instead of being baked into env_feeds.yaml.
- Comments are still lost (PyYAML; ruamel is not a dependency).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CfJYSn4wcmPKhVb6MfSQnr
@zvx-echo6
zvx-echo6 merged commit d804f7d into main Sep 17, 2026
2 checks passed
@zvx-echo6
zvx-echo6 deleted the fix/config-save-preserve branch September 17, 2026 02:05
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