generated from alex/base-template
Implement proper IRC multiline handling #21
Labels
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/irc-greeter-bot#21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Refer to https://ircv3.net/specs/extensions/multiline
Obvious bug is currently for forgejo release printing where each single line in the release notes is sent as a single IRC message
/pi fix this in a new PR
Now I have a full picture. Let me write the new pure multiline module first:Now the wiring module:Now wire it into the client creation and the pollers:Now update
forgejo-activity.tsto hand whole messages to the injected poster:Now the test suites for both new modules:The wiring logic is right — my test emitted CAP params incorrectly (the cap list arrives as a single space-joined param). Fixing the test:All 79 pass. Now run the full suite, lint, and fmt:All checks pass. Now an end-to-end smoke test against a scripted fake IRC server to validate the real wire bytes through the actual@irc/client(not just fakes):Wire format matches the spec exactly. Verify line byte-lengths and clean up:Now the docs. README first:Now AGENTS.md — project structure and a short note:The full check suite passes. Let me do a final review of the complete diff and new files:Everything is clean. Final full verification, then create the PR:PR #22 created: #22 (feat: send multi-line announcements as IRCv3 draft/multiline batches)Summary
Implemented the client side of IRCv3
draft/multiline— the extension wasn't available in@irc/client0.23.1 (checked upstream), so it's implemented in-tree following the repo's pure/wiring split:New modules
src/multiline.ts— pure planning: parses themax-bytes/max-linesCAP value, decides batch vs plain delivery, splits over-long lines intodraft/multiline-concatcontinuations (word-boundary preferred, trailing space kept, multi-byte safe), enforces server limits with truncation +…marker, and builds the wire commands with the spec's worst-case 512-byte relay budget per line.src/irc/multiline.ts— wiring: requests the cap at registration, captures limits from the rawCAP LS/NEWexchange (including LS 302 continuation lines), and postsBATCH +ref draft/multiline <target>→ taggedPRIVMSGs →BATCH -ref(sends chained so lines never interleave), falling back to one plainPRIVMSGper non-blank line on servers without the extension. State resets per connection.Changed
src/irc/client.tsattaches the session on every (re)connect; both pollers post through the multiline-aware poster;forgejo-activity.tsnow hands the whole multi-line release-notes text topostin one piece (the old per-linepostMessageLinesis removed), so release notes render as a single message on supporting servers (Ergo, IRCCloud, UnrealIRCd, …) and behave exactly as before elsewhere.PRIVMSGparam).Verification — new unit tests for both modules plus an updated
pollRepotest (305 tests pass); an end-to-end smoke run against a scripted IRC server through the real@irc/clientconfirmed correct wire bytes and cap negotiation.deno fmt --check,lint,check,test, andfalloware all green.View action run | Model: zai/glm-5.2 (thinking: max) | Time: 26m 30s | Tokens: 4.9M | Pi SDK v0.84.0 | Action v2.27.0-develop (develop @ ee8f1d1)