Skip to content

feat: Sentry sustained-presence & panic alerts#161

Open
JordiMa wants to merge 2 commits into
abarghoud:testingfrom
JordiMa:feat/sentry-presence-alerts
Open

feat: Sentry sustained-presence & panic alerts#161
JordiMa wants to merge 2 commits into
abarghoud:testingfrom
JordiMa:feat/sentry-presence-alerts

Conversation

@JordiMa

@JordiMa JordiMa commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds two security alerts driven by the SentryMode telemetry stream (the proven, streamable signal):

  • 🚨 Sustained presence — when the vehicle stays in Sentry "Aware" (someone lingering around it) past a threshold, the owner gets a critical alert, re-alerted at a fixed cadence while the person remains, capped to avoid spam, ending with a clear "last reminder — no more alerts for this incident".
  • 🚨 Panic — when Sentry escalates to "Panic" (alarm), a critical alert is sent.

The existing immediate Sentry "Aware" alert is kept.

Behaviour

(immediate)  Sentry alert (Warning)
+15s         critical "someone is lingering"          (1/3)
+30s         critical "someone is lingering"          (2/3)
+45s         critical "LAST REMINDER — still around,  (3/3, final)
             no more alerts for this incident"
             -> stops until the vehicle leaves Aware

Configuration

SENTRY_SUSTAINED_AWARE_SECONDS=15   # re-alert cadence (and initial threshold)
SENTRY_SUSTAINED_MAX_REPEATS=3      # safety cap per Aware episode

The cap also protects against an infinite loop if the vehicle goes offline while Aware.

Implementation notes

  • New first-class alert types (sustained_presence, sustained_presence_final, panic) shown distinctly on Telegram, push, and the in-app history (FR/EN) — no generic fallback (resolveAlertTexts is an exhaustive Record<AlertEventType, …>, so a missing type is a compile error).
  • SentryPresenceTrackerService manages a per-VIN re-alert interval with the cap + per-episode reset.
  • Migration adds the new enum values to alert_events_type_enum.

Tests

  • API: 127 alerts / notifications / telegram specs green
  • Mobile: 23 alert specs green
  • Type-clean & lint-clean on changed files

Alert the owner when the vehicle stays in Sentry "Aware" (someone lingering
around the vehicle) and when Sentry escalates to "Panic" (alarm), using the
SentryMode telemetry stream.

- Sustained presence: re-alerts every SENTRY_SUSTAINED_AWARE_SECONDS while Aware,
  capped at SENTRY_SUSTAINED_MAX_REPEATS, with a final "no more alerts for this
  incident" reminder; resets when the vehicle leaves Aware.
- New first-class alert types (sustained_presence, sustained_presence_final,
  panic) shown distinctly on Telegram, push, and the in-app history (FR/EN).
- Keeps the existing immediate Sentry alert on every Aware.
@JordiMa JordiMa requested a review from abarghoud as a code owner June 18, 2026 17:56
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