Repository navigation
fix(alerts): preserve reenabled push and split alert hooks - #1871
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Separate alert signal and menu logic src/lib/useAlerts.ts, src/lib/useAlertSignals.ts, src/lib/alertsBell.ts, src/App.tsx, src/lib/useMachineRoster.ts |
Alert signal handlers and Alerts menu logic move into dedicated modules. App and the roster type import use the new module locations. |
Notification lifecycle and retry regression src/lib/useNotifications.ts, src/lib/useAlerts.ts, src/lib/push.test.ts, src/lib/push.ts, changelog.d/alerts-reenable-retry.md |
The notification module handles permission state, alert switching, and push subscriptions. Native removal retries check whether alerts remain off. The regression test verifies that re-enabling alerts during a visibility change does not send a DELETE request and retains the endpoint. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Possibly related issues
devswha/herdr-web-uiissue 1053 concerns re-enabling alerts and a retired push endpoint; this change addresses the related removal retry during re-enablement.
Possibly related PRs
- devswha/ovis#1769: Splits the combined alert hook into alert preference, notification, signal, and bell units, which this change places in separate modules.
- devswha/ovis#1880: Changes native subscription removal behavior that the notification lifecycle retries.
- devswha/ovis#1817: Adds the native push subscription path used by the notification lifecycle.
Merge Risk: 
Minimal · up to 0ea46
-
The reviewed retry behavior preserves the push subscription when alerts are re-enabled. No issue identified here needs to be fixed before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description includes the required Change and Validation sections. It explains the race condition, resulting behavior, regression coverage, test results, typecheck status, known check failure, and untested flows.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 8 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 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.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass: ordering. This PR splits |
|
Code review (omo-native-code-reviewer) at 6cdd088: APPROVE, no CRITICAL/HIGH/MEDIUM findings.
|
…ck CLI fixture (#1884) Fixes #1875. ## What failed `scripts/check.test.ts` › "check CLI teardown" tests timed out in Fast checks on the self-hosted runners under load: #1871 at 150 s ("bounds interrupted draining…"), #1848 at 90 s ("removes implicit state…": the nested check exited 1 after waiting out the fixture's `CHECK_WAIT_SECONDS=90` for a slot). ## Root cause Since #1839, `check.ts` `main()` runs `applyHostLimits(process.env)`: a runner host's `CHECK_HOST_MAX_RUNS` (5 on the P620) overrides `CHECK_MAX_RUNS`. The fixture builds its nested checks' environment from `...process.env` and sets `CHECK_MAX_RUNS: "8"` so its throwaway runs get a slot beside the PC's real runs (#1225). In a runner container the inherited `CHECK_HOST_MAX_RUNS=5` silently took that back, so they queued for the host's 5 slots behind its real CI runs. ## Fix (test only) The fixture drops every `CHECK_HOST_*` name (`HOST_LIMITS`) from the nested environment, as it already drops `CHECK_DIR` and the GitHub event variables. ## Proof - **Deliberate reproduction** on a private `CHECK_LOCK_PORT` with slot 1 held by a stand-in run and `CHECK_HOST_MAX_RUNS=1`: main fails after 90.5 s with `Expected: 0, Received: 1`, as in #1848; this passes in 0.9 s. - The whole "check CLI teardown" group, 32 runs, 4 at a time, under the same held slot and host limit: 0 failures. - `bun run check fast`: passed (6393 pass, 0 fail). - Reviewed by omo-native-code-reviewer (approve, no blockers: no other test starts `check.ts` `main()` with a herdr slot and inherits the host limits). Test-only: no Codex review, per the lane's policy. Part of the flaky-tests lane. Co-authored-by: mp <mp@local>
6cdd088 to
0ea4667
Compare
|
Rebased onto main after #1848 (f544ee9) and pushed 0ea4667 (was 6cdd088). The delta is the The one conflict:
None of #1848's mute logic remains in Checks on 0ea4667:
|
|
Merge pass review-work report. Overall: PASSED. This is an ordinary client change (a refactor plus a push fix). It is gated by Codex Sol and the code reviewer, plus the merge pass's own checks. It was rebased onto #1848 as agreed.
The split (0ea4667):
#1848's shared mute carried over:
The push fix (db2c584): when alerts are re-enabled before the retry cleanup, the endpoint is kept and registered once. With the guard at Tests: 151, 164 and 172 alerts/push/notification/preferences tests passed across the three runs, and 56 conventions tests passed. The typecheck passes and LOW follow-ups:
|
Change
Turning this device's alerts back on must not let the previous off-state visibility
listener remove its push subscription before React cleans that listener up. Check
the current alerts-on ref before retrying a pending removal.
This follows up on the MINOR items from #1817 in two commits:
5e160436d: fix the re-enable race, add a deterministic regression to the existingpush hook tests, remove the stale permission comment, and add a user-facing changelog.
6cdd088ca: move existing code into focused notification lifecycle, alert signal,and bell modules; keep preference/bookkeeping refs in
useAlerts.ts; update consumers.The split itself does not change behavior.
The existing Alerts interaction stays as documented in DESIGN.md. This fixes
Ovis's native push retry lifecycle rather than introducing a new UI pattern from
Codex, Claude, Paseo, or T3 Code.
Coordination: #1848 (
feat/pane-alert-mute) also editssrc/lib/useAlerts.ts.That branch was not touched. Whichever PR merges second must rebase.
Validation
bun test src/lib/push.test.ts --test-name-pattern 'preserves push when visibility'failed: expected no DELETE, received a DELETE for the existing native endpoint.
The test dispatches
visibilitychangefrom a layout effect during re-enable,before passive-effect cleanup, and subscribes to the registration response.
No fixed sleeps are used.
notifications, droplet, and alert-turn tests pass. Typecheck passes.
git diff --color-moved origin/main...HEADand the second commit's movediff. A TypeScript AST comparison confirmed all 13 non-import top-level statements
from the fix commit remain byte-identical across the four split modules.
dori heavy merge-followups -- bun run check fastexited 1. Workflow syntax,generated types/themes, typecheck, and build passed. There was no failing test
assertion in the captured output; the unit-test step was terminated by SIGKILL
with
check: ended processes left running in step process group 917803.Source fingerprints were unchanged. The maintainer explicitly asked to proceed
for this failure while checking whether origin/main has the same problem.
gpt-6.1-sol, fast tier, xhigh reasoning): no actionable bugs.It also passed typecheck and 83 focused tests. No HIGH findings required fixes.
omo-native-code-reviewerwere rejected by the harness: depth 2 exceeds maximum depth 1. No native-reviewer
verdict is claimed.