From cd2c1014f31063aa4db015c0c54264ce209a9a25 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 15 May 2026 10:33:14 -0700 Subject: [PATCH] [store_yaml] Address review: drop esp32-ard test, force on data field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove `test.esp32-ard.yaml`; the esp32 platform is IDF-only for new component tests. - `(force) = true` on `GetYamlResponse.data` so the field is always emitted on the wire (matches the camera streaming pattern). `done` stays unforced — it's `false` on every chunk except the last, and default-value elision saves ~2 bytes per chunk for the firmware to TX. - `total_size` and `encoding` stay first-chunk-only; the client caches them. Firmware bandwidth is expensive, client RAM is not. --- esphome/components/api/api.proto | 6 +++--- esphome/components/api/api_pb2.cpp | 6 ++++-- tests/components/store_yaml/test.esp32-ard.yaml | 5 ----- 3 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 tests/components/store_yaml/test.esp32-ard.yaml diff --git a/esphome/components/api/api.proto b/esphome/components/api/api.proto index a54cffd704..c138140a48 100644 --- a/esphome/components/api/api.proto +++ b/esphome/components/api/api.proto @@ -2757,10 +2757,10 @@ message GetYamlResponse { option (source) = SOURCE_SERVER; option (ifdef) = "USE_STORE_YAML"; - bytes data = 1; + bytes data = 1 [(force) = true]; bool done = 2; - // total compressed size, populated on the first chunk + // Sent on the first chunk only — the client is expected to cache it. + // (firmware bandwidth/flash is expensive; the client has gigabytes.) uint32 total_size = 3; - // compression encoding, populated on the first chunk ("zstd") string encoding = 4 [(max_data_length) = 8]; } diff --git a/esphome/components/api/api_pb2.cpp b/esphome/components/api/api_pb2.cpp index 49d44933f8..d1b81d6e3a 100644 --- a/esphome/components/api/api_pb2.cpp +++ b/esphome/components/api/api_pb2.cpp @@ -4164,7 +4164,9 @@ uint32_t BluetoothSetConnectionParamsResponse::calculate_size() const { #ifdef USE_STORE_YAML uint8_t *GetYamlResponse::encode(ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const { uint8_t *__restrict__ pos = buffer.get_pos(); - ProtoEncode::encode_bytes(pos PROTO_ENCODE_DEBUG_ARG, 1, this->data_ptr_, this->data_len_); + ProtoEncode::write_raw_byte(pos PROTO_ENCODE_DEBUG_ARG, 10); + ProtoEncode::encode_varint_raw(pos PROTO_ENCODE_DEBUG_ARG, this->data_len_); + ProtoEncode::encode_raw(pos PROTO_ENCODE_DEBUG_ARG, this->data_ptr_, this->data_len_); ProtoEncode::encode_bool(pos PROTO_ENCODE_DEBUG_ARG, 2, this->done); ProtoEncode::encode_uint32(pos PROTO_ENCODE_DEBUG_ARG, 3, this->total_size); ProtoEncode::encode_string(pos PROTO_ENCODE_DEBUG_ARG, 4, this->encoding); @@ -4172,7 +4174,7 @@ uint8_t *GetYamlResponse::encode(ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PAR } uint32_t GetYamlResponse::calculate_size() const { uint32_t size = 0; - size += ProtoSize::calc_length(1, this->data_len_); + size += ProtoSize::calc_length_force(1, this->data_len_); size += ProtoSize::calc_bool(1, this->done); size += ProtoSize::calc_uint32(1, this->total_size); size += !this->encoding.empty() ? 2 + this->encoding.size() : 0; diff --git a/tests/components/store_yaml/test.esp32-ard.yaml b/tests/components/store_yaml/test.esp32-ard.yaml deleted file mode 100644 index 979236dc7a..0000000000 --- a/tests/components/store_yaml/test.esp32-ard.yaml +++ /dev/null @@ -1,5 +0,0 @@ -wifi: - ssid: MySSID - password: password1 - -<<: !include common.yaml