Skip to content

feat(api): launch-promo foundation — admin manual award + /me status (#724)#749

Open
chronoai-shining wants to merge 7 commits into
developfrom
feat/724-launch-promo
Open

feat(api): launch-promo foundation — admin manual award + /me status (#724)#749
chronoai-shining wants to merge 7 commits into
developfrom
feat/724-launch-promo

Conversation

@chronoai-shining
Copy link
Copy Markdown
Collaborator

Settings section + claims collection + service + admin manual-award endpoint + caller status. Cron + GH stargazers + NyxID GH-lookup + frontend deferred to PR 2. 12 unit tests green. Fixes #724

…724)

PR 1 of 2 for #724. Lands the data model, eligibility gate, redemption-
code minting, notification delivery, and the admin manual-award + caller
status endpoints. Cron + GitHub stargazers polling + NyxID GH-login
resolution + frontend UI are scoped for PR 2.

- launchPromo settings section: enabled, repoOwner/Name, totalSlots
  (default 500), awardPlayground/awardSkillGen (200), pollIntervalMs,
  codeExpiryDays, nyxidInviteCode. Defaults are conservative so the
  promo stays dormant until an admin turns it on.
- launch_promo_claims collection + repo (one doc per awarded user,
  _id=userId for PK idempotency; awardedAt desc index for admin
  observability).
- LaunchPromoService.awardUser: gates on enabled + rank ≤ totalSlots
  + slots remaining + not-already-claimed, mints a code via the
  existing redemption-codes service, drops a launchPromo.codeDelivered
  notification carrying the code + NyxID invite code, records the
  claim. Race-on-insert resolves cleanly to ALREADY_CLAIMED.
  Notification failure logged but doesn't roll back the claim.
- LaunchPromoService.getStatusForUser: composes the /me/launch-promo
  response.
- UserDirectoryRepository.getRegistrationRank: 1-based ranking by
  firstSeenAt asc, two queries, no scan.
- New launchPromo.codeDelivered NotificationCategory.
- Routes: GET /me/launch-promo, POST /admin/launch-promo/award/:userId
  (ornn:admin:skill), GET /admin/launch-promo/recent. Service-layer
  sentinels map to 400/403/404/409.

Coverage: 12 colocated unit tests on LaunchPromoService — happy path
+ every error sentinel + race-on-insert + notification-failure-does-
not-rollback. All green.

Fixes #724
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.

[Bug] [Launch Promo] GitHub Star reward delivery is promised, but automatic eligibility and redemption-code issuance are not implemented in Ornn

1 participant