test(peer): cover local monitor rescan gating

Add dispatch-level tests for the local game monitor paths called out in
FOLLOW_UP_2.md. The new coverage verifies watcher events are dropped while a
game has an active operation, burst events for one game collapse through the
pending set to at most one extra rescan, fallback scans pick up sideloaded
catalog games, and non-catalog roots stay invisible to the library state.

The non-catalog test exposed that an empty local library initialized with
digest zero, while the computed digest for an empty map is nonzero. That made
the first empty scan produce a meaningless empty LibraryDelta. Initialize the
empty state with the computed empty digest so a non-catalog-only scan leaves no
delta behind.

Test Plan:
- git diff --check
- just fmt
- just clippy
- just test

Follow-up-Plan: FOLLOW_UP_2.md
This commit is contained in:
2026-05-16 09:13:38 +02:00
parent c7b7ab7576
commit 2a94445391
2 changed files with 223 additions and 3 deletions
+4 -2
View File
@@ -17,10 +17,12 @@ pub struct LocalLibraryState {
impl LocalLibraryState {
pub fn empty() -> Self {
let games = HashMap::new();
let digest = compute_library_digest(&games);
Self {
revision: 0,
digest: 0,
games: HashMap::new(),
digest,
games,
recent_deltas: VecDeque::new(),
}
}