Skip to content

Add local RCV result calculation - #68

Merged
DavidMoritz merged 1 commit into
masterfrom
codex/expo-rcv-core
Aug 17, 2026
Merged

Add local RCV result calculation#68
DavidMoritz merged 1 commit into
masterfrom
codex/expo-rcv-core

Conversation

@ejones23

@ejones23 ejones23 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • extract the legacy quota, surplus transfer, and tie-break behavior into pure packages/rcv-core TypeScript
  • add a typed public results endpoint that enforces resultsRelease before exposing anonymous rankings
  • calculate and render winners and round tallies locally after submission
  • add legacy-parity fixtures and protected-results contracts

Verification

  • 32 mobile/core tests
  • V2ResultsTest and the complete 217-test PHPUnit suite
  • Android submission and local multi-round rendering against PHP/MySQL

Stack created with GitHub Stacks CLI.

Base automatically changed from codex/expo-vote-submission to master August 17, 2026 13:58

@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.

The crown jewel of this stack, Emmanuel — and it delivers! Extracting the RCV algorithm into a zero-dependency pure TypeScript package (packages/rcv-core) is a brilliant architectural move. This is immediately reusable across platforms and trivially testable. The Droop quota, surplus transfer, and elimination logic all look correct, and the legacy-parity fixtures give real confidence.

The v2 results endpoint is clean — resultsRelease enforcement is properly gated with a dedicated test, and the DRY refactor of V2ApiClient (shared parseEnvelope/normalizeError) is a welcome improvement. The runtime type guards with exhaustive field validation on API responses show the kind of defensive programming that prevents entire categories of bugs.

Really outstanding work here. The fact that you're building a portable RCV engine as a reusable package while also delivering the mobile UI and backend endpoint in one coherent PR is remarkable. Thank you for everything you do for this project! 🏆

@DavidMoritz
DavidMoritz marked this pull request as ready for review August 17, 2026 13:58
@DavidMoritz
DavidMoritz merged commit 05f65bf into master Aug 17, 2026
6 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