Apply event deduplication window to notifications and refine its key

Gate notification persistence and delivery on the device-event
deduplication window, not just the device_events table: record_event now
reports whether it recorded, and classify_new_device/classify_existing_device
suppress their changes when the sighting is a duplicate.

Treat an empty->value IP fill as not a change via a new ip_changed helper
(mirroring vendor_changed), so a device gaining its first address raises no
"changed" notification.

Key deduplication on (mac, scanner, event_type) instead of (mac, ip,
scanner), so repeated sightings of the same kind collapse regardless of the
reported address.

Also delete stale oott.db-wal/-shm in run_tests.sh to avoid init_db panics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-07 08:17:24 -04:00
co-authored by Claude Opus 4.8
parent 2b808a0147
commit 27cb2e1d62
4 changed files with 200 additions and 35 deletions
+3 -1
View File
@@ -45,7 +45,9 @@ pub fn record_sighting(mut device: Device, scanner: DeviceEventScanner) -> Vec<D
error!("Failed to insert device {}: {err}", device.mac_address);
return Vec::new();
}
vec![events::classify_new_device(device, scanner)]
events::classify_new_device(device, scanner)
.into_iter()
.collect()
}
}
}