From d625d24815d9cc59ea168c933c1ba78ae5e46235 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Fri, 30 Oct 2026 19:36:10 -0500 Subject: [PATCH] chore(serialization): bump alpaca to upstream master (portable with_version hash) Moves components/serialization/detail/alpaca from 83a592f to upstream 8f022bd, picking up p-ranav/alpaca#56 (the with_version type hash no longer includes sizeof(struct), so it verifies across a 32-bit target and a 64-bit host), #55 (pyalpaca options; Python wrapper only), #57 (MSVC CI fix) and upstream's October fixes (top-level containers, aggregate-arity SFINAE and wider arity, full-range 64-bit varint decoding, pedantic warnings). persistent_data's comments about the old sizeof-based hash are updated; its own layout fingerprint is unchanged. Behaviour note: SERIALIZATION_DEFAULT_OPTIONS include with_version, so the version word changes for every aggregate; bytes serialized with the defaults by firmware on the old pin will not verify on this one (nothing in espp persists such bytes; persistent_data has its own header). Verified: serialization / event_manager / button examples (esp32, IDF v6.1, zero warnings), persistent_data host test 114/114 against the new alpaca, host C++ library build. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU --- components/persistent_data/README.md | 9 +++++---- .../include/detail/persistent_data_codec.hpp | 11 ++++++----- components/serialization/detail/alpaca | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/persistent_data/README.md b/components/persistent_data/README.md index 54de4c3511..2d615a65be 100644 --- a/components/persistent_data/README.md +++ b/components/persistent_data/README.md @@ -175,10 +175,11 @@ A version number reused for a different layout therefore loads with `layout_mismatch` instead of producing garbage, and a reader without the C++ type (a Python tool) can compute the same fingerprint from a field spec. -alpaca's own `with_version` option is deliberately not used: its hash folds -`sizeof(struct)` in, which differs between a 32-bit ESP32 and a 64-bit host -(a struct of a string, a vector and an integer is 40 bytes on the ESP32, 56 on -macOS and 64 on Linux), so a file written on one would not load on the other. +alpaca's own `with_version` option is not used: the fingerprint above covers +more (enum underlying types, array lengths) and is computable from a field spec +by a reader without the C++ type. (Before alpaca #56 the alpaca hash also folded +`sizeof(struct)` in, which differs between a 32-bit ESP32 and a 64-bit host, so +a file written on one would not have loaded on the other.) ## Errors diff --git a/components/persistent_data/include/detail/persistent_data_codec.hpp b/components/persistent_data/include/detail/persistent_data_codec.hpp index b2214f4f10..5e57f10be9 100644 --- a/components/persistent_data/include/detail/persistent_data_codec.hpp +++ b/components/persistent_data/include/detail/persistent_data_codec.hpp @@ -42,11 +42,12 @@ namespace espp::persistent_data { /// @brief Serialization options used for the payload. /// @details `strict` rejects payloads that are shorter than the type; /// `fixed_length_encoding` keeps the encoding independent of the -/// values stored. alpaca's own `with_version` is deliberately not used: -/// its hash folds `sizeof(struct)` in, which differs between a 32-bit -/// ESP32 and a 64-bit host, so a file written on one would not load on -/// the other. The header's layout fingerprint (see layout::fingerprint) -/// plays that role portably. +/// values stored. alpaca's own `with_version` is not used: the header's +/// layout fingerprint (see layout::fingerprint) plays that role, and it +/// also encodes enum underlying types and array lengths and can be +/// computed from a field spec by a reader without the C++ type. (Before +/// alpaca #56 the alpaca hash also folded `sizeof(struct)` in, which +/// differs between a 32-bit ESP32 and a 64-bit host.) inline constexpr alpaca::options SERIALIZATION_OPTIONS = alpaca::options::fixed_length_encoding | alpaca::options::strict; diff --git a/components/serialization/detail/alpaca b/components/serialization/detail/alpaca index 83a592f0c3..8f022bdb51 160000 --- a/components/serialization/detail/alpaca +++ b/components/serialization/detail/alpaca @@ -1 +1 @@ -Subproject commit 83a592f0c3807500f1aaf3b07fd48105a01e2780 +Subproject commit 8f022bdb510600f3e569bf05fc33b11dd7bd27c4