fix preflight config path check

This commit is contained in:
ykcheungab
2026-09-20 11:20:47 +08:00
parent 45419a59c4
commit e2b906a640
3 changed files with 104 additions and 33 deletions
+11 -1
View File
@@ -103,7 +103,17 @@ def _runtime_roots() -> list[Path]:
except (OSError, ValueError): # pragma: no cover - defensive
continue
return [path for path in _unique_paths(anchors) if _is_sdk_runtime_root(path)]
anchors = _unique_paths(anchors)
# Keep the *innermost* matching directories. Walking up from the launcher
# also visits every parent, and a parent that happens to carry an
# ``examples/`` directory must not outrank the real root below it: doing so
# made a workspace directory shadow the release root's own bundle.
return [
path
for path in anchors
if _is_sdk_runtime_root(path)
and not any(other != path and other.is_relative_to(path) for other in anchors)
]
def _candidate_config_dirs() -> list[Path]:
+4 -2
View File
@@ -1271,9 +1271,11 @@ class Sensor:
that root had coefficients.
"""
attempts = self._force_cal_attempts or []
found = [entry for entry in attempts if entry.get("found_root") is not None]
# ``found_root`` is keyed even when nothing was found (valued None), so
# test its value, not the key.
found = [entry for entry in attempts if entry.get("found_root")]
with_cal = [entry for entry in found if entry.get("force_calibration_json")]
chosen = (with_cal or found or attempts or [None])[0]
chosen = (with_cal or found or [None])[0]
searched: list = []
for entry in attempts:
for root in entry.get("searched") or ():