Homepage participation graph: card-denominated ratio, headline flip, in-session green dot - #572
Merged
Merged
Conversation
…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
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.
Summary
ParticipationGraph's gate + drawn bar off the votes-over-cards approximation (humanVotes.total / total) onto the exact card-denominated ratiodistinctCardsRoutedToReviewWithHumanVotes / 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.humanProgressRatioPercentnow returnsnull(neverNaN) when the three card-denominated fields aren't all present, finite numbers - the guaranteed state of every1/catalogStats/response until the production API redeploys past catalog-stats: add card-denominated participation counts #566.shouldRevealHumanProgresstreatsnullas unconditionally below-threshold, so the below-threshold design renders byte-for-byte unchanged during that window.ReviewedCardCountrendersdistinctCardsRoutedToReviewWithHumanVotesas a plain, always-rising count beside the bar, sincedistinctCardsRoutedToReview(the ratio's denominator) only ever grows.sessionContributionSlice.ts(in-memory Redux state only - nolocalStorage, 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 plainfetchhelpers instore/api.ts, not RTK Query mutations, and session state there is localuseState, not Redux. Satisfying the requirement as written needed two small, additive touches outside the nominally listed scope:frontend/src/store/store.ts- register the newsessionContributionreducer (2 lines).frontend/src/features/questionFeed/QuestionFeed.tsx-bumpSessionCount(the existing single choke point every successful vote in that feed already calls) now also dispatchesrecordSessionContribution()(6 lines).Both are additive only, no existing behavior changed; full frontend test suite (Jest + Playwright) passes including
QuestionFeed/WhatsThatspecs.Test plan
npx next buildnpx tsc --noEmitnpx jest- 73 suites / 666 tests passednpx playwright test --project=chromium- 335 passed, 6 skipped, 0 failedpython3 .github/scripts/docs_lint.py --strict- cleanpython3 .github/scripts/coverage_delta.py --base 80814167- clean🤖 Generated with Claude Code
https://claude.ai/code/session_01Nz54BtscqFNzeKuDzEcpT3