b5d20c1e72
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
2.0 KiB
2.0 KiB
Implementation Decisions
- Added a
just testrecipe so unit tests can be run through the repository's requiredjust ...command surface instead of invokingcargo testdirectly. - Renamed the frontend success event to
game-install-finished; the old unpack name no longer matched the transactional install/update lifecycle. - Implemented watcher rescans by reusing the existing
.lanspread/library_index.jsoncache and updating a single game entry in that index. This satisfies the per-ID optimized rescan requirement without adding a second cache format. - Split full startup recovery from ordinary settled refreshes. Startup and real
SetGameDirchanges run recovery plus a scan; install/update/uninstall completion only rescans the affected game after operation tracking has been cleared. - Rejected path-changing
SetGameDirwhile operations are active. Same-path refreshes are allowed and deliberately skip full recovery so they cannot sweep download transients for in-flight work. - Kept a separate
active_downloadscancellation-token map next to the singleactive_operationstable. The operation table is the authoritative state for gates; the token map is only cancellation plumbing for in-flight downloads. - Treated a downloaded-but-not-installed game as immediately installable from
Tauri by sending
PeerCommand::InstallGamedirectly. A not-downloaded game still usesGetGame, and the peer auto-installs after the sentinel commit. - Removed the dead internal
PeerCommand::UpdateGamepath. The UI update button intentionally sendsGetGame, and the peer infers install versus update from the presence oflocal/after archives are available. - Kept
Availability::Downloadingin the wire protocol for compatibility, but local summaries do not emit it today because active operations are gated out of scans and serving decisions. - Threaded availability through the UI-facing
Gamepayload soLocalOnlyrendering follows backend state instead of reverse-engineering it frominstalled && !downloaded.