6242d64583
FINDINGS.md identified three merge blockers in the post-plan install/update flow. Updates now use FetchLatestFromPeers so the Tauri update command bypasses local manifest serving and asks peers that advertise the latest version for fresh file metadata. PeerGameDB now aggregates and validates file descriptions from latest-version peers, keeping stale cached metadata for older versions from poisoning chunk planning when filenames stay the same but sizes change. Download-to-install handoff now performs explicit async state transitions. The download task mutates Downloading to Installing or Updating under the active-operation write lock, clears the cancellation token, and then runs the install transaction. OperationGuard remains armed only as crash or abort cleanup and is disarmed after normal explicit cleanup, so final refreshes no longer race a deferred Drop cleanup. Local library index writers now serialize the load/mutate/save window with one async mutex. The index fingerprint also includes the root version.ini contents so a same-length version rewrite in the same mtime second still updates the reported local version. The tradeoff is that local index mutations are serialized in-process instead of moved into a dedicated actor. That keeps the fix small and scoped to the merge blockers while preserving the existing scanner API. Test Plan: - just fmt - just test - just clippy - just build - git diff --check Refs: - FINDINGS.md
2.1 KiB
2.1 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 now sendsFetchLatestFromPeers, which skips local manifest serving and asks latest-version peers for fresh file metadata before the normal download and update transaction runs. - 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.