Skip to content

fix(baseball): distinct effectiveness-review badges (#498)#643

Merged
njrini99-code merged 1 commit into
mainfrom
fix/baseball-498-auto
Jul 3, 2026
Merged

fix(baseball): distinct effectiveness-review badges (#498)#643
njrini99-code merged 1 commit into
mainfrom
fix/baseball-498-auto

Conversation

@njrini99-code

Copy link
Copy Markdown
Owner

What & why

EffectivenessReviewRow in StaffDecisionRoomClient.tsx treated any non-improved direction as a regression, so 'no_change' (metric held steady) and null (insufficient sample) rendered as a red "Moved the wrong way" badge. Coaches were misled into thinking neutral or inconclusive practice-effectiveness reviews had hurt performance.

The read model (effectiveness.ts) already maps DB directions to the honest union 'improved' | 'regressed' | 'no_change' | null — the UI just wasn't honoring all four.

Fix

Added an effectivenessPresentation() helper (mirroring the existing verdictPresentation() pattern in the same file) that maps each direction to distinct copy, tone, and glyph:

direction tone copy glyph
improved success Associated improvement trending up
regressed danger Moved the wrong way trending down
no_change secondary Held steady minus
null secondary Not enough data help

Only regressed uses danger styling now.

Acceptance criteria

  • improved, regressed, no_change, and null each have distinct badge copy/tone.
  • no_change/null never use danger styling (both render secondary).
  • UI matches the mapped directions from the effectiveness read model.

Scope: single UI file (StaffDecisionRoomClient.tsx). No migration, no read-model or server-action changes.

🤖 Generated with Claude Code

…able reviews as regression (#498)

EffectivenessReviewRow treated any non-'improved' direction as a
regression, so 'no_change' and null (insufficient sample) rendered as a
red "Moved the wrong way" badge — misleading coaches into thinking
neutral/inconclusive practice reviews hurt performance.

Add an effectivenessPresentation() helper (mirroring verdictPresentation)
that maps each direction to distinct copy, tone, and glyph:
- improved   -> success  "Associated improvement"  (trending up)
- regressed  -> danger   "Moved the wrong way"     (trending down)
- no_change  -> secondary "Held steady"            (minus)
- null       -> secondary "Not enough data"        (help)

Only 'regressed' uses danger styling now.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017VUauUXsm9aXegShmpJi5n
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
helmv3 Ready Ready Preview, Comment Jul 1, 2026 4:59pm

Request Review

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix effectiveness-review badges for regressed/no-change/unknown directions

🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Render distinct badge copy, tone, and icon for all effectiveness directions.
• Stop treating no_change and null directions as regressions.
• Centralize direction-to-presentation mapping in a dedicated helper.
Diagram

graph TD
  A["EffectivenessReviewRow"] --> B["effectivenessPresentation()"] --> C{Direction}
  C -->|"improved"| D["Badge: success + up"]
  C -->|"regressed"| E["Badge: danger + down"]
  C -->|"no_change"| F["Badge: secondary + minus"]
  C -->|"null/other"| G["Badge: secondary + help"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Data-driven lookup map
  • ➕ Less branching than a switch; easy to scan and extend
  • ➕ Can enforce exhaustiveness via satisfies Record
  • ➖ Needs a safe fallback for null/unknown anyway
  • ➖ Slightly less explicit than a switch for reviewers
2. Shared presentation helper in a common module
  • ➕ Avoids duplicating direction semantics across screens
  • ➕ Ensures consistent copy/tone everywhere the direction is shown
  • ➖ Bigger refactor and dependency decisions (where should UI copy live?)
  • ➖ Out of scope for a targeted UI bug fix

Recommendation: The PR’s approach (a local effectivenessPresentation() helper mirroring existing verdictPresentation()) is the best fit for the stated scope: it fixes the bug with minimal surface area and makes the mapping explicit. If additional screens start rendering the same direction, consider extracting this helper to a shared UI module to keep copy/tone consistent.

Files changed (1) +39 / -4

Bug fix (1) +39 / -4
StaffDecisionRoomClient.tsxAdd direction-aware effectiveness badge presentation +39/-4

Add direction-aware effectiveness badge presentation

• Introduces 'effectivenessPresentation()' to map effectiveness directions to distinct badge label, tone, and glyph (including 'no_change' and 'null'). Updates 'EffectivenessReviewRow' to use this mapping and adds new icons for flat/unknown states.

src/components/baseball/staff-decision-room/StaffDecisionRoomClient.tsx

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@njrini99-code

Copy link
Copy Markdown
Owner Author

🤖 Mission Control — PR summary

Changes: Adds effectivenessPresentation() mapping each review direction to distinct copy/tone/glyph; only regressed uses danger styling (no_change/null now neutral). Closes #498.
Areas / risk: Presentational (BaseballHelm practice-effectiveness badges) — low risk.
Watch: Neutral/insufficient-sample reviews no longer render as a red “Moved the wrong way”.
CI: ❌ Supabase lint + RLS tests, Unit tests, Business contracts (advisory) failing — review before merge. (lighthouse-preview = known noise.)
Note: Bundled into batch #650.

@qodo-code-review

Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: all

Failed stage: Fail if any required CI check failed [❌]

Failed test name: ""

Failure summary:

The workflow job failed because it explicitly ran a step that prints One or more CI checks failed.
and then executes exit 1, which forces the job to fail.
No underlying failing test or check is shown
in this log; this appears to be a “fail the job if prior checks failed” gate step, but the actual
failing check/test occurred earlier (not included in the provided excerpt).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

12:  ##[endgroup]
13:  ##[group]Runner Image
14:  Image: ubuntu-24.04
15:  Version: 20260628.225.1
16:  Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20260628.225/images/ubuntu/Ubuntu2404-Readme.md
17:  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20260628.225
18:  ##[endgroup]
19:  ##[group]GITHUB_TOKEN Permissions
20:  Contents: read
21:  Metadata: read
22:  ##[endgroup]
23:  Secret source: Actions
24:  Prepare workflow directory
25:  Prepare all required actions
26:  Complete job name: all
27:  ##[group]Run echo "One or more CI checks failed."
28:  �[36;1mecho "One or more CI checks failed."�[0m
29:  �[36;1mexit 1�[0m
30:  shell: /usr/bin/bash -e {0}
31:  env:
32:  NEXT_PUBLIC_SUPABASE_URL: ***
33:  NEXT_PUBLIC_SUPABASE_ANON_KEY: ***
34:  NODE_OPTIONS: --max-old-space-size=8192
35:  ##[endgroup]
36:  One or more CI checks failed.
37:  ##[error]Process completed with exit code 1.
38:  Cleaning up orphan processes

@njrini99-code njrini99-code merged commit c555544 into main Jul 3, 2026
29 of 35 checks passed
@njrini99-code njrini99-code deleted the fix/baseball-498-auto branch July 3, 2026 01:13
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