Skip to content

fix(rebalance): confirm a failure page was sent, and stop doubling its punctuation - #78

Merged
robertleifke merged 1 commit into
mainfrom
fix/alert-failure-path-polish
Sep 22, 2026
Merged

robertleifke merged 1 commit into
mainfrom
fix/alert-failure-path-polish

Conversation

@robertleifke

Copy link
Copy Markdown
Contributor

Two defects found by running the drill and reading what reached the channel, not by reading the code.

The failure path posted silently

The healthy path prints heartbeat posted. A check that could not run printed nothing about its alert — so the run that matters most was the one giving the operator no sign the page had gone out. A webhook that quietly succeeded but reached nobody would have looked identical from the terminal.

It now prints failure alert posted on success, alongside the existing failure alert could not be posted.

The message doubled its punctuation

viem's errors already end in ., and the drill put this in the ops channel verbatim:

[TEST] cNGN rebalance check FAILED TO RUN (sub 15): HTTP request failed.. Inventory is UNKNOWN, not healthy — nothing has been checked.

Trailing punctuation is stripped from the reason now. Cosmetic — but it's the message someone reads at 3am, and it was only visible because a human pasted back what actually arrived.

Tests

Two, pinning both: one captures console.error and asserts the confirmation line appears; the other asserts the composed text contains no ... 30 tests total, ./scripts/verify.sh node green.

Context

Closes out the drill from #76. Both [TEST]-prefixed messages were confirmed received in the ops channel by eye — the webhook is write-only, so a 2xx proves acceptance, not delivery, and that distinction is what surfaced both of these.

🤖 Generated with Claude Code

…s punctuation

Both found by running the drill and reading what actually reached the channel,
rather than by reading the code.

The failure path posted silently. The healthy path prints 'heartbeat posted',
but a check that could NOT run printed nothing about its alert -- so the run
that matters most was the one giving the operator no sign the page had gone
out. A webhook that quietly succeeded-but-reached-nobody would have looked
identical. It now prints 'failure alert posted' on success, alongside the
existing 'could not be posted' on failure.

And the message carried doubled punctuation. viem's errors already end in '.',
and the drill put this in the ops channel:

  [TEST] cNGN rebalance check FAILED TO RUN (sub 15): HTTP request failed..

Trailing punctuation is stripped from the reason now. Cosmetic, but it is the
message someone reads at 3am.

Two tests pin both: one captures console.error and asserts the confirmation
line, the other asserts the composed text contains no '..'.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@robertleifke
robertleifke merged commit 763c56c into main Sep 22, 2026
1 check passed
@robertleifke
robertleifke deleted the fix/alert-failure-path-polish branch September 22, 2026 22:22
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