From f28be76c848039cbce12b104688a47f3c17e4ca9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 11:55:15 -0500 Subject: [PATCH] Fix comment drift: conditional cache refresh, future-tense generator consumer --- esphome/__main__.py | 3 ++- esphome/core/config.py | 6 +++--- tests/unit_tests/test_main.py | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index c4f76fcc99..a86cffe7ea 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -2735,7 +2735,8 @@ def run_esphome(argv): args.command in ("upload", "logs") and not command_line_substitutions ) # An explicit --toolchain must re-run the per-platform validators, so - # gate only the cache read; the refresh below still saves the result. + # gate only the cache read; the refresh below saves the result unless + # the sidecar records a different toolchain. cache_read_eligible = cache_write_eligible and args.toolchain is None if cache_read_eligible: from esphome.compiled_config import load_compiled_config diff --git a/esphome/core/config.py b/esphome/core/config.py index bade3ba9c4..34d5f8c67f 100644 --- a/esphome/core/config.py +++ b/esphome/core/config.py @@ -555,9 +555,9 @@ def _add_library_str(lib: str) -> None: cg.add_library(lib, None) -# platformio_options keys the native ESP8266 Arduino generator honors; the -# backend's ignored-option warning consumes this too so the two lists cannot -# drift (a drift is either a spurious warning or a silently dropped option) +# platformio_options keys the native ESP8266 Arduino generator (a later PR +# in this chain) will honor; its ignored-option warning will consume the same +# list so the two cannot drift NATIVE_ARDUINO_PIO_OPTIONS = frozenset({"board_build.f_cpu", "board_build.ldscript"}) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index b820f6b551..bce9fd3382 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -7227,9 +7227,8 @@ def test_cli_toolchain_skips_the_validated_config_cache(tmp_path: Path) -> None: def test_cli_toolchain_still_refreshes_the_validated_config_cache( tmp_path: Path, ) -> None: - """An explicit --toolchain gates only the cache read; the freshly - validated config is still saved so a later plain run keeps the fast - path (an existing compile-written sidecar keeps its toolchain).""" + """An explicit --toolchain gates only the cache read; with a matching + sidecar the freshly validated config is still saved.""" conf = tmp_path / "device.yaml" conf.write_text("esphome:\n name: t\n") argv = ["esphome", "--toolchain", "platformio", "logs", str(conf)]