mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(integrations): skip the ledger page when the watchdog announced it
A failure streak reaching the alert threshold paged the operator even when the watchdog had already announced an open incident for the same connection. The ledger now checks for that announced incident first, stamps the streak as announced and sends nothing; the watchdog's recovery note still ends it.
This commit is contained in:
1 parent
3e95755c3b
commit
0e5afe76a4
3 files changed
+103
-1
No files matched your search
@@ -361,6 +361,35 @@ describe("what pages and what does not", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("the ledger and the watchdog page once between them", () => {
|
||||
it("does not page a failure streak the watchdog already announced for the connection", async () => {
|
||||
await prisma().integrationWatch.create({
|
||||
data: {
|
||||
userId: USER,
|
||||
integration: "oura",
|
||||
silentSince: new Date(NOW.getTime() - 3 * DAY),
|
||||
incidentReason: "unexpected_silence",
|
||||
incidentOpenedAt: new Date(NOW.getTime() - DAY),
|
||||
alertedAt: new Date(NOW.getTime() - DAY),
|
||||
},
|
||||
});
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await recordSyncFailure({
|
||||
userId: USER,
|
||||
integration: "oura",
|
||||
kind: "transient",
|
||||
message: "Oura error: 503",
|
||||
errorCode: "503",
|
||||
});
|
||||
}
|
||||
expect(dispatchNotification).not.toHaveBeenCalled();
|
||||
const ledger = await prisma().integrationStatus.findUniqueOrThrow({
|
||||
where: { userId_integration: { userId: USER, integration: "oura" } },
|
||||
});
|
||||
expect(ledger.alertedAt).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("recent-call ring", () => {
|
||||
it("keeps the newest ten attempts, newest first, without any message text", async () => {
|
||||
for (let i = 0; i < 7; i++) {
|
||||
|
||||
Reference in new issue
Block a user