test(send): cover the last gate before a message reaches Discord #275
No reviewers
Labels
No labels
move-to-repo
coilyco-bridge-deploy
move-to-repo
coilyco-flight-deck-agent-compose
move-to-repo
coilyco-gaming-eco-app
move-to-repo
coilysiren-inbox
move-to-repo
unknown
🔒⚠️📦⚠️🔒 SANDBOXED 🔒⚠️📦⚠️🔒
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
c#
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-gaming/sirens-echo!275
Loading…
Reference in a new issue
No description provided.
Delete branch "test/send-bounds"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tests only. Found by a coverage sweep during a quiet period, not from a report.
Why these two
go test -coveroninternal/communityreports 76.1%. Most of the uncovered set needs a livediscordgosession —Run,onReady,onMessage,React— which is defensible. Two are pure functions on the send path with zero coverage:truncateRunes— called from six sites across the reply, command, and job paths. It is the last thing that touches a message before it leaves the process.displayName— names the transcript author on every Discord turn.What lands
Boundary on both sides: under, exactly at, one over, far over, empty. One over is the case that matters — it proves the ellipsis replaces a rune rather than joining it, so a truncated value lands exactly on the limit rather than one past it.
Rune counting asserted with accented and emoji input, the same property the turn contract already holds for input.
Tiny limits, because they take a different branch: at 1 and 0 there is no room for both a rune and the ellipsis.
displayNameprecedence — nickname, then global name, then username, then the"member"fallback — including the blank-string cases, which are the ones theTrimSpaceguards exist for.Verified by mutation
Slicing to
limitinstead oflimit-1:One characterization, deliberately not filed
A negative limit panics on the slice —
slice bounds out of range. I did not file it: no caller passes one, all six sites pass a constant, and a latent panic with no reachable path is noise on the tracker.It is worth writing down, though, because the failure mode is bad if it ever becomes reachable — a computed limit would find it at runtime, in the path that sends the member their reply. The test says so, and flips if it is ever made total.
One thing I could not settle
truncateRunesbounds at 1990 runes, and the constant's comment says it "sits under Discord's own 2000". Measured: 10 emoji runes are 19 UTF-16 code units. If Discord's 2000 limit counts UTF-16 rather than code points, a heavily-emoji reply could pass this gate and be rejected by the API.I am not claiming that is a defect — I do not know how Discord counts, and I cannot test it without sending a live message. Recording it because #203 and #221 both push toward more emoji, which is what would make the gap reachable. One 1990-emoji message to a test channel settles it.
Coverage goes 76.1% → 76.4%.
go vet,gofmt, fullgo test ./...,pre-commit run --filesclean.Quail (QA)