From 830854d661d139b31acf97c4e30cfce1936f5619 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 9 Aug 2026 19:12:52 -0500 Subject: [PATCH] Address review: pin the neutral arm's rejection of esp32-only keys The schema split's accept side was tested; the reject side was not - a key leaking from the legacy arm into the neutral schema would have passed silently. --- tests/component_tests/ble_client/test_validation.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/component_tests/ble_client/test_validation.py b/tests/component_tests/ble_client/test_validation.py index bb5c2bd71f..4dcdeb3122 100644 --- a/tests/component_tests/ble_client/test_validation.py +++ b/tests/component_tests/ble_client/test_validation.py @@ -109,3 +109,14 @@ def test_legacy_node_choke_point_rejects_other_platforms() -> None: # Through the public schema too, so removing the cv.All wiring fails here. with pytest.raises(cv.Invalid, match="not been migrated"): ble_client.BLE_CLIENT_SCHEMA({}) + + +def test_neutral_arm_rejects_esp32_only_keys() -> None: + # Pins the schema split's rejection side: the legacy-only keys must not + # leak into the neutral arm. + from esphome.components import ble_client + + CORE.data.setdefault(KEY_CORE, {})[KEY_TARGET_PLATFORM] = PLATFORM_RP2 + for key in ("name", "on_passkey_request", "on_passkey_notification"): + with pytest.raises(cv.Invalid): + ble_client.CONFIG_SCHEMA({"mac_address": "AA:BB:CC:DD:EE:FF", key: "x"})