From dba45a19423c883457c0079d3c8282b4325b3eb2 Mon Sep 17 00:00:00 2001 From: Emi Griffith Date: Thu, 16 Jul 2026 17:12:14 -0700 Subject: [PATCH] Push: surface delivery failures (no longer a silent success) (#157) A failed web push (e.g. VAPID key mismatch -> 401/403) was swallowed: /push/test still returned 202 and the UI showed 'Sent', while the only trace was a journald WARNING. Now: push.send logs failures to the errors JSONL (phase=push) so they show up like other errors; /push/test returns a 'failed' count; and the 'Send test' button reports 'No device' / 'Sent' / 'Failed' from the real result. Document the VAPID env vars (missing from thermograph.env.example) and how to pin/diagnose them. --- static/subscriptions.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/subscriptions.js b/static/subscriptions.js index dd3bdd2..2b2c2b7 100644 --- a/static/subscriptions.js +++ b/static/subscriptions.js @@ -145,8 +145,16 @@ async function renderPushBar() { btn.disabled = true; const original = btn.textContent; try { - await pushClient.sendTest(); - btn.textContent = "Sent ✓"; + const r = await pushClient.sendTest(); + if (!r.devices) { + btn.textContent = "No device"; + alert("No device is registered for push on this account. Turn alerts off and on again on this device to re-subscribe."); + } else if (r.sent > 0) { + btn.textContent = "Sent ✓"; + } else { + btn.textContent = "Failed"; + alert("The push service rejected delivery to this device. Turn alerts off and on again to re-subscribe; if it keeps failing, the server's push (VAPID) keys may have changed."); + } } catch (err) { alert(err.message || "Couldn't send a test notification."); }