Repository navigation
fix(web): versus api ties at one decimal and unrated pairs say so - #1551
Conversation
#1545 (the part that needs no new column): - /api/v1/rate/versus decides is_tie and the winner on the /10 scores as the response shows them, at one decimal; the composite and then the lower price only break a tie. Before, a 2-decimal gap or a composite gap named a leader for scores shown equal. - The scoreboard summary and the verdict say "no rating yet" instead of "0.0" when a model has no score, like the stars. Refs #1545 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
⏱️ Code Review completed (9 eligible files · 13,092 chars · 4 model call(s) · 1 PR unit(s))
Whole diff with bounded context at base 7840cc2 / head 6a12b09.
✅ No verified defects
1 possible issue(s) could not be grounded in or verified against the snapshot source, so they are not published.
Context investigation was bounded to the explicitly requested snapshot paths.
Refs #1545 (P4 of #1531). This is the part that needs no new column, following the plan in #1545 (comment). #1545 stays open for the
rating_scoreswitch after P2 is applied.What changes
/api/v1/rate/versus: the tie and the winner (follow-up 1 from PR fix(web): versus scoreboard shows the product's own rating at one decimal #1478).is_tieandoverall_winnernow come from thecustom_weighted_score_10values as the response shows them, at one decimal.versusApiWinnerinlib/versus-verdict.ts. The OpenAPI description follows.starRating.empty) instead of "0.0".versusAutoVerdictNoScorecopy (vi, en, cs) instead of a "0.0" tie.Not in this PR
These wait for P2 (PR #1549,
master_products.rating_score):The double rounding is a question on the P2 column type; see the plan comment.
Tests
locale-format.test.ts:versusApiWinnercases (a lead, 9.04 against 8.96 as a tie broken by the composite, a price tiebreak, side A) and the no-score verdict.spec-scope.test.ts: on the mocked route,is_tieandoverall_winner.side/margin_10agree with the shown /10 scores.pnpm test,tscandeslintpass locally.🤖 Generated with Claude Code
📌 TL;DR
This PR refactors the 1v1 comparison logic to determine winners and ties based on the displayed 1-decimal scores (instead of raw 2-decimal precision) and introduces a new "no score" verdict state for unrated models. It also updates the UI to display a localized "empty" state instead of "0.0" when a model lacks a rating.
🎯 Type of Change
🔍 Changes Walkthrough
apps/web/locales/cs.jsonversusAutoVerdictNoScoretranslation for Czech.apps/web/locales/en.jsonversusAutoVerdictNoScoretranslation for English.apps/web/locales/vi.jsonversusAutoVerdictNoScoretranslation for Vietnamese.apps/web/src/app/api/v1/rate/__tests__/spec-scope.test.tsis_tieandoverall_winnerare derived from the 1-decimalcustom_weighted_score_10values.apps/web/src/app/api/v1/rate/versus/route.tsversusApiWinnerutility. Updatedis_tieto rely on the new logic rather than raw 2-decimal string comparison.apps/web/src/components/compare/VersusInteractiveScoreboard.tsxversusAutoVerdictNoScorekey. Updated score display to show a localized "empty" string instead of "0.0" when the score is 0.apps/web/src/lib/__tests__/locale-format.test.tsversusApiWinner(tie-breaking logic) andversusVerdictCopy(no-score case).apps/web/src/lib/versus-verdict.tsversusApiWinnerto determine winner/tie based on 1-decimal scores with composite/price tie-breakers. UpdatedversusVerdictCopyto return the new "no score" verdict when scores are 0.apps/web/src/server/rate/openapi.ts📊 Architectural Flow
flowchart TD A[API Request: /api/v1/rate/versus] --> B[Calculate Scores] B --> C{Check Scores} C -->|Score A != Score B| D[Winner: Higher Score] C -->|Score A == Score B| E[Check Composite Score] E -->|Composite A > Composite B| F[Winner: A] E -->|Composite B > Composite A| G[Winner: B] E -->|Composite Tie| H[Check Price] H -->|Lower Price B| I[Winner: B] H -->|Lower Price A or Equal| J[Winner: A] D --> K[Set is_tie = false] F --> L[Set is_tie = true] G --> L I --> L J --> L K --> M[Return API Response] L --> M M --> N[UI: VersusInteractiveScoreboard] N --> O{Check Verdict Key} O -->|versusAutoVerdictNoScore| P[Display 'Empty' Rating] O -->|versusAutoVerdictTie| Q[Display Tie Message] O -->|Other| R[Display Winner Message]