GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(aggregator): alert throat — sentinel intake, Supabase ledger, Web Push delivery + ack (#3676) by dezren39 · Pull Request #3680 · developing-today/code Conversation
|
|
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 58 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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: f7b849b7c0
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const summary = await deliverToAll(store, targets, incident, cfg.publicOrigin, false); | ||
| await store.markDelivered(incident.id, { ...summary }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Keep failed deliveries eligible for retry
When every push attempt fails, such as during a push-provider outage, deliverToAll() returns a summary with zero successful sends, but the engine still sets delivered_at. This removes the incident from subsequent delivery ticks despite nobody receiving it. The escalation path likewise sets escalated_at after failed sends, permanently exhausting both notification opportunities if the outage spans the acknowledgement window. Only finalize a delivery or escalation after successful delivery, and retain failed attempts for retry.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| configurePromise = (async () => { | ||
| const priv = await resolveBwsSecret(VAPID_PRIVATE_KEY_SECRET); | ||
| if (!priv) return false; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Retry VAPID initialization after a failed secret lookup
If Bitwarden is temporarily unavailable on the first push attempt, this caches a promise resolving to false indefinitely. Subsequent calls reuse that promise instead of retrying secret resolution, even after the secret cache's five-minute expiry and Bitwarden recovery. The HTTP 401/403 reset cannot recover this state because sendPush() returns before contacting the provider. Clear unsuccessful initialization promises so a transient lookup failure does not disable all push delivery until the server restarts.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!clientPromise) { | ||
| clientPromise = (async () => { | ||
| const token = await resolveBwsSecret("supabase.access-token-muse-cli"); | ||
| if (!token) return null; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Allow the alerts store to recover from unavailable credentials
If the first management-token lookup fails temporarily, clientPromise permanently retains the resulting null, and getAlertsStore() additionally caches that unavailable result in storePromise. Consequently intake, acknowledgement, and the delivery engine remain unavailable after Bitwarden recovers; the periodic engine ticks never attempt initialization again. Retry unsuccessful initialization at both cache layers rather than requiring a process restart to restore the entire alert pipeline.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| <label><input type="checkbox" id="push-class-incident" checked> incident class</label> | ||
| <label>quiet <input type="time" id="push-quiet-start" value="23:00">–<input type="time" id="push-quiet-end" value="07:00"></label> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Populate preference controls from the saved subscription
For an existing subscription, these controls always render the defaults rather than its saved preferences, and neither the inline script nor push-client.js subsequently loads those preferences. After disabling the incident class and reloading, changing only the quiet-hour start and clicking Save preferences submits incident: true and the default quiet-hour end, silently undoing the notification opt-out and other saved settings. Initialize the controls from the subscription matching this browser's endpoint before allowing preference updates.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const sub = await window.pmPush.current().catch(() => null); | ||
| status.textContent = sub ? "This browser is subscribed — pushes will land here." : "This browser is not subscribed yet."; | ||
| } | ||
| refreshStatus(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Check push support after the deferred client initializes
On every normal Alerts page load, this inline script calls refreshStatus() during HTML parsing, before the deferred /assets/push-client.js script emitted by layout() executes. Consequently window.pmPush is still undefined and the page reports that Web Push is unsupported even in supported, already-subscribed browsers. Nothing refreshes the status after the client initializes. Run this initialization after the deferred script, such as on DOMContentLoaded, so the displayed delivery status reflects the browser's actual subscription.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ); | ||
| if (rows[0]) { | ||
| await this.addEvent(id, "acked", {}); | ||
| await this.db.query( | ||
| `update alerts.notification_sends set acted_on_at = now() where incident_id = ${sqlStr(id)} and acted_on_at is null`, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Commit acknowledgement state and ledger writes atomically
If the acknowledgement event insertion fails after the preceding status update succeeds, the request fails but the incident remains acked. A retry cannot repair the missing event or stamp notification_sends.acted_on_at: the update's status = 'open' predicate no longer matches, so both follow-up writes are skipped permanently. Execute the status transition, event insertion, and send updates in one database transaction so a transient query failure cannot leave an acknowledged incident without its durable acknowledgement record.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| objectRef: incidentObjectRef(incident.id), | ||
| url: incidentUrl(origin, incident.id), | ||
| title: escalation ? `Escalation: ${incident.title}` : incident.title, | ||
| body: escalation ? `Still unacknowledged: ${base} (source: ${incident.source})` : `${base} (source: ${incident.source})`, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Bound notification content to the Web Push payload budget
For incidents containing long diagnostic output, intake accepts the complete body and this function embeds it unbounded into the push payload. A valid 4,000-byte diagnostic body already makes the plaintext JSON exceed the 3,993-byte budget supported by services enforcing the standard 4,096-byte encrypted-payload limit, so those providers reject the notification regardless of retries. RFC 8291 §4 specifies these limits. Apply a UTF-8 byte budget to the complete serialized notification, truncating its display text while retaining the full diagnostics in the ledger and linked incident page.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.