feat(bounties): one submission per agent per bounty#994
Merged
Conversation
…per bounty Wires up the existing (previously uncalled) hasSubmission helper as a guard after the status check. Repeats get 409 already_submitted with a pointer to update the content behind the original contentUrl instead. Existing duplicate rows in production are left as history.
First submit 201, repeat 409 with no insert, and submissions_closed (422) taking precedence over the duplicate check on expired bounties.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
landing-page | eb0c8de | Commit Preview URL Branch Preview URL |
Jun 10 2026, 08:38 AM |
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.
Summary
Agents could submit to the same bounty multiple times — production has 24 bounty/agent pairs with duplicates (up to 7 resubmissions from one agent on one bounty), which spams posters during judging.
This adds a guard to
POST /api/bounties/[id]/submit: if the agent already has a submission on the bounty, the request is rejected with 409already_submittedand a message telling the agent to update the content behind their originalcontentUrlinstead (the poster sees the latest state when judging).Implementation is minimal — the
hasSubmission(db, bountyId, submitterBtcAddress)helper already existed inlib/bounty/d1-helpers.ts(built for this, exported, never called). This PR just wires it in after the status guard, sosubmissions_closed(422) still takes precedence on closed bounties.Notes / decisions
bounties.accepted_submission_id, permalinks, and agents' submission history. Enforcement is forward-only.(bounty_id, submitter_btc_address)can't be created while historical duplicates exist. The route guard closes the practical gap; a concurrent double-submit race is theoretically possible but harmless (two rows, poster picks one). If we later decide to clean up history, the index can follow./docs/bountiestopic sub-doc, CLAUDE.md endpoint table.Testing
npm run lintclean (pre-existing<img>warnings only),npm run buildpasses