refactor(peer): split local library and operation UI events
Replace the `a9f9845` local-update dedup cache with explicit peer event semantics. Local scans now emit `LocalLibraryChanged` when the library changes, while operation mutations emit `ActiveOperationsChanged` from the mutation path. Tauri keeps joining those facts into the existing `games-list-updated` payload, so the frontend contract stays stable. This removes the cache/invalidation coupling between scan emission and operation state. The remaining forced local snapshot is explicit: accepted game directory changes can refresh the UI for an equivalent new path without sending a peer library delta. Operation guard cleanup and liveness cancellation now publish the same active operation snapshot as normal command-handler transitions. The peer CLI JSONL events follow the same split with `local-library-changed` and `active-operations-changed`. Test Plan: - `just fmt` - `CARGO_BUILD_RUSTC_WRAPPER= just test` - `CARGO_BUILD_RUSTC_WRAPPER= just clippy` - `git diff --check` Refs: CLEAN_CODE_PLAN_1.md
This commit is contained in:
@@ -132,9 +132,10 @@ pub enum PeerEvent {
|
||||
PeerLost(SocketAddr),
|
||||
/// The total peer count has changed.
|
||||
PeerCountUpdated(usize),
|
||||
/// Local games have been scanned, with authoritative in-progress work.
|
||||
LocalGamesUpdated {
|
||||
games: Vec<Game>,
|
||||
/// The local library contents changed after a scan.
|
||||
LocalLibraryChanged { games: Vec<Game> },
|
||||
/// The set of in-progress local operations changed.
|
||||
ActiveOperationsChanged {
|
||||
active_operations: Vec<ActiveOperation>,
|
||||
},
|
||||
/// A required peer runtime component failed.
|
||||
@@ -168,7 +169,7 @@ pub enum InstallOperation {
|
||||
Updating,
|
||||
}
|
||||
|
||||
/// In-progress operation snapshot attached to local library updates.
|
||||
/// In-progress operation snapshot sent when operation state changes.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ActiveOperation {
|
||||
pub id: String,
|
||||
|
||||
Reference in New Issue
Block a user