fix(wallet-monitor): honest log when wallets are low-but-deduped

The no-post branch logged "all wallets healthy" even when wallets were below
threshold but simply already alerted within the reminder window — confusing in
the cron log. Now distinguish: report the low-but-deduped count vs genuinely
all-healthy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
david
2026-06-16 11:32:16 +02:00
parent ac6689275f
commit 900b2259e0

View File

@@ -195,7 +195,14 @@ async function main(): Promise<void> {
`[wallet-monitor] posted roster: ${low.length} low, ${ok.length} ok, ${failed.length} failed`,
);
} else {
console.log("[wallet-monitor] all wallets healthy — no Slack post");
const lowCount = checked.filter(
(c) => c.error === null && c.lovelace !== null && c.lovelace < c.minLovelace,
).length;
console.log(
lowCount > 0
? `[wallet-monitor] ${lowCount} wallet(s) low but already alerted within the reminder window — no Slack post`
: "[wallet-monitor] all wallets healthy — no Slack post",
);
}
// Persist the new state (records ok/low statuses + advanced reminder stamps).