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:
@@ -2,7 +2,12 @@
|
||||
|
||||
use std::{collections::HashMap, net::SocketAddr, sync::Arc};
|
||||
|
||||
use lanspread_db::db::Game;
|
||||
use lanspread_db::db::{
|
||||
AVAILABILITY_DOWNLOADING,
|
||||
AVAILABILITY_LOCAL_ONLY,
|
||||
AVAILABILITY_READY,
|
||||
Game,
|
||||
};
|
||||
use lanspread_proto::{Availability, GameSummary};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
@@ -26,10 +31,12 @@ pub async fn ensure_peer_id_for_addr(
|
||||
}
|
||||
|
||||
pub fn summary_from_game(game: &Game) -> GameSummary {
|
||||
let availability = if game.downloaded {
|
||||
Availability::Ready
|
||||
} else {
|
||||
Availability::LocalOnly
|
||||
let availability = match game.availability.as_str() {
|
||||
AVAILABILITY_READY => Availability::Ready,
|
||||
AVAILABILITY_DOWNLOADING => Availability::Downloading,
|
||||
AVAILABILITY_LOCAL_ONLY => Availability::LocalOnly,
|
||||
_ if game.downloaded => Availability::Ready,
|
||||
_ => Availability::LocalOnly,
|
||||
};
|
||||
|
||||
GameSummary {
|
||||
|
||||
Reference in New Issue
Block a user