Skip to content

fix(onboarding): make the silence detector observably alive - #955

Merged
lilyshen0722 merged 1 commit into
mainfrom
fix/onboarding-alert-liveness
Aug 15, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
fix/onboarding-alert-liveness

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Follow-up to #954, found by verifying it live rather than trusting the deploy.

What happened

#954 deployed successfully at 04:35. The cron registered, the startup line was there, the collection and its three indexes were created. Then the first pass ran and produced no output whatsoever — because the code logged only when it found something.

So from outside, these were identical:

  • the scan ran, nobody is stranded, all is well
  • the scan is dead

That is the pod-summarizer failure — a cron failing every six hours for a month while every component reported success — reproduced inside the service written to catch it. I could only establish it was alive by invoking the deployed service by hand, which is exactly the "a human decides to look" problem #954 exists to end.

An empty result from an unobservable detector is not evidence of a healthy funnel.

Fix

change why
heartbeat to SystemSetting: onboardingSilence.lastScan every pass a mark that survives log rotation and is queryable
one log line per pass, unconditional 288/day is free against this volume, and makes it greppable in kubectl logs
lastScanAt + staleScan on GET /api/admin/analytics/silence lets a reader tell "nothing is broken" from "nothing is watching"

The heartbeat is best-effort and explicitly cannot suppress an alert — a Mongo failure while writing it must not turn a real stranded user into silence. There's a test for that specific ordering.

Verified live before writing this

Ran the deployed service against production (image 3e4a5c3f):

constants:      threshold=15m lookback=24h window=7d
default pass  → scanned=14 opened=0 absorbed=0 resolved=0 skippedNoAgent=0
21-day pass   → scanned=54 opened=10 absorbed=6 skippedNoAgent=1

So detection works — it scanned 14 real messages and correctly found nobody stranded in the live window, and reproduces the same 10 episodes as the pre-merge dry run when given a wider lookback.

Also worth recording: my pre-deploy prediction was wrong. I told Sam the first pass would retroactively alert on ~6–9 historical users. It found zero, because the signup window is 7 days but the message lookback is 24 hours, and the most recent stranded message was ~25 hours old. The two windows are independent and I conflated them. No retroactive batch happens — which is arguably better, but it wasn't what I said.

Those 10 episodes did get written to production by my 21-day verification pass, and I deleted them: they were true, but produced by a hand-run configuration the live cron would never use, and leaving them would make /silence imply the alert had been watching since 08-09. Reproducible on demand with scan({ lookbackHours: 24 * 21 }).

49 tests green, tsc:check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8

Caught during live verification of #954, minutes after it deployed: the
first real pass produced no output at all. The cron logged only when it
found something, so "ran, everything is fine" and "is dead" were
indistinguishable from outside.

That is the pod-summarizer failure — a cron failing every six hours for a
month while every component reported success — reproduced inside the service
written to catch it. An empty result from an unobservable detector is not
evidence of a healthy funnel.

Three changes, all about making absence readable:

- a heartbeat written every pass to SystemSetting `onboardingSilence.lastScan`,
  whatever the pass found
- one log line per pass, unconditionally. 288/day against this log volume is
  free, and it is what makes the thing greppable in `kubectl logs`
- `GET /api/admin/analytics/silence` returns `lastScanAt` and `staleScan`, so
  a reader can tell "nothing is broken" from "nothing is watching"

The heartbeat is best-effort and never suppresses an alert: a Mongo failure
while writing it must not turn a real stranded user into silence. Tested.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
@lilyshen0722
lilyshen0722 merged commit adb3af7 into main Aug 15, 2026
11 checks passed
@lilyshen0722
lilyshen0722 deleted the fix/onboarding-alert-liveness branch August 15, 2026 04:54
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