Skip to content

Fix pending transaction check to cover both initiator and partner#7

Draft
Copilot wants to merge 2 commits intofix/prodfrom
copilot/sub-pr-1-please-work
Draft

Fix pending transaction check to cover both initiator and partner#7
Copilot wants to merge 2 commits intofix/prodfrom
copilot/sub-pr-1-please-work

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 10, 2026

The pending transaction guard only checked whether initiatorId was already involved in a pending transaction, allowing a partnerId with an existing pending offer to be targeted — creating conflicting concurrent pending transactions for the same player.

Changes

  • app/api/sessions/[id]/transactions/route.ts: Expanded the pending check to block creation if either initiatorId or partnerId appears in any role (initiator or partner) in an existing pending transaction for the round.
// Before: only blocks if initiatorId is involved
WHERE round_id = ${round.id} AND status = 'pending'
  AND (initiator_id = ${initiatorId} OR partner_id = ${initiatorId})

// After: blocks if either player is involved in any role
WHERE round_id = ${round.id} AND status = 'pending'
  AND (
    initiator_id = ${initiatorId} OR partner_id = ${initiatorId}
    OR initiator_id = ${partnerId} OR partner_id = ${partnerId}
  )

🔒 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.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
live-game Error Error Mar 10, 2026 5:43am

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copilot AI changed the title [WIP] Update sessions API based on review feedback Fix pending transaction check to cover both initiator and partner Mar 10, 2026
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