Skip to content

test: cover Discord alert delivery, which had never been executed - #71

Merged
FMSMITH91 merged 1 commit into
mainfrom
test/discord-alert-delivery
Aug 9, 2026
Merged

test: cover Discord alert delivery, which had never been executed#71
FMSMITH91 merged 1 commit into
mainfrom
test/discord-alert-delivery

Conversation

@FMSMITH91

Copy link
Copy Markdown
Owner

send_discord had 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:

delivery a valid webhook sends — to discord.com and nowhere else, as JSON, with the message as the payload's content
truncation 5000 chars cut to 1900. Discord rejects over 2000, and a rejected alert is a missed alert
refusal seven non-webhook strings (evil host, plain http, a discord.com look-alike, 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's 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:

drop the truncation to 1900        -> 1 fail
accept any URL as a webhook        -> 5 fail
remove the _post allow-list (SSRF) -> 2 fail
collapse the two failure reasons   -> 1 fail

unit 839 → 854 · smoke 307 · lint clean.

🤖 Generated with Claude Code

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>
@codacy-production

codacy-production Bot commented Aug 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · +0.04% coverage variation

Metric Results
Coverage variation +0.04% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

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.

@FMSMITH91
FMSMITH91 merged commit 0b52813 into main Aug 9, 2026
19 checks passed
@FMSMITH91
FMSMITH91 deleted the test/discord-alert-delivery branch August 9, 2026 14:12
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