Skip to content

fix(gui): drop disconnected devices from carousel#282

Open
davidbudnick wants to merge 1 commit into
AprilNEA:masterfrom
davidbudnick:fix/issue-280-disconnected-render
Open

fix(gui): drop disconnected devices from carousel#282
davidbudnick wants to merge 1 commit into
AprilNEA:masterfrom
davidbudnick:fix/issue-280-disconnected-render

Conversation

@davidbudnick

@davidbudnick davidbudnick commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #280

Context

Testing

  • fmt + clippy --workspace --all-targets -D warnings clean
  • cargo test --workspace passes
  • relaunched the gui, no phantom cards, shows "no devices connected"

Demo

Screen.Recording.2026-06-17.at.12.33.50.AM.mov

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes the DeviceIdentity persistence mechanism introduced in #224, which was causing fully disconnected devices to remain as phantom "shadow cards" in the carousel (#280). The carousel is now driven solely by the live HID++ inventory, with transient probe blips handled by the existing INVENTORY_MISS_GRACE = 2 window in merge_inventory_snapshot.

  • config.rs: Deletes the DeviceIdentity struct, the identity field on DeviceConfig/RawDeviceConfig, and the three associated Config methods (device_identity, set_device_identity, known_identities), along with the roundtrip test.
  • state.rs: Removes persist_identities and its three call sites; drops the now-unnecessary mut on the config parameter in with_runtime; narrows the build_device_list signature to drop the Config argument.
  • state/devices.rs: Deletes append_offline_known, offline_record, and model_info_from_legacy_model_key, with corresponding test cleanup; the remaining build_device_list function iterates only the live inventory.

Confidence Score: 5/5

Safe to merge — a well-scoped removal of the offline-identity persistence layer with no new logic introduced.

The change is a pure deletion: structs, methods, and call-sites that implement the phantom-card feature are removed uniformly across all three crates, tests are updated to match, and the remaining code (merge_inventory_snapshot with its grace-period logic) is untouched. Existing config files with identity fields will deserialize silently and cleanly because serde ignores unknown keys by default. No new code paths are introduced that could regress.

No files require special attention.

Important Files Changed

Filename Overview
crates/openlogi-core/src/config.rs Removes DeviceIdentity struct, its DeviceConfig field, RawDeviceConfig field, three Config methods, and the roundtrip test; serde's default ignore-unknown-fields behaviour means existing TOML files with identity data load safely.
crates/openlogi-gui/src/state.rs Removes persist_identities and its three call sites; drops mut on config in with_runtime; build_device_list call sites lose the Config argument; merge_inventory_snapshot unchanged and still handles transient misses.
crates/openlogi-gui/src/state/devices.rs Removes append_offline_known, offline_record, model_info_from_legacy_model_key and corresponding tests; build_device_list now purely iterates live inventory without a Config argument.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Agent as HID++ Agent
    participant RI as refresh_inventories
    participant BDL as build_device_list
    participant MIS as merge_inventory_snapshot
    participant Carousel as Carousel UI

    Agent->>RI: inventory snapshot (live devices only)
    RI->>BDL: build from live inventory
    BDL-->>RI: "Vec<DeviceRecord> (live only)"
    RI->>MIS: merge with previous list
    note over MIS: Keeps device through ≤2 consecutive misses<br/>(INVENTORY_MISS_GRACE = 2)
    MIS-->>RI: merged list
    RI->>Carousel: update device_list

    note over Agent,Carousel: Fully disconnected device absent >2 snapshots → drops from carousel
    note over Agent,Carousel: Previously: DeviceIdentity persisted to config.toml<br/>and offline placeholder added back — now removed
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Agent as HID++ Agent
    participant RI as refresh_inventories
    participant BDL as build_device_list
    participant MIS as merge_inventory_snapshot
    participant Carousel as Carousel UI

    Agent->>RI: inventory snapshot (live devices only)
    RI->>BDL: build from live inventory
    BDL-->>RI: "Vec<DeviceRecord> (live only)"
    RI->>MIS: merge with previous list
    note over MIS: Keeps device through ≤2 consecutive misses<br/>(INVENTORY_MISS_GRACE = 2)
    MIS-->>RI: merged list
    RI->>Carousel: update device_list

    note over Agent,Carousel: Fully disconnected device absent >2 snapshots → drops from carousel
    note over Agent,Carousel: Previously: DeviceIdentity persisted to config.toml<br/>and offline placeholder added back — now removed
Loading

Reviews (4): Last reviewed commit: "fix(gui): drop disconnected devices from..." | Re-trigger Greptile

@davidbudnick davidbudnick mentioned this pull request Jun 17, 2026
15 tasks
@davidbudnick

Copy link
Copy Markdown
Contributor Author

@AprilNEA Any chance you could look at this one, its leaving lots of devices lingering when switching between my work and home macbook.

@davidbudnick davidbudnick force-pushed the fix/issue-280-disconnected-render branch from da18ba3 to 9a84268 Compare June 22, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Disconnecting Keyboard/Mouse devices don't refresh

1 participant