State what the cache refresh actually writes

The comment claimed the refresh's sidecar records the CLI toolchain;
_refresh_sidecar returns early when a compile-written sidecar exists,
so the compile's toolchain stands. Reword the comment and the test
docstring to match.
This commit is contained in:
J. Nick Koston
2026-08-21 09:58:32 -05:00
parent 8b9773c4bd
commit 6cb446baf8
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -2739,8 +2739,10 @@ def run_esphome(argv):
)
# An explicit CLI toolchain must run the per-platform validators; the
# cache was validated under whatever the last compile used. Only the
# read is gated: the refresh below may still save the freshly
# validated config, and its sidecar records the resolved toolchain.
# read is gated: the refresh below still saves the freshly validated
# config. The sidecar is only written when none exists; a
# compile-written one keeps the compile's toolchain (the firmware on
# disk was built by it), which upload/logs then restore.
cache_read_eligible = cache_write_eligible and args.toolchain is None
if cache_read_eligible:
from esphome.compiled_config import load_compiled_config
+2 -2
View File
@@ -7253,8 +7253,8 @@ 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, and its sidecar records the resolved
toolchain for a later plain run."""
validated config is still saved so a later plain run keeps the fast
path (an existing compile-written sidecar keeps its toolchain)."""
from esphome.__main__ import run_esphome
conf = tmp_path / "device.yaml"