Skip to content

Add structured Discord webhook logging for release notifications#2431

Merged
juliusmarminge merged 7 commits into
mainfrom
t3code/discord-webhook-logging
May 1, 2026
Merged

Add structured Discord webhook logging for release notifications#2431
juliusmarminge merged 7 commits into
mainfrom
t3code/discord-webhook-logging

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented May 1, 2026

Summary

  • Add structured logging around Discord release announcement dispatch, including startup, payload construction, request send, response receive, and completion.
  • Log safe request metadata such as webhook origin, path shape, payload size, embed count, and mention usage to improve observability without dumping the full payload.
  • Switch webhook status handling to inspect the actual response before raising an error, and add console pretty logging to the command runtime.

Testing

  • Not run (not requested).
  • Confirmed the command still builds the announcement payload and posts it through the webhook client path.
  • Confirmed non-2xx Discord responses are now logged and converted into DiscordReleaseAnnouncementError.

Note

Medium Risk
Touches the release workflow and Discord webhook notification path; misconfiguration or stricter URL parsing could cause release announcements to fail (though continue-on-error mitigates workflow impact). Adds logging and changes HTTP status handling, which may alter error behavior on non-2xx responses.

Overview
Improves Discord release announcement observability by adding structured logs around command startup, payload construction, webhook request dispatch, and response handling in scripts/notify-discord-release.ts, without logging full secrets/payloads.

Tightens URL typing/validation by treating DISCORD_WEBHOOK_URL as a real URL config and parsing --release-url into a URL (and using .href when building embeds), and updates webhook posting to log/inspect the actual response status before converting non-2xx results into a DiscordReleaseAnnouncementError.

Updates the release workflow to source Discord role IDs from secrets (exposed as DISCORD_MENTION_ROLE_ID) instead of repo vars when invoking the announcement script, and enables pretty console logging via Logger.consolePretty().

Reviewed by Cursor Bugbot for commit 9a15254. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add structured logging and URL validation to Discord release webhook notifications

  • Adds structured logging in postDiscordWebhook before and after dispatch, including webhook URL metadata and payload summary (embed count, mention syntax, content length).
  • Changes releaseUrl and webhook URL types from string to URL, with --release-url now validated via Schema.URLFromString and DISCORD_WEBHOOK_URL validated via Config.url.
  • Adds startup and completion logs to notifyDiscordReleaseCommand with annotations for target, role ID, release name, version, and tag.
  • Switches Discord role ID env vars in the release workflow from vars to secrets.
  • Enables Logger.consolePretty for human-readable output during command execution.
  • Behavioral Change: non-2xx webhook responses now produce a DiscordReleaseAnnouncementError that includes the HTTP status code; invalid DISCORD_WEBHOOK_URL values will fail at configuration time.

Macroscope summarized 9a15254.

- Log webhook request and response metadata
- Log announcement payload summary and command lifecycle
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e31638d9-b5c1-4163-8104-11fb766f5165

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/discord-webhook-logging

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 1, 2026
- Parse `DISCORD_WEBHOOK_URL` with `Config.url`
- Pass a typed `URL` through announcement logging and delivery
- Use `href` when posting the webhook
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 1, 2026

Approvability

A prior Macroscope approval was dismissed. Re-evaluating 342c585

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes May 1, 2026
- Read Discord mention role IDs from secrets in release workflow
- Unify prerelease and latest notifications on `DISCORD_MENTION_ROLE_ID`
@macroscopeapp macroscopeapp Bot dismissed their stale review May 1, 2026 03:37

Dismissing prior approval to re-evaluate 342c585

Julius Marminge added 2 commits April 30, 2026 20:41
- Parse release URLs as `URL` values at the command boundary
- Pass typed URLs through announcement building and webhook posting
- Remove the ad hoc web URL string schema
- Switch Discord release logging to log annotations
- Keep webhook payload and response metadata attached to structured logs
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels May 1, 2026
- Update release notification tests to pass `URL` objects for `releaseUrl`
- Covers both nightly prerelease and stable release announcements
@juliusmarminge juliusmarminge enabled auto-merge (squash) May 1, 2026 03:48
@juliusmarminge juliusmarminge merged commit 17b4396 into main May 1, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the t3code/discord-webhook-logging branch May 1, 2026 03:53
Morphexe pushed a commit to Morphexe/t3code that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant