Skip to content

feat(codes): super admin toggle to open sponsor codes when hacking starts - #363

Merged
balebbae merged 1 commit into
mainfrom
devin/1794034796-codes-open-toggle
Nov 7, 2026
Merged

balebbae merged 1 commit into
mainfrom
devin/1794034796-codes-open-toggle

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Sponsor codes (Lovable, NVIDIA, …) were claimable/requestable the moment a hacker checked in. This adds a super admin Open codes to hackers switch on /admin/sa/codes, backed by a new codes_enabled setting that defaults to off.

  • GET/PUT /superadmin/settings/codes-enabled ({ "enabled": bool }), stored via SettingsStore.GetCodesEnabled / SetCodesEnabled. No migration — absent key reads as false.
  • GET /codes now returns open. Checked-in hackers still see every card, but while closed the badge is Soon and the disabled button reads Available when hacking starts.
  • Enforced server-side in codePoolForHacker: POST /codes/{id}/claim and POST /codes/{id}/requests return 403 "sponsor codes are available when hacking starts" while closed (checked before the pool lookup).
  • Codes a hacker/team already holds and pending requests keep showing while closed (codeStanding checks those first). Super admin preview is unchanged.

Testing

  • go test ./cmd/api/... ./internal/..., tsc, eslint, vitest for hacker/codes + superadmin/codes (new cases for closed claim/request, closed card copy, held code while closed).
  • Local run with Lovable (instant, per hacker) and NVIDIA (approval, per team) pools and a checked-in hacker; also confirmed a direct POST /v1/codes/{lovable}/claim gets 403 while closed.
Super admin — off Hacker — off Super admin — on Hacker — on

Note: after deploy, codes are closed until a super admin flips the switch.

Link to Devin session: https://app.devin.ai/sessions/d8e19df93b774e33b38363ae66efd630
Open in Devin Desktop: https://app.devin.ai/desktop/session/d8e19df93b774e33b38363ae66efd630?variant=devin
Requested by: @balebbae

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@balebbae
balebbae merged commit e755be8 into main Nov 7, 2026
7 checks passed
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.

1 participant