Merged
Conversation
wires a Tauri command through the sidecar control plane to POST /helix/chat/messages, with a bottom input bar for sending
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end “send Twitch chat message” path by wiring a new Tauri command to a stdin control command consumed by the Go sidecar, plus a new frontend input UI and helper utilities.
Changes:
- Frontend: adds
MessageInputUI plus shared normalization/byte-limit/error-format helpers with unit tests. - Rust host: introduces
twitch_send_messageTauri command and a sharedSidecarCommandSenderso commands can write control lines to the running sidecar’s stdin; expands Twitch OAuth scopes to includeuser:write:chat. - Go sidecar: adds Helix
POST /chat/messagesclient + validation and a newsend_chat_messagecontrol command handler.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/desktop/src/lib/twitchAuth.ts | Adds sendMessage() invoke wrapper, shared 500-byte constant, and TS error envelope type for UI handling. |
| apps/desktop/src/lib/messageInput.ts | Pure helpers for normalizing outbound text, enforcing byte cap, and formatting structured errors. |
| apps/desktop/src/lib/messageInput.test.ts | Unit tests for message input helpers (trim, byte counting, error formatting, coercion). |
| apps/desktop/src/components/MessageInput.tsx | New UI component to compose and send chat messages via the Tauri command. |
| apps/desktop/src/App.tsx | Renders the new MessageInput below the chat feed when logged in. |
| apps/desktop/src-tauri/src/sidecar_supervisor.rs | Publishes/clears a shared child handle so commands can write to sidecar stdin across respawns/timeouts. |
| apps/desktop/src-tauri/src/sidecar_commands.rs | New Tauri command (twitch_send_message) + shared sender handle + structured frontend error enum. |
| apps/desktop/src-tauri/src/lib.rs | Registers the new command, manages sender state, and adds required OAuth scopes. |
| apps/desktop/src-tauri/src/host.rs | Adds encoder for send_chat_message control command line (JSON + newline). |
| apps/desktop/src-sidecar/internal/twitch/helix.go | Implements Helix SendChatMessage with 500-byte cap validation. |
| apps/desktop/src-sidecar/internal/twitch/helix_test.go | Tests Helix send success, drop reason, empty/oversize validation, and 401 mapping. |
| apps/desktop/src-sidecar/internal/sidecar/sidecar.go | Dispatches send_chat_message command and emits a send_chat_result notification payload. |
| apps/desktop/src-sidecar/internal/control/control.go | Extends control Command schema to carry message bodies for send. |
- MessageInput: aria-label for a11y; treat input as single-line (no Shift+Enter handling) - messageInput: strict per-variant guards in toSendError; add helix variant formatter - sidecar (Go): add request_id to control.Command; echo it on send_chat_result - sidecar_commands: recover from poisoned mutex instead of panicking - correlate Helix drop_reason back to UI via request_id + oneshot completer map - expand test coverage on Go (httptest) and Rust (oneshot/HashMap correlation)
|
This PR has 1343 lines changed. Consider splitting it into smaller PRs for easier review. |
…ants - extract validate_message + advance_request_id helpers from twitch_send_message - cover SendCommandError serde tagging across all variants - add sendMessage frontend test mocking @tauri-apps/api/core
|
This PR has 1486 lines changed. Consider splitting it into smaller PRs for easier review. |
- carve out Pending struct (allocate/cancel/complete/clear) so id allocation and completer routing are testable without IPC - send_with_pending rolls back registration on json/io failure - exhaustively cover toSendError variants on the frontend
|
This PR has 1644 lines changed. Consider splitting it into smaller PRs for easier review. |
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.
Adds the ability to send chat messages from the app via Helix
POST /chat/messages.Backend (Go sidecar)
SendChatMessageonHelixClientwith a 500-byte cap (MaxChatMessageBytes) and structured drop-reason handling.send_chat_messagecontrol command dispatched from stdin; result emitted as asend_chat_resultnotification.msg_duplicate), empty/oversize validation, and 401 unauthorized.Host (Rust / Tauri)
twitch_send_messageTauri command andSidecarCommandSender(Arc<Mutex<Option<CommandChild>>>) shared between the supervisor (publish on connect, clear on terminate/heartbeat-timeout) and the command (writes a control line to sidecar stdin).load_or_refreshso token rotations work over a long sidecar lifetime.user:write:chatto the requested OAuth scopes (alongside the existinguser:read:chat).Frontend (Solid)
MessageInputcomponent pinned below the chat feed: Enter to send, Shift+Enter newline, char/byte validation, inline error status.lib/messageInput.tswith unit tests.Verification
cargo clippy --all-targetscleancargo test --lib148 passedgo test ./...all greenbun run typecheck && bun run lint && bun run test50/50 passed