Skip to content

fix(pm-aggregator): /alerts push panel load-order race + server-rendered saved prefs (#3676) - #3745

Merged
dezren39 merged 1 commit into
mainfrom
fix/alerts-push-panel-load-race
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/alerts-push-panel-load-race

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Drew 2026-11-01, live on his phone: pushes arrive, but the /alerts page says push is not supported, and a saved quiet-hours-off reloads as on.

Root cause: the inline page script runs during parsing; push-client.js loads with defer, so window.pmPush does not exist yet at the first refreshStatus(). The old code treated that absence as an incapable browser — painted the unsupported guide and returned before applyPrefs could run. Click-time actions (Enable, Save, test) worked because by then the deferred script had loaded, and the save itself always persisted (verified: alerts.push_subscriptions.quiet.enabled=false, last_seen at his save).

Fixes:

  • Support judged from the window directly (PushManager/Notification/serviceWorker); pmPush awaited with a bounded poll before use.
  • The push form initial state is server-rendered from the newest stored subscription: checkbox states, stored quiet window, time inputs disabled when quiet hours are off. The saved truth shows on load with no client JS at all.
  • Prefs lookup falls back to the single stored subscription when the browser endpoint has rotated.
  • Save preferences confirms in place, stating the saved values in words — no reload.

Tests: 7 new render tests in test/alerts.test.ts (alerts suite 29/29). Full suite 887 pass / 2 fail — both failures reproduce on unmodified origin/main (slice3 routes; snapshot-lock timing under load).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…w, render saved prefs server-side (#3676)

Drew 2026-11-01: pushes worked while the page said "not supported", and a saved quiet-hours-off reloaded as on. Root cause: the inline page script runs during parsing while push-client.js loads with defer, so window.pmPush did not exist at the first refreshStatus() — the old code read that absence as an incapable browser, painted the unsupported guide, and returned before applying saved prefs. The save itself always persisted (verified in alerts.push_subscriptions).

Fixes: capability checked against window directly (PushManager/Notification/serviceWorker); pmPush awaited with a bounded poll; the push form initial state is server-rendered from the newest stored subscription (checkbox states, quiet window, disabled time inputs); prefs lookup falls back to the single stored subscription when the endpoint has rotated; Save preferences confirms in place with the saved values in words instead of reloading. 7 new render tests; alerts suite 29/29. Full suite: 2 failures that also fail on unmodified origin/main (slice3 routes, snapshot-lock timing).
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 15:10
@dezren39
dezren39 merged commit 3cd23c7 into main Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d3b26813-73fb-4e22-ac5e-3d1ac76b5be2
Commits

Reviewing files that changed from the base of the PR and between 5fa0650 and 652e869.

Files selected for processing: 2
  • pm-stack/aggregator/src/render.ts
  • pm-stack/aggregator/test/alerts.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T15:11:40.723624Z 652e869 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 deleted the fix/alerts-push-panel-load-race branch November 1, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant