Skip to content

fix(events): membership notice for entitlement_required on hackathon forms - #187

Merged
sre-helmcode merged 2 commits into
mainfrom
fix/hackathon-entitlement
Oct 15, 2026
Merged

sre-helmcode merged 2 commits into
mainfrom
fix/hackathon-entitlement

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

What

Hackathons are now unlocked by a NaN plan (Community, Inference or Premium). cloud-api (fix/open-signup-feedback) gates hackathon register, submission PUT, reassign and vote with a live check and answers an account without a plan with:

403 {"error":"entitlement_required","capability":"hackathons","unlockedBy":["community","inference","premium"]}

The website mapped that badly: RegisterForm showed "not eligible" for any 403, and VoteButton, SubmissionForm and ReassignForm showed a generic error.

All four now show a membership notice with a CTA:

  • EN: "Hackathons are for NaN members. Join the community (from 14.99€/month) to take part." → Join the community
  • ES: "Los hackathons son para miembros de NaN. Únete a la comunidad (desde 14,99 €/mes) para participar." → Únete a la comunidad

The CTA goes to https://cloud.nan.builders/signup?plan=community. These forms are only reachable with a session, and the platform's /signup already redirects a signed-in account to /welcome?plan=community, which goes straight to checkout. So one link covers both cases. not_eligible and every other code keep their current messages.

How

  • src/lib/eventEntitlement.ts: isEntitlementRequired(), the CTA URL and the strings type.
  • src/components/events/MembershipRequired.tsx: a shared notice, with a compact variant for the vote button.
  • RegisterForm and VoteButton move their error mapping into pure exported functions (registerErrorKey, voteOutcome), so it can be tested. SubmissionForm and ReassignForm check entitlement_required before the not_eligible and generic fallbacks.
  • New events.membership strings in i18n/en.json and i18n/es.json, passed in by the four event pages.

Tests

Written first, in src/tests/pages/eventsEntitlement.test.ts:

  • error detection, and that other codes are not swallowed;

  • the CTA URL;

  • EN/ES copy;

  • SSR render of the notice;

  • the register and vote mapping tables, including the unchanged codes;

  • source-order guards for the submission and reassign handlers;

  • every page passes the strings.

  • npm run build: passes

  • npx astro check: 0 errors

  • npx vitest run: 87 files, 2554 tests, all passing

  • Visual check with agent-browser against a mock cloud-api returning the 403: register form error state in EN and ES, at 1440px and 390px. The notice and link render, with no horizontal scroll.

Deploy note

Merge and deploy this AFTER the cloud-api fix (fix/open-signup-feedback), because this site deploys to prod on merge. It is harmless either way: until cloud-api returns entitlement_required, the new branch is never hit and the forms behave exactly as today.

🤖 Generated with Claude Code

barckcode and others added 2 commits October 15, 2026 18:28
…y plan

cloud-api now gates hackathon register, submission PUT, reassign and
vote behind a plan (Community, Inference or Premium) and answers an
account without one with 403 entitlement_required. The register form
showed 'not eligible', and the vote, submission and reassign forms a
generic error. All four now show a membership notice (EN/ES) linking to
cloud.nan.builders/signup?plan=community; signed-in accounts are sent on
to /welcome?plan=community by the platform. not_eligible and the other
codes keep their messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@barckcode
barckcode force-pushed the fix/hackathon-entitlement branch from 51d8ce4 to b2e9f1e Compare October 15, 2026 16:29
@sre-helmcode
sre-helmcode merged commit 0c854cb into main Oct 15, 2026
@sre-helmcode
sre-helmcode deleted the fix/hackathon-entitlement branch October 16, 2026 11:32
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.

2 participants