From 7faec49a42d54657fe6b6472a32513ed723b9974 Mon Sep 17 00:00:00 2001 From: ort Date: Sat, 15 Aug 2026 17:03:00 -0400 Subject: [PATCH] Log push send outcomes, not just failures notifyHouseholdParents only logged on error -- a fully successful send produced zero output, which is indistinguishable from the two silent early-return paths (push not configured, no subscriptions for the household). Made all three paths log explicitly, so "grep logs for push" actually tells you what happened instead of leaving success and several failure modes looking identical. --- src/lib/push.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/push.js b/src/lib/push.js index 513f254..d3d8743 100644 --- a/src/lib/push.js +++ b/src/lib/push.js @@ -25,10 +25,16 @@ const listSubscriptionsForHouseholdStmt = db.prepare(` const deleteSubscriptionStmt = db.prepare('DELETE FROM push_subscriptions WHERE id = ?'); async function notifyHouseholdParents(householdId, payload) { - if (!pushReady) return; + if (!pushReady) { + console.log('[push] skipped — push not configured/ready'); + return; + } const subs = listSubscriptionsForHouseholdStmt.all(householdId); - if (subs.length === 0) return; + if (subs.length === 0) { + console.log(`[push] skipped — no subscriptions for household ${householdId}`); + return; + } const body = JSON.stringify(payload); @@ -43,6 +49,7 @@ async function notifyHouseholdParents(householdId, payload) { .catch((err) => { if (err.statusCode === 404 || err.statusCode === 410) { deleteSubscriptionStmt.run(sub.id); + console.error('[push] subscription gone, pruned', sub.id, err.statusCode); } else { console.error('[push] send failed', sub.id, err.statusCode, err.message); } @@ -51,6 +58,9 @@ async function notifyHouseholdParents(householdId, payload) { ) ); + const succeeded = results.filter((r) => r.status === 'fulfilled').length; + console.log(`[push] sent to ${succeeded}/${subs.length} subscription(s) for household ${householdId}`); + return results; }