mirror of
https://github.com/esphome/esphome.git
synced 2026-09-13 08:17:34 +00:00
Drop the StorageJSON `compiled_config` field and the `esphome/lite_config.py` module from the first iteration. The earlier shape stored the entire validated config inside the JSON sidecar, but configs can grow past a megabyte once packages and substitutions expand, and JSON can't round-trip the YAML-specific types (lambdas, ID instances, includes) the validation pipeline produces. Instead: dump the validated config to its own YAML file alongside the sidecar (`<file>.validated.yaml`), using `yaml_util.dump` so all esphome-specific tags survive the round trip. The fast path loads it back with `yaml_util.load_yaml(clear_secrets=False)` -- no schema validation, no final-validate, no external-component refresh. Staleness is gated by mtime: if the source YAML mtime is newer than the cache, the dispatcher falls back to a full `read_config()` with a warning. The cache is refreshed on every successful compile via `writer.update_storage_json`, so the dashboard's compile -> upload -> logs flow always sees a fresh cache. Drift surface shrinks to "what does yaml_util.dump emit" rather than "which top-level keys does upload/logs read" -- when those subcommands gain a new dependency, the cache already carries it.