fix(gui): reject transient direct device identities#451
Conversation
Greptile SummaryThis PR prevents Bluetooth-direct HID++ probe results that report an all-zero unit ID from becoming persistent device identities or phantom offline cards. It introduces a
Confidence Score: 5/5Safe to merge — the change is well-scoped, all config write paths are guarded, hardware IPC is unaffected, and the new tests cover the main scenarios. The PhysicalDeviceKey abstraction is correctly implemented and consistently applied across every persistence path. The transient-record cleanup in merge_inventory_snapshot and the append_offline_known filtering are logically sound. Tests cover zero-unit identity exclusion, historical-key filtering, same-model physical device distinctness, and migration of stale persisted selections. The one known edge case — a legacy model key and a new physical key for the same device coexisting in config after a binary update — is an acknowledged transitional state that resolves once the device next comes online. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[HID++ Probe Result] --> B{serial_number present and non-empty?}
B -- Yes --> C[DeviceIdentity::Serial]
B -- No / empty --> D{unit_id == 0x00000000?}
D -- Yes --> E[DeviceIdentity::Unit 0]
D -- No --> F[DeviceIdentity::Unit non-zero]
C --> G[physical_key Some]
F --> G
E --> H[physical_key None]
G --> I[DeviceRecord persistent=true]
H --> J[DeviceRecord persistent=false]
I --> K[Config writes allowed]
J --> L[Config writes blocked, HW IPC still sent]
Reviews (2): Last reviewed commit: "fix(gui): reject stale transient lightin..." | Re-trigger Greptile |
Summary
Prevent transient Bluetooth-direct HID++ probe results with all-zero unit IDs from becoming persistent device identities or phantom offline cards.
Changes
openlogi-agent-core: distinguish physical configuration keys from transient runtime identities and exclude all-zero direct identities from the agent device list.openlogi-gui: keep transient live records non-persistent, drop historical all-zero placeholders, and preserve distinct same-model physical devices.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceFixes #387