Skip to content

Add idempotent v2 vote endpoint - #66

Merged
DavidMoritz merged 1 commit into
masterfrom
codex/expo-v2-votes
Aug 17, 2026
Merged

Add idempotent v2 vote endpoint#66
DavidMoritz merged 1 commit into
masterfrom
codex/expo-v2-votes

Conversation

@ejones23

@ejones23 ejones23 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add typed anonymous POST /api/v2/votes.php envelopes and error states
  • make retries safe with a ballot-scoped request key and payload hash
  • enforce cutoff, ranking ownership, and one-device-one-vote rules server-side
  • add the production/SQLite schema migration and contract coverage

Verification

  • V2VoteTest: 9 tests
  • full JavaScript and PHPUnit suites
  • production Vite build

This intentionally returns typed blockers for name, secure-code, and grouping ballots; collecting those fields remains Phase 2.

Stack created with GitHub Stacks CLI.

Base automatically changed from codex/expo-ranking-state to master August 17, 2026 13:57

@DavidMoritz DavidMoritz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent endpoint design, Emmanuel! The idempotency pattern here is rock-solid — the double-check on duplicate key insert for race conditions, hash_equals() for timing-safe comparison, and the clean typed error envelope are all exactly right. The 9 test cases cover the important edge cases thoroughly, and every query is properly parameterized.

The way you've structured the validation to collect all field errors before responding is a really nice touch for client ergonomics. This is production-quality API work. Thank you so much for this — your dedication to getting the details right is what makes this project better! 🎯

@DavidMoritz
DavidMoritz marked this pull request as ready for review August 17, 2026 13:57
@DavidMoritz
DavidMoritz merged commit 4c013f2 into master Aug 17, 2026
4 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.

2 participants