fix(peer): refresh settled install state after operations
The follow-up review found a few stale lifecycle edges around local game transactions. Recovery could sweep active roots, post-operation refreshes still re-ran full startup recovery, and the UI kept inferring local-only state from downloaded and installed flags instead of the backend availability. This updates the peer lifecycle so startup recovery skips active operations, install/update/uninstall refresh only the affected game after the operation guard is dropped, and path-changing game-directory updates are rejected while operations are active. It also removes the dead UpdateGame command, drops the unused manifest_hash write field while preserving old JSON reads, renames the internal install-finished event, and carries availability through the DB, peer summaries, Tauri refreshes, and the React model. The included follow-up documents record the review source, implementation decisions, and the remaining FOLLOW_UP_2.md work so later commits can stay small instead of reopening the completed plan items. Test Plan: - git diff --check - just fmt - just clippy - just test Follow-up-Plan: FOLLOW_UP_PLAN.md
This commit is contained in:
@@ -8,7 +8,14 @@ use std::{
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
use lanspread_db::db::{Game, GameDB, GameFileDescription};
|
||||
use lanspread_db::db::{
|
||||
AVAILABILITY_DOWNLOADING,
|
||||
AVAILABILITY_LOCAL_ONLY,
|
||||
AVAILABILITY_READY,
|
||||
Game,
|
||||
GameDB,
|
||||
GameFileDescription,
|
||||
};
|
||||
use lanspread_proto::{Availability, GameSummary};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -380,12 +387,21 @@ pub(crate) fn game_from_summary(summary: &GameSummary) -> Game {
|
||||
size: summary.size,
|
||||
downloaded: summary.downloaded,
|
||||
installed: summary.installed,
|
||||
availability: availability_label(&summary.availability).to_string(),
|
||||
eti_game_version: summary.eti_version.clone(),
|
||||
local_version: summary.eti_version.clone(),
|
||||
peer_count: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn availability_label(availability: &Availability) -> &'static str {
|
||||
match availability {
|
||||
Availability::Ready => AVAILABILITY_READY,
|
||||
Availability::Downloading => AVAILABILITY_DOWNLOADING,
|
||||
Availability::LocalOnly => AVAILABILITY_LOCAL_ONLY,
|
||||
}
|
||||
}
|
||||
|
||||
struct IndexUpdate {
|
||||
summary: Option<GameSummary>,
|
||||
changed: bool,
|
||||
|
||||
Reference in New Issue
Block a user