Add canonical federal voting analytics - #114
Open
capituwuistgoonsquad wants to merge 1 commit into
Open
Conversation
Signed-off-by: capituwuistgoonsquad <ultimamaster13@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
Deliver the first complete Phase 7 analytics capability from the reviewed official House and Senate facts.
Data and security boundary
Migration
0038_canonical_federal_voting_analytics.sqlinstalls one owner-only verified read model and three boundedSECURITY DEFINERRPCs. Browser roles receive function execution only; the internal view, provenance, roll-call, vote, measure, and link tables remain closed. The metric excludes Present and Not Voting, never reads legacyvoting_records, and changes no scraper writer or source request budget.Scraper preflight now requires the 0038 marker and all three RPCs so live schema drift fails closed.
Production rollout evidence
Migration 0038 is applied. Live anonymous-role validation covered representative House and Senate profiles:
The optimized ranking path kept representative production probes below one second per chamber. No scraper run was needed because this is a read-only analytics/release slice.
Validation
npm run typechecknpm run lintPYTHONPATH=scraper python3 -m unittest discover -s scraper/tests -p 'test_*.py'— 389 passedgit diff --checknpm run buildcompleted Next.js compilation plus its lint/type phase, then stopped at page-data collection because this workstation does not have the frontend's public Supabase build variables. Repository CI has the configured build environment and is the full static-export proof.Greptile Summary
This change adds canonical federal voting analytics to profile voting and Connections views, including participation summaries, same-scope alignment rankings, and paginated shared-vote evidence.
The potential defect where a comparison could lose its selected chamber/Congress scope or paginate incorrectly was disproved by an executed adapter harness: House/119 remained in both requests, page offsets advanced from 0 to 25, and lookahead pagination returned 25 records followed by the final record. Focused migration and UI contract tests and frontend typechecking also passed.
Confidence Score: 5/5
The verified comparison flow preserves the selected congressional scope and handles consecutive evidence pages correctly.
No publishable defects remain. The changed adapter was exercised with a mocked RPC boundary across two pages, and focused migration/UI contract tests plus frontend typechecking completed successfully.
Files Needing Attention: No files require changes from this review; the exercised paths were frontend/src/lib/votingAnalytics.ts and migrations/0038_canonical_federal_voting_analytics.sql.
What T-Rex did
Reviews (1): Last reviewed commit: "Add canonical federal voting analytics" | Re-trigger Greptile