Skip to content

Round-tripping configuration via Code tab materializes default values #5238

@lsiepel

Description

@lsiepel

The otherwise excellent overhaul of the Code tab in MainUI introduced in 5.1.0 comes with a behavior that I think should be reconsidered.

According to the release notes, the Code tab now uses Core APIs to create and parse file-compatible configurations. As a result, this behavior appears to originate from Core rather than MainUI itself.

Current behavior
When creating a configuration (Thing, Channel, etc.), only explicitly set configuration parameters are initially stored.
However, when that configuration is later edited and saved via the MainUI Code tab, missing parameters are injected with their default values and written into the YAML.

This behavior is controlled by a setting (default: false) of the /file-format/create, but with the default configuration it still results in defaults being actively written into the code. See screenshot, have not yet seen a place where this can be controlled from the UI.

Image

Why this is a problem
Persisting default values changes the semantics of configuration in a way that is both subtle and problematic:

  • Defaults become frozen
    Once a default value is written explicitly, it will no longer follow future default changes in bindings or Core. Users who never touched the Code tab — or who use file-based configuration — will get updated defaults, while others won’t.

  • Inconsistent behavior across configuration methods
    File-based configs typically omit defaults and therefore evolve naturally across upgrades. UI-edited configs diverge and become “sticky”, leading to unpredictable differences between setups.

  • Breaks expectations around breaking changes
    Historically, changing a default has been a valid way to introduce behavior changes while keeping configs clean. This behavior undermines that model by silently turning defaults into user intent.

  • Noisy diffs and reduced clarity
    Small edits can result in large YAML changes, making it harder to see what was actually configured intentionally.

Edit: Now when i look into the code i ask myself if this was intended or an unintended side effect of the overhaul. Not easy to compare, but looking at createFileFormatForItems and createFileFormatForThings are still set to true, consistent with the previous behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior of the Core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions