fix(integrations): send no recovery for an incident the first run recorded silently

The watchdog's first pass after a deploy records standing incidents as
announced without paging. Their end then sent a recovery note for
something the operator was never told about. Such incidents now carry
the epoch as their announcement time, which no real announcement can
have, and close without a note.
This commit is contained in:
Marc-André Bombeck committed 2026-10-15 16:42:41 +02:00
1 parent 6dd71f0103
commit 346825149d
4 files changed
+61 -3

No files matched your search

@@ -333,6 +333,24 @@ describe("what pages and what does not", () => {
expect(second.firstRun).toBe(false);
expect(dispatchNotification).not.toHaveBeenCalled();
// It ends without a recovery note: nothing was ever sent about it.
await prisma().measurement.create({
data: {
userId: USER,
type: "RESTING_HEART_RATE",
value: 61,
unit: "bpm",
source: "OURA",
measuredAt: new Date(later.getTime() - 10 * 60 * 1000),
},
});
const recovered = await runIntegrationWatchdog({
mode: "hourly",
now: new Date(later.getTime() + HOUR),
});
expect(recovered.incidentsClosed).toBe(1);
expect(dispatchNotification).not.toHaveBeenCalled();
// A new incident after the first pass pages as usual.
for (let i = 0; i < 3; i++) {
await recordSyncFailure({