test: cover Discord alert delivery, which had never been executed - #71
Merged
Conversation
send_discord had 0% coverage. It is the path a "went offline unexpectedly"
alert takes, and a broken one fails exactly like no alert at all — silence.
That is the same failure mode as the monitor bug this session started with,
and the reason it went unnoticed for weeks.
14 checks with the HTTP layer replaced, so nothing leaves the machine:
delivery a valid webhook sends, to discord.com and nowhere else, as
JSON, with the message as the payload's content
truncation 5000 chars are cut to 1900 — Discord rejects over 2000, and a
rejected alert is a missed alert
refusal seven non-webhook strings (an evil host, plain http, a
discord.com look-alike, a non-numeric id, empty, None) are
refused BEFORE any request is attempted
diagnosis "couldn't reach discord.com" and "Discord rejected it" stay
distinct — different problems for whoever is working out why an
alert never arrived
SSRF _post refuses a URL outside the provider allow-list, asserted
directly against a link-local metadata address
Mutation-verified: dropping the truncation fails 1, accepting any URL as a
webhook fails 5, removing the allow-list fails 2, collapsing the two failure
reasons fails 1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.04% coverage variation (-1.00%) |
| Diff coverage | ✅ ∅ diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (7e2ace5) 11965 5817 48.62% Head commit (16a58eb) 11965 (+0) 5822 (+5) 48.66% (+0.04%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#71) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
send_discordhad 0% coverage. It's the path a "went offline unexpectedly" alert takes, and a broken one fails exactly like no alert at all — silence. That's the same failure mode as the monitor bug this session opened with, and the reason it went unnoticed for weeks.14 checks, HTTP layer replaced so nothing leaves the machine:
http, adiscord.comlook-alike, non-numeric id, empty,None) are refused before any request is attempted_postrefuses a URL outside the provider allow-list, asserted directly against a link-local metadata addressMutation-verified:
unit 839 → 854 · smoke 307 · lint clean.
🤖 Generated with Claude Code