Refactor: Attempt II at removing pgtype.UUID everywhere + convert string UUIDs into uuid.UUID#2894
Merged
Refactor: Attempt II at removing pgtype.UUID everywhere + convert string UUIDs into uuid.UUID#2894
pgtype.UUID everywhere + convert string UUIDs into uuid.UUID#2894Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1 task
grutt
reviewed
Feb 2, 2026
|
|
||
| resp[i] = gen.WorkerLabel{ | ||
| Metadata: *toAPIMetadata(id, labels[i].CreatedAt.Time, labels[i].UpdatedAt.Time), | ||
| // fixme: `id` needs to be a uuid |
Contributor
Author
There was a problem hiding this comment.
for later, we discussed on slack
grutt
approved these changes
Feb 2, 2026
abelanger5
approved these changes
Feb 2, 2026
| @@ -38,7 +37,7 @@ func (p *OperationPool[T]) SetTenants(tenants []*sqlcv1.Tenant) { | |||
| tenantMap := make(map[string]bool) | |||
Contributor
There was a problem hiding this comment.
should this just be map[uuid.UUID]bool?
Contributor
Author
There was a problem hiding this comment.
yeah maybe - I was trying not to mess with the operation pool stuff too much because of all the generics and reflection going on here, figured we could clean this up later
grutt
reviewed
Feb 4, 2026
| if match.SignalExternalID != nil { | ||
| externalIds = append(externalIds, *match.SignalExternalID) | ||
| } else { | ||
| externalIds = append(externalIds, uuid.Nil) |
grutt
reviewed
Feb 4, 2026
| } | ||
|
|
||
| outputPayload, exists := externalIdToPayload[dag.OutputEventExternalID] | ||
| outputEventExternalId := uuid.Nil |
grutt
reviewed
Feb 4, 2026
|
|
||
| for i, row := range rows { | ||
| externalIds[i] = row.EventExternalID | ||
| eventExternalId := uuid.Nil |
grutt
reviewed
Feb 4, 2026
|
|
||
| for _, row := range rows { | ||
| payload, exists := payloads[row.EventExternalID] | ||
| eventExternalId := uuid.Nil |
grutt
reviewed
Feb 4, 2026
| eventCount = int(row.Count) | ||
| } | ||
|
|
||
| latestWorkerId := uuid.Nil |
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.
Description
Attempt 2 at #2581
The main goal here was to replace
pgtype.UUIDwithuuid.UUIDeverywhere. This uncovered a handful of small bugs (especially in some of our queries) where we were relying onpgtype.UUIDsemantics to tell the difference between a null value and a non-null value, which breaks with a more restrictive type (e.g. not usingsqlc.nargin queries and just implicitly allowing@foobar::UUIDto be nullable viapgtype.UUID).I also got a little greedy, so I tried my best to replace all instances of string uuids everywhere with
uuid.UUIDtoo. Should help a lot with type safety everywhere, and limit the amount of type casting we're doingI feel pretty good about this with all the tests passing and such, but it's pretty likely there are at least one or two bugs or commands or some such that are broken, so will need to track those down incrementally I think
Type of change