Skip to content

fix(guide): say why alerts are off on plain http on Done, and keep a failed test push only when the PC answered - #4208

Merged
devswha merged 4 commits into
mainfrom
fix/setup-guide-alerts-health
Nov 19, 2026
Merged

devswha merged 4 commits into
mainfrom
fix/setup-guide-alerts-health

Conversation

@devswha

@devswha devswha commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Part of #3898 (two items from the merge note of #3907, and the masked rows of the alerts table).

What

Done on plain http said "Alerts off". Where the page can have no alerts (no Notification API), the alerts step says "This address can't get alerts." and Setup: N left does not count alerts as left, but Done said "Alerts off". alertsSurfaces now answers done: "unavailable" there, and Done shows the step's own sentence.

A Send test that never got the PC's answer was kept as a failed confirmation. Settings' Send test (testDevicePush) recorded sent: false for any error, so a network drop or a restart during the test marked this device's alerts off (on an older server or the open LAN, where the guide reads that record). It now goes through recordTestFailure (src/lib/pushConfirm.ts), which keeps the failure only when the PC answered that it could not push: push_failed, subscription_gone or subscription_not_found, the codes /api/push/test itself answers. A network error, a restart (503), a proxy's own page (a code-less 502), a lapsed sign-in (401), the PC's catch-all 500 internal_error (any route can answer it before the push is tried) or a watching device's read_only keeps the earlier result. Turn on alerts' confirmation push is unchanged: any failure there still records false, so the guide keeps Turn on alerts to try again (the Codex review of the first head).

No new UI: Done reuses the step's existing sentence.

Tests

  • src/lib/setupGuideFlow.test.ts: alertsSurfaces("unavailable").done is "unavailable" (fails on main); three rows of the alertsHere table that isolate the permission, push-support and not-yet-checked rules (each row's other facts are a working, delivered subscription, so no later rule masks them).
  • src/lib/pushConfirm.test.ts: a network error, a 503, a code-less 502, a 401, a 500 internal_error and read_only keep an earlier result; push_failed, subscription_gone and subscription_not_found record a failure. The network case fails on main.

Validation

  • bun test src/lib/setupGuideFlow.test.ts src/lib/pushConfirm.test.ts src/lib/push.test.ts src/lib/useNotifications*.test.ts: pass.
  • bun run typecheck: clean.
  • bun run check fast, setup-dialog-demo-regression, setup-row-demo-regression and push-settings-regression in the CI runner image (hosthatch): setup-dialog-demo-regression, setup-row-demo-regression, ui-regression (the More menu's Alerts item) and ui-contexts-regression (which runs push-settings-regression): pass (BROWSER_RETRY=0). bun run check fast: green except src/lib/useAddressBar.hook.test.ts "keeps the newly listed pane's address when a closed sheet's Back is still landing", which fails 3/3 the same way on clean origin/main 893d3bb in that image (passes locally; GitHub CI green), untouched here.

Left in #3898

Item 1 (alerts from push health, gone/failed/unsupported worded, the rejecting-subscribe regression) was done in #3907 and #3962; the saved at after Back too (#3907, guideStep "moved"). What stays needs the owner or a demo switch; listed on the issue.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • The setup guide now consistently explains that plain-HTTP addresses can’t receive alerts, including in the completion summary.
    • A test notification that receives no response no longer marks device alerts as off. A negative confirmation is recorded only when the service reports that the subscription cannot be reached or is no longer available.
    • Alert setup now distinguishes unavailable delivery from alerts that are simply turned off.

Test-push failures now mark a subscription unavailable only for selected API errors. The setup guide now shows a distinct unavailable state and message for addresses that cannot receive alerts.

Changes: Setup guide alerts

Layer / File(s) Summary
Classify test-push failures
src/lib/pushConfirm.ts, src/lib/push.ts, src/lib/useNotifications.ts, src/lib/pushConfirm.test.ts, changelog.d/setup-guide-alerts-done-and-test-push.md
recordTestFailure records a negative confirmation only for selected API error codes. Other errors, including TypeError and API errors with statuses 503 and 403, leave confirmation unset. The tests also cover negative confirmations for API errors with statuses 502, 410, and 404.
Show unavailable alerts in setup guide
src/lib/setupGuideFlow.ts, src/components/SetupGuide.tsx, src/lib/setupGuideFlow.test.ts
The flow returns done: "unavailable" when alerts are unavailable. The Alerts summary displays “This address can't get alerts.” for that state. Tests cover related alert-state outcomes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • devswha/ovis#3894 — This PR also changes the Done screen alerts presentation and alertsSurfaces.done behavior.
Merge Risk: Minimal · previous review 45d16

This PR changes the Done-screen wording for addresses that can't get alerts and stops recording failed test-push confirmations when the PC gave no qualifying response. The change is narrow and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changes in the PR: the Done-step wording for plain-HTTP alerts and the narrowed recording of failed test pushes. It is specific and matches the changeset, though it is long (11…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the template's two sections, Change and Validation. The Change section explains both fixes, the files touched, and the behavior for each error class. It links the parent issue …
Full details: Title check

Explanation

The title names the two changes in the PR: the Done-step wording for plain-HTTP alerts and the narrowed recording of failed test pushes. It is specific and matches the changeset, though it is long (111 characters) and combines two fixes.

Full details: Description check

Explanation

The description follows the template's two sections, Change and Validation. The Change section explains both fixes, the files touched, and the behavior for each error class. It links the parent issue #3898 and the related PRs. It does not link a maintainer-agreed issue for the feature, but this is a fix, so that is not required. The Validation section lists the commands run, the results, and the one failing test the author reports as pre-existing on main. No section is missing, and the content is specific enough to review.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between be951f1 and 45d16c2.

Files selected for processing: 8

  • changelog.d/setup-guide-alerts-done-and-test-push.md
  • src/components/SetupGuide.tsx
  • src/lib/push.ts
  • src/lib/pushConfirm.test.ts
  • src/lib/pushConfirm.ts
  • src/lib/setupGuideFlow.test.ts
  • src/lib/setupGuideFlow.ts
  • src/lib/useNotifications.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

…ount a PC's own push error as a failed Send test (review of #4208)
@devswha

devswha commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Pushed c9e2050 after the Codex adversarial review of 45d16c2 (VERDICT: BLOCK, two MEDIUMs). The omo review of 45d16c2 was CLEAR.

  • MEDIUM, a PC's own push error (500) no longer marked alerts off. Fixed: any error the PC answers /api/push/test with now counts as a failed Send test, except a restart (503) and a watching device (read_only). Only a request that never got the PC's answer leaves the earlier result.
  • MEDIUM, a dropped first confirmation made the guide count alerts as done. Fixed by leaving Turn on alerts as it was on main: its confirmation push still records a failure on any error, so the guide keeps Turn on alerts. Only Settings' Send test uses the narrower rule.
  • LOW, the Done row's icon reads "Not yet" on plain http. Left as it is: this was already so on main, and the sidebar does not count alerts there.

Tests: pushConfirm.test.ts covers no answer, 503 and read_only (an earlier result kept), and push_failed, subscription_gone, subscription_not_found and internal_error (each recorded as failed). The no-answer case fails on main.

Checks run: bun run check fast in the CI runner image passes, except two tests this PR does not touch:

  • src/lib/useAddressBar.hook.test.ts fails the same way on clean main in that image.
  • scripts/ci-browser-parallel.test.ts "takes a process's name from its executable" failed with the host at load 42.

The browser regressions are still running in that image.

@devswha

devswha commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Pushed d4efa31 after the omo review of c9e2050 (BLOCK):

  • HIGH: the PR body said Turn on alerts goes through the new rule, but it does not. The body was stale; it now says what the code does. Turn on alerts' confirmation push keeps main's behaviour on purpose: any failure records false, so the guide keeps Turn on alerts to try again. That was the Codex review's second MEDIUM, which asked for exactly this. No code changed for this finding.
  • MEDIUM: any ApiError except 503 and read_only counted as a failed push. Fixed with an allow-list of the PC's own could-not-push answers: push_failed, subscription_gone, subscription_not_found and internal_error. The 500 internal_error stays on the list because it is what the PC answers when it failed making the push (the Codex review's first MEDIUM). A proxy's code-less 502, a 401 and a 503 now keep the earlier result, and the test covers each.
  • LOW: no render test of the Done row's plain-http line. Left as is; alertsSurfaces' mapping is tested.

bun run check fast in the CI runner image (hosthatch) passes except src/lib/useAddressBar.hook.test.ts, which fails the same way on clean main in that image.

@devswha

devswha commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Pushed b25caa3 after the Codex delta review of d4efa31 (VERDICT: BLOCK). The omo review of d4efa31 was CLEAR.

  • MEDIUM: the PC's catch-all 500 internal_error can come from the request handler before the push route runs (a startup error) and marked working alerts off.
    • Fixed: only the codes /api/push/test itself returns count as a failed Send test: push_failed, subscription_gone and subscription_not_found. A 500 now keeps the earlier result.
    • The cost: a PC whose push setup is broken (it also answers 500) keeps an earlier result too. Telling the two 500s apart needs a new error code on /api/push/test, which is an HTTP contract change; that is left for the maintainer.
    • This is the side the omo review of c9e2050 argued for.
  • LOW: an older Turn on alerts failure can overwrite a newer successful Send test. Left as it is; that is main's behaviour, which this PR keeps for Turn on alerts on purpose.

bun run check fast in the CI runner image (hosthatch) passes, except src/lib/useAddressBar.hook.test.ts, which fails the same way on clean main in that image and passes on GitHub's runners.

@devswha

devswha commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Reviews of record at b25caa3: omo (dori review) CLEAR, Codex adversarial (gpt-6.2-sol-fast, xhigh, team proxy, delta from d4efa31) CLEAR. Earlier heads' findings and how each was handled are in the comments above.

@devswha
devswha merged commit aa920d1 into main Nov 19, 2026
15 checks passed
@devswha

devswha commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head b25caa340. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

Reviews of record at b25caa3: omo (dori review, receipt devswha__ovis_4208@b25caa34) CLEAR and Codex adversarial (gpt-6.2-sol-fast, xhigh, team proxy, delta from d4efa31) CLEAR; earlier heads' findings resolved as in the PR comments. CodeRabbit did not review this head. Merged by lane followups-setup-links per the brief (merge your own PR when ready).

@devswha
devswha deleted the fix/setup-guide-alerts-health branch November 19, 2026 08:11
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