Commit Graph

607 Commits

Author SHA1 Message Date
J. Nick Koston 75fd3028f2 Merge remote-tracking branch 'upstream/dev' into integration 2026-05-13 21:53:17 -07:00
J. Nick Koston b866525437 [ci] Skip native ESP-IDF compile test when no relevant files changed (#16395) 2026-05-13 10:01:11 -05:00
J. Nick Koston 3ae8942eda Merge remote-tracking branch 'upstream/platformio-retry-connection-errors' into integration 2026-05-13 01:24:22 -05:00
Jesse Hills cb2dbcd70d [ci] Add validate.*.yaml for config-only component tests (#16384) 2026-05-13 11:37:33 +12:00
J. Nick Koston 0c3682124d Merge remote-tracking branch 'upstream/cli-from-storage-json' into integration 2026-05-12 17:54:11 -05:00
Jesse Hills 76ce45c59e [script] Preserve source order of enum options in language schema (#16371) 2026-05-13 06:28:39 +12:00
J. Nick Koston 8edc9f4cc8 Merge remote-tracking branch 'upstream/dev' into integration 2026-05-12 12:52:15 -05:00
Jonathan Swoboda e4d9786f00 [core] Move platformio files to subfolder (#16347) 2026-05-11 21:34:47 +12:00
Diorcet Yann e9cc10fedc [core] Native idf full support (#14678)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <swoboda1337@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2026-05-11 02:12:07 +00:00
J. Nick Koston 930d539969 [config_validation] Add a visibility UI-hint kwarg (#16267) 2026-05-11 12:07:15 +12:00
J. Nick Koston f295d6b056 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/__main__.py
#	esphome/components/api/client.py
#	esphome/components/bl0942/bl0942.cpp
#	esphome/components/cover/__init__.py
#	esphome/components/cover/automation.h
#	esphome/components/esphome/ota/ota_esphome.cpp
#	esphome/components/ota/ota_backend_esp_idf.cpp
#	esphome/components/ota/ota_partitions_esp_idf.cpp
#	esphome/espota2.py
#	tests/components/template/common-base.yaml
#	tests/unit_tests/components/api/test_client.py
#	tests/unit_tests/test_main.py
2026-05-06 16:47:31 -05:00
J. Nick Koston 6173656bf8 [schema] Surface OnlyWith / OnlyWithout default + gate components in schema generator (#16276) 2026-05-06 13:49:00 -04:00
Jonathan Swoboda 29db5fa4bb [script] Make pre-commit and helpers work on Windows (#16260)
Co-authored-by: Jonathan Swoboda <swoboda1337@users.noreply.github.com>
2026-05-06 07:11:06 -05:00
J. Nick Koston 15ab5422c7 [ci] Run downstream device-builder tests against PR Python code (#16214) 2026-05-03 19:45:08 -05:00
J. Nick Koston 4e560dbd2e Merge remote-tracking branch 'upstream/dev' into integration 2026-04-30 21:11:33 -05:00
J. Nick Koston 2fbfb4c385 [ci] Split integration tests into 3 buckets when count is more than 10 (#16152) 2026-04-30 19:10:53 -05:00
J. Nick Koston f484c28060 Merge remote-tracking branch 'upstream/followup/hal-esp8266' into integration 2026-04-29 16:06:03 -05:00
Jonathan Swoboda 53b682e48f [ci] Bump clang-tidy from 18.1.8 to 22.1.0.1 (#16078)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-29 20:19:33 +00:00
J. Nick Koston 985dba9332 [core] Defer heavy module-scope imports in __main__, loader, and config (#15955) 2026-04-29 13:17:59 -05:00
J. Nick Koston 34b66dca55 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/external_files.py
#	tests/components/wifi/test.esp8266-ard.yaml
2026-04-29 06:21:06 -05:00
J. Nick Koston 49c7a6928e [script] Fix cpp_unit_test crash for non-MULTI_CONF platform components (#16104) 2026-04-29 14:32:13 +12:00
J. Nick Koston f05243bd9d [api] Add 48-bit MAC address varint fast path for BLE advertisements (#15988) 2026-04-29 13:48:35 +12:00
J. Nick Koston 875bd40dfe Merge remote-tracking branch 'origin/ci/lazy-import-offenders' into integration 2026-04-28 10:39:15 -05:00
J. Nick Koston f72173550d Merge remote-tracking branch 'origin/webserver-list-entities-xmacro' into integration 2026-04-28 10:39:10 -05:00
J. Nick Koston e433e77c4f Merge remote-tracking branch 'upstream/ota-wakeable-delay-yield' into integration 2026-04-28 10:38:09 -05:00
J. Nick Koston 0a4d9b430f [ci] Add import-time regression check for esphome.__main__ (#15954) 2026-04-28 14:05:12 +00:00
J. Nick Koston e5a83555b9 Merge remote-tracking branch 'upstream/ci/import-time-check' into ci/lazy-import-offenders
# Conflicts:
#	esphome/loader.py
2026-04-28 08:51:00 -05:00
J. Nick Koston 2a587a85ad Merge branch 'dev' into ci/import-time-check 2026-04-28 08:48:57 -05:00
Jesse Hills 876c8c4c2a [ci-custom] Lint imports of esphome.components.const outside components (#16068)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 05:59:02 -05:00
J. Nick Koston 7eb5ffd226 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-26 08:28:20 -05:00
J. Nick Koston df987a7ffb [ci-custom] Suggest uint32_to_str/int8_to_str for integer formatting (#15970) 2026-04-26 07:22:34 -05:00
J. Nick Koston 9028cc8c3e Merge remote-tracking branch 'origin/git_shallow_fetch' into integration 2026-04-26 04:13:13 -05:00
J. Nick Koston 4cab262ef8 [ci] Trigger CodSpeed benchmarks on host platform changes (#15995) 2026-04-25 17:18:21 -04:00
J. Nick Koston be849f0a1a merge 2026-04-25 13:25:04 -05:00
J. Nick Koston 5558702c46 Merge remote-tracking branch 'upstream-ssh/ble-mac-varint-48bit' into integration 2026-04-25 04:47:46 -05:00
J. Nick Koston 5f8e991ed8 [api] Populate schema defaults for transitive cpp test deps; add json override
- script/build_helpers.py: when injecting a non-MULTI_CONF component
  into the post-validation config, run its CONFIG_SCHEMA with {} so
  defaults are populated. Without this, socket got config = {} and
  socket.FILTER_SOURCE_FILES crashed with KeyError on
  'implementation' (the schema's defaulted key was never filled in).
  Falls back to {} if the schema can't validate empty input.

- tests/components/json/__init__.py: enable codegen for json so its
  to_code runs during cpp unit test builds, registering the
  ArduinoJson library. Required for any api dep test, since
  json_util.cpp #includes <ArduinoJson.h>.

Locally verified 'script/cpp_unit_test.py api' now compiles and runs;
ProtoMacVarint test suite (9 cases) passes.
2026-04-25 04:44:35 -05:00
J. Nick Koston 45525c8a82 [api] Make api a buildable cpp unit test target
Three fixes so 'script/cpp_unit_test.py api' actually compiles instead
of crashing in build setup:

1. script/build_helpers.py: when adding transitive component
   dependencies to the post-validation config, use {} (dict) instead
   of [] (list) for non-MULTI_CONF components. socket's
   FILTER_SOURCE_FILES (and any other code that subscripts
   CORE.config[component] with a string key) was crashing because
   socket got config = [] from setdefault.

2. esphome/components/api/api_pb2_service.cpp + the codegen in
   script/api_protobuf/api_protobuf.py: wrap the generated
   APIConnection::read_message_ definition in #ifdef USE_API. The
   class itself is only declared inside #ifdef USE_API in
   api_connection.h, so without the guard the .cpp fails to compile
   in any build that pulls in the api source files without setting
   USE_API (e.g. cpp unit tests of api dependencies).
2026-04-25 04:41:17 -05:00
J. Nick Koston 65f68a412a [api] Add 48-bit MAC address varint fast path for BLE advertisements
Adds a (mac_address) field option that switches uint64 fields holding
48-bit MAC addresses to a specialized varint encoder. The fast path
emits exactly 7 bytes when bits [42..47] are non-zero (the common case
for real MACs, since OUIs occupy the top 24 bits) -- one bounds check
and 7 independent stores instead of the 7-iteration shift+branch loop.
calc_uint64_48bit_force mirrors the same fast path in size calculation.

Applied to BluetoothLERawAdvertisement.address, the per-advertisement
address encode in BluetoothLERawAdvertisementsResponse drops from a
serialized per-byte loop to straight-line code.
2026-04-24 19:58:39 -05:00
J. Nick Koston 87fa5a2d48 [ci] Reset import-time baseline to CI-observed 91ms
CI measured 90.6ms after the lazy-import refactor lands. Set baseline to
91ms with 15% margin (ceiling 104.65ms, ~14ms headroom for GHA variance
over the observed measurement).
2026-04-23 14:47:50 -05:00
J. Nick Koston fd63a67ad8 [ci] Lower import-time budget after lazy-import refactor
CI now measures 81.2ms after the zeroconf/writer/yaml_util lazy loads.
Reset baseline to 82ms with the 15% margin (ceiling 94.3ms, ~13ms
headroom for GHA variance).
2026-04-23 14:47:10 -05:00
J. Nick Koston 99c80b7dfa [ci] Address copilot review feedback on import-time check
- determine-jobs: trigger on changes to requirements_test.txt too; that
  file is hashed into the venv cache key and installed during
  restore-python, so a change there can alter the import environment.
- ci.yml: merge the --check and --har steps so we only run
  importtime-waterfall once per job (was measuring twice: ~7-8s of
  wasted CI time per run). Uses the new script/check_import_time.py
  --check --har <path> combination; the HAR reflects the same
  measurement that produced the pass/fail decision.
- script/check_import_time.py: refactor the CLI so --har is a standalone
  option rather than a mutually-exclusive mode. --check and --update
  each accept an optional --har PATH that writes the HAR from the same
  subprocess invocation. Plain --har is still supported for local use.
- tests: add tests/script/test_check_import_time.py covering HAR parsing,
  root lookup, offender ranking/dedup, budget round-trip, and the three
  --check exit paths (pass, regression, missing budget) plus the new
  --check --har combined write. Add requirements_test.txt case to the
  should_run_import_time parametrized test.
2026-04-23 14:47:03 -05:00
J. Nick Koston 6b7e834174 [ci] Always print top import-time offenders, not just on regression
Seeing the top contributors every run — regression or not — gives
reviewers and future-PR authors a running reference for which imports
are currently most expensive. That's the data we need to prioritize
lazy-import refactors, so there's no reason to hide it on pass.
2026-04-23 14:23:27 -05:00
J. Nick Koston 64e000de13 [ci] Tighten import-time margin to 15%
CI measured 126.2ms against 123ms baseline + 25% ceiling (153.8ms). That's
27.6ms of headroom — enough slack that a real regression could hide under
it. Drop to 15% (ceiling 141.5ms, ~15ms headroom over observed). Still
well above GHA runner variance, tight enough to catch the class of
regression we care about (zeroconf-style top-level import additions).
2026-04-23 14:22:33 -05:00
J. Nick Koston 900232be21 [ci] Parse importtime-waterfall HAR JSON; raise budget for CI runner
The previous parser walked `-X importtime` stderr by hand (string-splitting
on `|`, indent-width math). Replace it with a load of the HAR JSON that
importtime-waterfall already produces: each entry carries the module name,
self-time, and cumulative — no tree reconstruction needed. Drops the
hand-rolled retry loop too, since importtime-waterfall does best-of-6
internally.

The committed budget (75.2ms) was seeded on a fast local machine; GHA
runners measured 122.8ms, so the first CI run tripped the check. Reset
the baseline to 123ms with a 25% margin (ceiling ~154ms) to absorb GHA
variance. Tighten later once we have several data points.

Adds unit tests for should_run_import_time across the trigger matrix and
wires the new mock into the existing test_main_* suite.
2026-04-23 14:20:31 -05:00
J. Nick Koston 0dd2a57ba4 [ci] Add import-time regression check for esphome.__main__
Adds a CI gate that runs `python -X importtime -c "import esphome.__main__"`
via importtime-waterfall's best-of-N harness, compares the root cumulative
time against a checked-in budget (script/import_time_budget.json, seeded
at 75.2ms with a 15% margin), and fails the build when top-level imports
regress.

The CLI pays this cost on every invocation before the requested command
even runs, so silently adding a top-level dep chain (the recent zeroconf
move in #13135 being the motivating case) hurts every user. The check
gives us a signal without waiting for user reports.

- script/check_import_time.py: --check / --update / --har PATH modes.
  On regression, prints a ranked top-15 offenders table by self-time.
- script/import_time_budget.json: baseline + margin_pct.
- script/determine-jobs.py: should_run_import_time() gates the job on
  esphome/**/*.py, requirements.txt, requirements_dev.txt, pyproject.toml,
  or changes to the check itself.
- .github/workflows/ci.yml: new import-time job, runs when gated and
  uploads a waterfall HAR artifact (14-day retention) for inspection.
2026-04-23 14:13:01 -05:00
J. Nick Koston b8165a0ad9 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-22 18:33:03 -05:00
Keith Burzinski 70b1d9a087 [api_protobuf] Support compound ifdef conditions in proto generator (#15930) 2026-04-22 17:57:15 -05:00
J. Nick Koston 67576d4879 [rp2040] Tune oversized lwIP defaults for ESPHome (#14843) 2026-04-22 06:29:13 +02:00
J. Nick Koston 00da5d0a26 Merge remote-tracking branch 'upstream/fast-millis-esp32' into integration 2026-04-21 04:55:03 +02:00
J. Nick Koston 0d3a3552da [core] Move heap-allocating helpers to alloc_helpers.h/cpp (#15623) 2026-04-21 04:39:49 +02:00