Apply review: honest slot docstring, cap-coverage pin, write breadcrumb

This commit is contained in:
J. Nick Koston
2026-08-09 04:02:45 -05:00
parent ed2cdad9b4
commit 81216da8e7
3 changed files with 14 additions and 4 deletions
@@ -149,6 +149,10 @@ void BLEClient::on_service_discovery_done(int error) {
}
void BLEClient::on_write_result(uint16_t handle, int error) {
if (error != 0) {
// Breadcrumb even when no node claims the handle.
ESP_LOGD(TAG, "[%s] Write on handle 0x%04x completed with status %d", this->address_str_, handle, error);
}
for (auto *node : this->nodes_) {
node->on_write_result(handle, error);
}
@@ -157,10 +157,10 @@ def _ledger() -> _SlotLedger:
def consume_gatt_slot(
consumer: str, count: int = 1
) -> Callable[[ConfigType], ConfigType]:
"""Validator claiming GATT connection slots for the neutral ledger (the
platform cap check in FINAL_VALIDATE_SCHEMA); esp32 additionally charges
the controller's connection budget. The proxy's esp32 arm still charges
the controller directly - route it through here when it migrates."""
"""Validator claiming GATT connection slots - the one spelling for every
claimant. The neutral ledger feeds the hub-platform cap check in
FINAL_VALIDATE_SCHEMA; esp32 additionally charges the controller's
connection budget (its cap lives there, not in HUB_MAX_CONNECTIONS)."""
def validator(config: ConfigType) -> ConfigType:
_ledger().consumers.extend([consumer] * count)
@@ -207,6 +207,12 @@ def test_every_registered_hub_platform_has_a_schema_arm() -> None:
# Hub platforms must also be in the backend registry the shared codegen
# helpers dispatch on.
assert registered <= set(bluetooth_connection._PLATFORM_BACKENDS)
# Every non-esp32 backend platform must carry a slot cap: without one the
# ledger's FINAL_VALIDATE accepts unlimited claims silently (esp32's cap
# is the controller budget in esp32_ble).
assert set(bluetooth_connection._PLATFORM_BACKENDS) - {"esp32"} <= set(
bluetooth_connection.HUB_MAX_CONNECTIONS
)
# The outer walkable schema's bound must stay the loosest platform cap.
assert (
max(bluetooth_connection.HUB_MAX_CONNECTIONS.values())