Adds mergeRow(list, row) which deduplicates by id (replace in place,
preserving the read flag) or appends. ingest(row) calls mergeRow and
recomputes unreadCount by full scan instead of the brittle += 1.
acceptNativeNotification now routes through ingest instead of concat,
fixing the append-duplicate bug for any code path that emits the same
native id twice (e.g. persistence reload).
selfTest() exercises the three mergeRow invariants (dedup, content
update, distinct ids) and is exposed as the notificationsSelfTest IPC.
Empirical replace-by-id observation: Quickshell mutates the native
notification QML object in-place and does NOT re-emit onNotification
for a freedesktop replace-by-id request. activeCount stays at 1 after
notify-send -r (no duplicate card), but the normalized rows snapshot
retains the original body since acceptNativeNotification only fires on
first delivery. The UI binds to the live native object so it reflects
the update; IPC snapshots do not.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>