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:
2026-05-16 08:50:51 +02:00
parent fce34c7bd2
commit b5d20c1e72
22 changed files with 1389 additions and 131 deletions
+14 -6
View File
@@ -40,6 +40,7 @@ interface Game {
thumbnail: Uint8Array | number[];
downloaded: boolean;
installed: boolean;
availability: GameAvailability;
install_status: InstallStatus;
eti_game_version?: string;
local_version?: string;
@@ -48,6 +49,12 @@ interface Game {
peer_count: number;
}
enum GameAvailability {
Ready = 'Ready',
Downloading = 'Downloading',
LocalOnly = 'LocalOnly',
}
interface GameThumbnailProps {
gameId: string;
alt: string;
@@ -105,6 +112,7 @@ const mergeGameUpdate = (game: Game, previous?: Game): Game => {
return {
...game,
availability: game.availability ?? (game.downloaded ? GameAvailability.Ready : GameAvailability.LocalOnly),
install_status: installStatus,
status_message: localStateChanged ? undefined : previous?.status_message,
status_level: localStateChanged ? undefined : previous?.status_level,
@@ -289,11 +297,11 @@ const App = () => {
}, [gameDir]);
useEffect(() => {
// Listen for game-unpack-finished events specifically
const setupUnpackListener = async () => {
const unlisten = await listen('game-unpack-finished', (event) => {
// Listen for game-install-finished events specifically
const setupInstallFinishedListener = async () => {
const unlisten = await listen('game-install-finished', (event) => {
const game_id = event.payload as string;
console.log(`🗲 game-unpack-finished ${game_id} event received`);
console.log(`🗲 game-install-finished ${game_id} event received`);
clearCheckingPeersTimeout(game_id);
setGameItems(prev => prev.map(item => item.id === game_id
? {
@@ -316,7 +324,7 @@ const App = () => {
return unlisten;
};
setupUnpackListener();
setupInstallFinishedListener();
}, [gameDir]);
useEffect(() => {
@@ -739,7 +747,7 @@ const App = () => {
<span className="size-text">{(item.size / 1024 / 1024 / 1024).toFixed(1)} GB</span>
</div>
<div className="badges">
{item.installed && !item.downloaded && (
{item.installed && item.availability === GameAvailability.LocalOnly && (
<span className="badge local-only">LocalOnly</span>
)}
{!item.installed && item.downloaded && item.local_version && (