From 5e1848854e6590d095e13341a82af6cca5b3f997 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Oct 2025 11:25:19 -1000 Subject: [PATCH] tweak for bot --- esphome/core/helpers.cpp | 3 +++ script/determine-jobs.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 82dbeddf22..0b6c203c01 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -246,6 +246,9 @@ std::string make_name_with_suffix(const std::string &name, char sep, const std:: // Silently truncate if needed: prioritize keeping the full suffix if (total_len >= MAX_NAME_WITH_SUFFIX_SIZE) { + // NOTE: This calculation could underflow if suffix_len >= MAX_NAME_WITH_SUFFIX_SIZE - 2, + // but this is safe because this helper is only called with small suffixes: + // MAC suffixes (6-12 bytes), ".local" (6 bytes), etc. name_len = MAX_NAME_WITH_SUFFIX_SIZE - suffix_len - 2; // -2 for separator and null terminator total_len = name_len + 1 + suffix_len; } diff --git a/script/determine-jobs.py b/script/determine-jobs.py index a078fd8f9b..1601496877 100755 --- a/script/determine-jobs.py +++ b/script/determine-jobs.py @@ -244,7 +244,7 @@ def main() -> None: component for component in changed_components if (component_test_dir := tests_dir / component).exists() - and any(component_test_dir.glob("test.*.yaml")) + and next(component_test_dir.glob("test.*.yaml"), None) is not None ] # Build output