fix(ipc): encode StandaloneDevice::registry_model_id as Option for bincode - #759
Open
rekcilyssup wants to merge 1 commit into
Open
fix(ipc): encode StandaloneDevice::registry_model_id as Option for bincode#759rekcilyssup wants to merge 1 commit into
rekcilyssup wants to merge 1 commit into
Conversation
…ncode Drop skip_serializing_if from StandaloneDevice::registry_model_id. bincode is not self-describing, so skipping None truncates the stream and makes every AgentSnapshot undecodable while a device without a registry model is present - the GUI then gets no inventory at all. A plain Option already encodes its presence byte. Bump PROTOCOL_VERSION to 24 and update the None golden. Make assert_wire round-trip (decode and re-encode) so truncated streams are caught, without requiring PartialEq on tarpc-generated types. Fixes AprilNEA#571
Greptile SummaryThis PR fixes bincode serialization of an absent
Confidence Score: 5/5The PR appears safe to merge, with the serialization fix, protocol-version guard, and updated wire tests aligned. The changed optional field remains appended, is now encoded consistently for bincode, and incompatible GUI and agent versions are rejected before snapshot decoding.
|
| Filename | Overview |
|---|---|
| crates/openlogi-core/src/device.rs | Removes conditional omission of the trailing optional field so bincode emits an explicit None tag. |
| crates/openlogi-ipc/src/ipc.rs | Correctly bumps and documents the protocol version for the changed positional wire encoding. |
| crates/openlogi-ipc/tests/wire_format.rs | Updates the None golden bytes and adds deserialization plus canonical re-encoding checks to all pinned wire values. |
| crates/openlogi-agent/src/bin/mock_agent.rs | Removes an obsolete workaround comment while retaining the real registry ID used for asset lookup. |
Reviews (1): Last reviewed commit: "fix(ipc): encode StandaloneDevice::regis..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #571 —
StandaloneDevice::registry_model_idusedskip_serializing_if = "Option::is_none"which is safe for JSON but not for bincode (non-self-describing). When the field isNone, the encodedAgentSnapshotis truncated and the GUI fails to decode every poll, losing the entire inventory while such a device is present.Changes
crates/openlogi-core/src/device.rs:410: dropskip_serializing_if, keep#[serde(default)]crates/openlogi-ipc/src/ipc.rs:55: bumpPROTOCOL_VERSION23 → 24 (append-only wire format rule)crates/openlogi-ipc/tests/wire_format.rs:66: makeassert_wireround-trip (deserialize + re-encode check) without requiringPartialEqon tarpc-generated types; pin version to 24 and regenerateregistry_model_id = Nonegolden (…6100instead of…61)crates/openlogi-agent/src/bin/mock_agent.rs:432: remove obsolete workaround comment (keepsSome("8c900")for asset lookup)Testing
DEVELOPER_DIR=/Library/Developer/CommandLineTools cargo test -p openlogi-ipc --test wire_format— 13 passed (including round-trip)cargo test -p openlogi-core -p openlogi-ipc -p openlogi-hid -p openlogi-agent-core— passedcargo clippy -p openlogi-core -p openlogi-ipc -p openlogi-agent --all-targets -- -D warnings— cleanRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay— cleanStandaloneDevice { registry_model_id: None }round-trips viabincode::DefaultOptionsbefore/after;Some("8c900")golden unchangedFixes #571