Skip the cache refresh when the CLI toolchain differs from the compile's

Platforms normalize toolchain-sensitive keys differently (the esp32
board name, for one), so a config validated under a mismatching
--toolchain must not overwrite the cache while the sidecar keeps the
compile's toolchain. The guard lives in _refresh_sidecar where the old
sidecar is already loaded; legacy sidecars without the field are
unaffected.
This commit is contained in:
J. Nick Koston
2026-08-21 11:14:26 -05:00
parent 6cb446baf8
commit c93cf55967
2 changed files with 48 additions and 0 deletions
+16
View File
@@ -100,6 +100,22 @@ def _refresh_sidecar() -> bool:
)
return False
if old is not None and old.can_apply_to_core():
if (
old.toolchain is not None
and CORE.toolchain is not None
and old.toolchain != CORE.toolchain.value
):
# The config was validated under a different toolchain than
# the compile's, and platforms normalize toolchain-sensitive
# keys (e.g. the esp32 board name) differently; caching it
# would disagree with the sidecar until the next compile
_LOGGER.debug(
"Not caching: config validated with toolchain %r but the "
"last compile used %r",
CORE.toolchain.value,
old.toolchain,
)
return False
# Compile-written; nothing to refresh.
return True
if CORE.build_path is not None and CORE.build_path.exists():