docs(peer): document transactional install model

Update the peer README and architecture notes to match the landed runtime:
version.ini is the download sentinel, local/ is the install predicate, install
state is recovered through .lanspread.json intents, and watcher rescans are
operation-gated rather than time-debounced.

Add IMPL_DECISIONS.md with the implementation-time choices that were not
already prescribed by PLAN.md, including the just test recipe, the UI event
compatibility bridge, reuse of the existing library index for per-ID rescans,
and the split between active operation state and download cancellation tokens.

Test Plan:
- just fmt
- just clippy
- just test
- just build

Refs: PLAN.md
This commit is contained in:
2026-05-15 18:21:09 +02:00
parent c5dfbf99a0
commit fce34c7bd2
3 changed files with 106 additions and 36 deletions
+20
View File
@@ -0,0 +1,20 @@
# Implementation Decisions
- Added a `just test` recipe so unit tests can be run through the repository's
required `just ...` command surface instead of invoking `cargo test`
directly.
- Kept the existing frontend `game-unpack-finished` event name for successful
transactional installs. The peer now emits install lifecycle events, but the
compatibility event still lets the UI reuse its existing "install complete"
path.
- Implemented watcher rescans by reusing the existing `.lanspread/library_index.json`
cache and updating a single game entry in that index. This satisfies the
per-ID optimized rescan requirement without adding a second cache format.
- Kept a separate `active_downloads` cancellation-token map next to the single
`active_operations` table. 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::InstallGame` directly. A not-downloaded game
still uses `GetGame`, and the peer auto-installs after the sentinel commit.
- Derived the UI's `LocalOnly` badge from `installed && !downloaded` because the
UI-facing `Game` type does not carry the protocol-level `Availability` enum.