fix(notifications): split Discord issue batches over 2,000 characters - #367
Open
Furox-Art wants to merge 1 commit into
Open
fix(notifications): split Discord issue batches over 2,000 characters#367Furox-Art wants to merge 1 commit into
Furox-Art wants to merge 1 commit into
Conversation
Discord rejects webhook payloads whose content exceeds 2,000 characters, and a batch of roughly 30 new issues already passes that limit. The rejected send also escaped the sequential repository loop in main(), so later repositories were not notified in that run.
notifyDiscord() now splits the message at line boundaries, falling back to a bounded split that never breaks a UTF-16 surrogate pair, and sends the chunks sequentially. allowedMentions: { parse: [] } and the existing failure semantics are preserved.
Closes tscircuit#359
|
@Furox-Art is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #359
Problem
notifyDiscord()joins every new issue for a repository into a singlecontentstring and sends it with no length check. Discord rejects webhook payloads over 2,000 characters, and a batch of ~30 issues with ordinary-length titles already exceeds that. A rejected send also escapes the sequential repository loop inmain(), so later repositories are not notified in that run.Fix
lib/utils/splitDiscordContent.ts: splits content into chunks of at most 2,000 characters.\nreproduces the input, so no notification is silently dropped.notifyDiscord()now sends the chunks sequentially, preservingallowedMentions: { parse: [] }(no link previews) and the existing failure semantics — a transport failure still propagates, with no automatic retry.Scope is deliberately narrow:
main()'s error handling is unchanged.Validation
tests/test-discord-content-splitting.test.ts— 8 cases: empty content, below limit, exactly at the limit, one over, the 30-issue batch from the issue (every entry preserved, every chunk within the limit), a surrogate pair at the boundary, a single over-long line, and multiline content.tsc --noEmitclean,biome formatclean on the touched files.