Add local RCV result calculation - #68
Conversation
a6dafe1 to
9ea7763
Compare
9ea7763 to
7f41a5e
Compare
7f41a5e to
ce40030
Compare
DavidMoritz
left a comment
There was a problem hiding this comment.
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! 🏆
Summary
Verification
Stack created with GitHub Stacks CLI.