[AUTO-001] Guard against Discord's 2000-char content limit #1

Closed
opened 2026-07-13 10:44:30 +00:00 by frank · 1 comment
Owner

Task ID: AUTO-001
Priority: P1
Status: TODO


Priority: P1
Status: TODO

Goal: Prevent silent Discord 400 rejections when a text-selection send exceeds Discord's 2000-character content limit.
Why it matters: Formatter.textSelection (formatter.js:7-20) wraps the raw selection with no length check. The popup preview truncates to 200 chars for display only (popup.js:134), so a long selection currently fails with a 400 the user has to decode from raw response text, with no warning beforehand. Flagged in docs/notes/2026-07-10-code-health-pass.md iteration 1.
Scope: Add a length check before send (either truncate with a visible marker, or block send and warn the user) and fix the related bug where a selection containing a triple-backtick sequence breaks out of the wrapping code block early.
Expected files or areas: formatter.js, popup.js, background.js (wherever the send path enforces the check).
Acceptance criteria: A selection over ~2000 chars after formatting is caught before the webhook POST, with a clear user-facing message; a selection containing ``` no longer garbles the sent message.
Validation: Manual test in a loaded extension — send a long selection and a selection containing a code fence, confirm no raw 400 leaks to the user and formatting stays intact.
Risks or assumptions: Assumes truncation (vs. hard block) is acceptable UX; confirm preferred behavior isn't already decided elsewhere.
Notes: None.

Synced from .ai/AUTONOMOUS_PLAN.md by forge sync.

**Task ID:** AUTO-001 **Priority:** P1 **Status:** TODO --- Priority: P1 Status: TODO Goal: Prevent silent Discord 400 rejections when a text-selection send exceeds Discord's 2000-character `content` limit. Why it matters: `Formatter.textSelection` (formatter.js:7-20) wraps the raw selection with no length check. The popup preview truncates to 200 chars for *display only* (popup.js:134), so a long selection currently fails with a 400 the user has to decode from raw response text, with no warning beforehand. Flagged in docs/notes/2026-07-10-code-health-pass.md iteration 1. Scope: Add a length check before send (either truncate with a visible marker, or block send and warn the user) and fix the related bug where a selection containing a triple-backtick sequence breaks out of the wrapping code block early. Expected files or areas: formatter.js, popup.js, background.js (wherever the send path enforces the check). Acceptance criteria: A selection over ~2000 chars after formatting is caught before the webhook POST, with a clear user-facing message; a selection containing ``` no longer garbles the sent message. Validation: Manual test in a loaded extension — send a long selection and a selection containing a code fence, confirm no raw 400 leaks to the user and formatting stays intact. Risks or assumptions: Assumes truncation (vs. hard block) is acceptable UX; confirm preferred behavior isn't already decided elsewhere. Notes: None. *Synced from `.ai/AUTONOMOUS_PLAN.md` by `forge sync`.*
frank added this to the Roadmap v1 milestone 2026-07-13 10:44:30 +00:00
frank closed this issue 2026-07-13 20:19:12 +00:00
Author
Owner

Closed by forge sync — task status changed to DONE.

Closed by `forge sync` — task status changed to DONE.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frank/discord-share-extension#1
No description provided.