Skip to content

Conversation

@dkhalife
Copy link
Owner

Summary

  • include RequestID in WSMessage and WSResponse
  • echo RequestID back in handleMessage
  • update websocket tests

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_6872f9621188832ab5871a4ddebebfb7

@codecov
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@dkhalife dkhalife marked this pull request as ready for review July 13, 2025 00:27
Copilot AI review requested due to automatic review settings July 13, 2025 00:27
@dkhalife dkhalife merged commit 98e34fa into main Jul 13, 2025
5 checks passed
@dkhalife dkhalife deleted the codex/add-request-id-field-to-websocket-types branch July 13, 2025 00:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a RequestID field to WebSocket request and response types, ensures it’s echoed back by the server, and updates tests accordingly.

  • Added RequestID to WSMessage and WSResponse structs with JSON tags.
  • Updated handleMessage in server.go to copy RequestID from request to response.
  • Extended server_test.go to send and verify RequestID in WebSocket tests.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/ws/message.go Added RequestID field to WSMessage and WSResponse structs
internal/ws/server.go Echoed RequestID in handleMessage response
internal/ws/server_test.go Updated tests to include and assert RequestID
Comments suppressed due to low confidence (1)

internal/ws/server_test.go:194

  • It may be helpful to assert the expected Status in this test to ensure the server is returning the correct status code alongside the request ID.
	s.Equal("1", resp.RequestID)

type WSMessage struct {
Action string `json:"action"`
Data json.RawMessage `json:"data,omitempty"`
RequestID string `json:"requestId"`
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding omitempty to the JSON tag for RequestID in WSMessage if it can be optional, to avoid sending empty fields when no ID is provided.

Suggested change
RequestID string `json:"requestId"`
RequestID string `json:"requestId,omitempty"`

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants