ipc: address post-review feedback on unified JSON-RPC layer#5
Merged
darkliquid merged 5 commits intofeat/protojsonfrom Mar 15, 2026
Merged
ipc: address post-review feedback on unified JSON-RPC layer#5darkliquid merged 5 commits intofeat/protojsonfrom
darkliquid merged 5 commits intofeat/protojsonfrom
Conversation
Merged
…tion-drop cleanup, and broadcast tests Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unify IPC JSON-RPC for Quickshell and daemon
ipc: address post-review feedback on unified JSON-RPC layer
Mar 15, 2026
There was a problem hiding this comment.
Pull request overview
Updates the internal IPC unified JSON-RPC framing to be more forward-compatible and robust to connection drops, and adds regression tests around event broadcasting and client disconnect behavior.
Changes:
- Use
protojson.UnmarshalOptions{DiscardUnknown: true}on both server and client to tolerate unknown fields from newer peers. - Ensure in-flight
Client.Call()unblocks promptly when the connection drops by draining outstanding request channels on read loop exit. - Add end-to-end tests for
BroadcastEventdelivery/interleaving and for client connection-drop behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/ipc/server.go | Adjusts naming/docs and makes envelope unmarshalling forward-compatible by discarding unknown fields. |
| internal/ipc/client.go | Adds request-draining on read loop exit, forward-compatible unmarshalling, and safer Call() channel receive handling. |
| internal/ipc/extra_test.go | Adds new tests covering broadcast delivery/interleaving and client behavior on connection drop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
darkliquid
approved these changes
Mar 15, 2026
darkliquid
approved these changes
Mar 15, 2026
darkliquid
added a commit
that referenced
this pull request
Mar 15, 2026
* feat: unify IPC JSON-RPC * fix: add missing js * fix: add missing files * ipc: enforce max frame size on write path (#4) * Initial plan * fix: add max frame size check in WriteEnvelope Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> * ipc: address post-review feedback on unified JSON-RPC layer (#5) * Initial plan * fix: address all IPC review feedback - naming, forward-compat, connection-drop cleanup, and broadcast tests Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update internal/ipc/extra_test.go * Update internal/ipc/extra_test.go --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> Co-authored-by: Andrew Montgomery <darkliquid@darkliquid.co.uk> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: eliminate race condition in TestBroadcastEvent_Delivery (#6) * Initial plan * fix: resolve race condition in TestBroadcastEvent_Delivery Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> Co-authored-by: Andrew Montgomery <darkliquid@darkliquid.co.uk> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: darkliquid <31256+darkliquid@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Fixes a set of correctness, robustness, and forward-compatibility issues flagged in review of the IPC unification PR.
Changes
server.gocw→connincloseActiveConnectionsrange loop — the map key isnet.Conn, not*connWriterBroadcastEventgodoc — it writes synchronously in the caller's goroutineprotojson.UnmarshalOptions{DiscardUnknown: true}so unknown fields from newer clients don't cause dropped framesclient.godrainReqs(), deferred at the top ofreadLoop, which closes all outstanding response channels on EOF/scanner error — preventsCall()from blocking indefinitely after a connection dropDiscardUnknown: truetreatment as server sideCall(): handle closed-channel receive (resp, ok := <-ch) and return"ipc: connection closed"instead of a nil-dereferenceTests (
extra_test.go)TestBroadcastEvent_Delivery— connects a rawnet.Conn, broadcasts anIndexUpdatedEvent, reads and unmarshals the frame end-to-endTestBroadcastEvent_NoInterleave— races a broadcast against a blocked handler to assert response and event writes don't corrupt each otherTestClient_ConnectionDrop— forcibly closes the underlying connection while aCall()is in-flight and asserts it returns an error promptly🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.