-- When, and from which app, a wallet notification arrived. -- -- WHY: one tap emits two notifications 2-8 seconds apart -- the issuer app -- (card tail) and Apple Wallet (merchant, suburb) -- and wallet-ingestion.ts -- merges them. It used to recognise the pair by amount alone, within +/-1 DAY, -- which is wide enough to fold two different purchases together: on 2026-10-01 -- an Amex "$50.00 at A MEDIUM" notification merged into the UNICEF $50 donation -- from 17 hours earlier and renamed it. A real pair is seconds apart and comes -- from two DIFFERENT apps; two notifications from one app are two charges. -- Neither fact was stored anywhere on the ledger side, so the matcher could not -- ask. These columns let it. -- -- Backfilled from capture.wallet_events through source_message_id ('evt:'), -- which every wallet-written metadata row carries. ALTER TABLE expense_metadata ADD COLUMN IF NOT EXISTS notified_at timestamptz, ADD COLUMN IF NOT EXISTS notif_app text; UPDATE expense_metadata em SET notified_at = e.received_at, notif_app = e.notif_app FROM capture.wallet_events e WHERE em.source = 'wallet' AND em.source_message_id = 'evt:' || e.id AND em.notified_at IS NULL;