Skip to content

Conversation

@eswan18
Copy link
Owner

@eswan18 eswan18 commented Feb 5, 2026

Summary

  • Introduces withRLSAction, a variant of withRLS that allows transaction callbacks to return ServerActionResult directly
  • Enables clean return error(...) early returns inside transactions while maintaining RLS context and transactional atomicity
  • Refactors 9 functions across 4 files to use the new pattern, eliminating awkward throw/catch string-prefix error handling
  • Consolidates multi-step operations into single atomic transactions

Test plan

  • All 143 unit tests pass
  • ESLint passes with 0 errors
  • New withRLSAction helper has unit test coverage

Closes #105

🤖 Generated with Claude Code

Introduces withRLSAction, a variant of withRLS that allows transaction
callbacks to return ServerActionResult directly. This enables clean
`return error(...)` early returns inside transactions while maintaining
RLS context and transactional atomicity.

Key changes:
- Add withRLSAction helper with automatic rollback on error results
- Refactor 9 functions across 4 files to use the new pattern:
  - competition-members.ts: removeCompetitionMember, updateMemberRole,
    getEligibleMembers, addCompetitionMemberById
  - props.ts: createProp, resolveProp
  - competitions.ts: updateCompetition
  - forecasts.ts: createForecast, updateForecast
- Consolidate multi-step operations into single atomic transactions
- Eliminate awkward throw/catch string-prefix error handling pattern

Closes #105

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forecasting Ready Ready Preview, Comment Feb 5, 2026 3:26am

@eswan18 eswan18 merged commit a336923 into main Feb 5, 2026
3 checks passed
@eswan18 eswan18 deleted the feat/withRLSAction-helper branch February 5, 2026 03:27
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.

Refactor withRLS to support ServerActionResult early returns

1 participant