Repository navigation
fix(alerts): keep pending alerts off a new webhook destination and keep a reachable link base - #2965
Conversation
…a reachable link base An alert scheduled before the destination changed no longer goes to the new one: push.ts records the destination's generation when it schedules the alert, and the webhook drops it if the destination changed since. A save from this PC's own loopback address no longer replaces a saved base other devices can open. The view says whether messages carry such a link, and the form tells the user when none is known yet. Fixes #2943
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Review round (omo + Codex Terra xhigh), resolved in this PR:
Validation at the head: |
|
Local merge gate (owner-approved): |
Fixes #2943
Two edge cases of the alert webhooks (#2940), both reproduced first by a test that fails on main.
1. A pending alert no longer reaches a destination set after it arose
server/push.tsnow records the destination's generation (AlertWebhook.generation(), bumped by a save that changes the URL/token/chat or by a removal) when it schedules a status or error alert, and passes it with the alert.send()drops an alert whose generation no longer matches. A save that only flips alert choices keeps the generation, so it does not drop anything. Device push timers are unchanged.2. A loopback save keeps a reachable link base
save()keeps a saved base that another device can open when the save comes from this PC's loopback address (relay saves already kept it). A loopback base is still stored when nothing better is known.AlertWebhookViewgainsreachable_link, and Settings → Alerts → Also send to shows a hint when messages have no link a phone can open yet (for example after a first save over the relay or from localhost). The demo transport does the same check, so the existing demo regression now asserts the hint.Validation
bun test server/alert-webhook.test.ts src/lib/i18n.test.ts server/push.test.ts: 124 pass (the two new tests fail on main: one alert reached the new destination;reachable_linkwas missing and the link pointed at 127.0.0.1).bun scripts/alert-webhook-demo-regression.tswith screenshots: PASS at 390 and 1280, light and dark.bun run check fastat the head: pass (11953 unit tests, typecheck, build).A pre-PR Codex review found that an IPv4-mapped loopback origin (
[::ffff:127.0.0.1], whichURLwrites as[::ffff:7f00:1]) still counted as reachable, and that the demo's loopback check differed from the server's; both are fixed in the second commit with a test.