Skip to content

Conversation

@norkans7
Copy link
Contributor

@norkans7 norkans7 commented Oct 27, 2025

Addresses #27

Copilot AI review requested due to automatic review settings October 27, 2025 11:50
Copy link

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 migrates message identification from integer IDs to UUIDs throughout the codebase. The change affects message structures, database queries, API endpoints, and test fixtures to use UUID-based identifiers instead of numeric IDs.

  • Replaces MsgID (int64) with MsgUUID (string UUID) across all message-related types
  • Updates API contracts to use uuid field instead of id for messages
  • Modifies database queries to return/query by UUID instead of ID

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/models/msg.go Defines new MsgUUID type and updates message structs to use UUID instead of ID
core/models/msg_test.go Updates test assertions to check UUIDs instead of IDs
core/queue/outboxes.go Changes item ID generation to use UUID format
core/queue/outboxes_test.go Updates test data and assertions to use UUIDs
core/courier/courier.go Updates courier interface to accept MsgUUID instead of MsgID
core/courier/courier_test.go Updates test expectations for UUID-based courier calls
core/courier/events.go Changes courier events to use MsgUUID
service.go Updates message delivery confirmation to parse and validate UUIDs
web/client.go Changes acknowledgment item ID format to use UUID
web/commands/ack_chat.go Updates acknowledgment command to use MsgUUID
web/server.go Updates send endpoint to accept UUID instead of ID
web/server_test.go Adds UUID generator seeding and updates test fixtures
testsuite/courier.go Updates mock courier to work with UUIDs
testsuite/testdata.go Changes helper functions to return MsgUUID instead of MsgID

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

web/server.go Outdated
Secret string `json:"secret" validate:"required"`
Msg struct {
ID models.MsgID `json:"id" validate:"required"`
UUID models.MsgUUID `json:"uuid" validate:"uuid,required"`
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The validation tag should be required,uuid to match standard validator library conventions where required comes before format validators.

Suggested change
UUID models.MsgUUID `json:"uuid" validate:"uuid,required"`
UUID models.MsgUUID `json:"uuid" validate:"required,uuid"`

Copilot uses AI. Check for mistakes.
service.go Outdated
msgUUID := strings.TrimPrefix(string(itemID), "m")

if !uuids.Is(msgUUID) {
return fmt.Errorf("error parsing msg uuid: %w", errors.New("invalid uuid"))
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The error message wrapping is redundant. Either return errors.New(\"invalid uuid\") directly or use a more descriptive message like fmt.Errorf(\"invalid msg uuid: %s\", msgUUID) without wrapping.

Suggested change
return fmt.Errorf("error parsing msg uuid: %w", errors.New("invalid uuid"))
return fmt.Errorf("invalid msg uuid: %s", msgUUID)

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants