Skip to content

Homepage participation graph: card-denominated ratio, headline flip, in-session green dot - #572

Merged
WilfordGrimley merged 2 commits into
masterfrom
feat/stats-participation-consumer
Jul 29, 2026
Merged

Homepage participation graph: card-denominated ratio, headline flip, in-session green dot#572
WilfordGrimley merged 2 commits into
masterfrom
feat/stats-participation-consumer

Conversation

@WilfordGrimley

Copy link
Copy Markdown

Summary

  • Moves ParticipationGraph's gate + drawn bar off the votes-over-cards approximation (humanVotes.total / total) onto the exact card-denominated ratio distinctCardsRoutedToReviewWithHumanVotes / distinctCardsRoutedToReview (PR catalog-stats: add card-denominated participation counts #566's new fields). Old path and its units caveat deleted entirely, not kept as a fallback.
  • humanProgressRatioPercent now returns null (never NaN) when the three card-denominated fields aren't all present, finite numbers - the guaranteed state of every 1/catalogStats/ response until the production API redeploys past catalog-stats: add card-denominated participation counts #566. shouldRevealHumanProgress treats null as unconditionally below-threshold, so the below-threshold design renders byte-for-byte unchanged during that window.
  • Revealed headline flips to a "cards the machine routed to people" framing (distinct copy, not a bar bolted onto the below-threshold sentences). Not latched - orchestration issue VoteSource AI->DEDUCTION/OCR split + local OCR/phash printing-ID pilot (Stage 8) #22 tracks that as a known, accepted limitation.
  • New ReviewedCardCount renders distinctCardsRoutedToReviewWithHumanVotes as a plain, always-rising count beside the bar, since distinctCardsRoutedToReview (the ratio's denominator) only ever grows.
  • Dot-matrix's dashed "you would be the Nth" mark becomes a filled green dot + short thank-you once this browser tab has cast a vote in-session, via a new sessionContributionSlice.ts (in-memory Redux state only - no localStorage, no new endpoint).

Deviations from the stated file scope

The in-session vote-tracking requirement ("drive it from in-session state... via the existing Redux/RTK Query wiring") has no existing cross-page wiring to read from: QuestionFeed.tsx's vote-casting calls are plain fetch helpers in store/api.ts, not RTK Query mutations, and session state there is local useState, not Redux. Satisfying the requirement as written needed two small, additive touches outside the nominally listed scope:

  • frontend/src/store/store.ts - register the new sessionContribution reducer (2 lines).
  • frontend/src/features/questionFeed/QuestionFeed.tsx - bumpSessionCount (the existing single choke point every successful vote in that feed already calls) now also dispatches recordSessionContribution() (6 lines).

Both are additive only, no existing behavior changed; full frontend test suite (Jest + Playwright) passes including QuestionFeed/WhatsThat specs.

Test plan

  • npx next build
  • npx tsc --noEmit
  • npx jest - 73 suites / 666 tests passed
  • npx playwright test --project=chromium - 335 passed, 6 skipped, 0 failed
  • python3 .github/scripts/docs_lint.py --strict - clean
  • python3 .github/scripts/coverage_delta.py --base 80814167 - clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nz54BtscqFNzeKuDzEcpT3

…in-session green dot

Moves ParticipationGraph's gate/bar off the votes-over-cards approximation
(humanVotes.total / total) onto the exact card-denominated ratio
distinctCardsRoutedToReviewWithHumanVotes / distinctCardsRoutedToReview
(PR #566's new fields), deletes the old path and its units caveat entirely,
adds a null-safe live-skew guard for the window before the production API
redeploys past #566, flips the revealed headline to a routed-to-review
framing with an always-rising reviewed-count beside the bar (issue #22:
the flip is not latched), and turns the dot-matrix's dashed "you could be
next" mark into a filled green + thank-you once this client has voted
in-session (sessionContributionSlice.ts, no localStorage/new endpoint).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz54BtscqFNzeKuDzEcpT3
…ribution

Closes the untested seam the component tests couldn't reach: they proved the
homepage dot responds to recordSessionContribution(), not that a real vote
fires it. Two new tests exercise bumpSessionCount's real dispatch through a
successful (and, separately, a failed) /2/submitPrintingTag/ call, using the
file's existing mock-a-vote harness - no new test machinery.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nz54BtscqFNzeKuDzEcpT3
@WilfordGrimley
WilfordGrimley merged commit 9952865 into master Jul 29, 2026
13 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.

1 participant