-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add venue management APIs and venue-aware identifiers #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add venue management APIs and venue-aware identifiers #56
Conversation
guard generated code
…tifier-and-refactor-queue' into codex/expand-openapi.yaml-for-venue-management - Fix storage with duplicate UpsertVenue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if isPrimary { | ||
| if _, err := s.db.ExecContext(ctx, "UPDATE bot_venue_assignments SET is_primary = 0 WHERE bot_id = ?", botID); err != nil { | ||
| return api.VenueAssignmentRecord{}, err | ||
| } | ||
| } | ||
|
|
||
| primary := int64(0) | ||
| if isPrimary { | ||
| primary = 1 | ||
| } | ||
|
|
||
| params := sqlcgen.UpsertBotVenueAssignmentParams{ | ||
| BotID: botID, | ||
| VenueID: venueID, | ||
| IsPrimary: primary, | ||
| } | ||
|
|
||
| if err := s.queries.UpsertBotVenueAssignment(ctx, params); err != nil { | ||
| if isUniqueConstraintError(err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make primary venue updates transactional
When UpsertVenueAssignment is called with isPrimary=true it unconditionally executes UPDATE bot_venue_assignments SET is_primary = 0 WHERE bot_id = ? before attempting the upsert. If the subsequent UpsertBotVenueAssignment call fails (for example because of a database error or a unique‑constraint violation) the function returns an error but the previous UPDATE is not rolled back, so the bot is left with no primary venue assignment even though the request failed. This introduces inconsistent state that requires manual recovery. Wrapping the demotion and upsert in a single transaction or deferring the demotion until the upsert succeeds would avoid this.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex please provide a fix for this, important pull the most recent branch because a commit happened after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Wrapped primary venue demotion and upsert logic in a shared transaction to keep primary assignments consistent when failures occur. storage/api.goL900-L950
Testing
- ✅
go test ./...
aaf6d14
into
codex/extend-orderwork-with-identifier-and-refactor-queue
Summary
Reviewing
Keep
specs/multi_venue_emission.adocin mindhttps://chatgpt.com/codex/tasks/task_e_69089b1962808326ad5e7237ce14eac2