From 50b678ecaa955432024549d4717d5dceead72882 Mon Sep 17 00:00:00 2001 From: Daniel Wise Date: Sun, 21 Jun 2026 21:37:37 -0700 Subject: [PATCH] fix: improve rage ai qa flows --- apps/web/next.config.ts | 1 + apps/web/src/app/leaderboard/page.tsx | 70 ++++++++++--------- apps/web/src/app/page.tsx | 68 ++++++++++-------- .../src/app/share/[rowId]/opengraph-image.tsx | 2 +- apps/web/src/components/ui/card.tsx | 7 +- .../rage-core/src/__tests__/share.test.ts | 14 ++++ packages/rage-core/src/share.ts | 24 +++++-- plugins/rage-claude/bin/rage.js | 19 +++-- plugins/rage-codex/bin/rage.js | 19 +++-- 9 files changed, 142 insertions(+), 82 deletions(-) diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index a2be40e..658e76a 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -1,6 +1,7 @@ import type { NextConfig } from 'next' const nextConfig: NextConfig = { + allowedDevOrigins: ['127.0.0.1'], typedRoutes: true, serverExternalPackages: ['pg'], } diff --git a/apps/web/src/app/leaderboard/page.tsx b/apps/web/src/app/leaderboard/page.tsx index d73c894..2d9ada9 100644 --- a/apps/web/src/app/leaderboard/page.tsx +++ b/apps/web/src/app/leaderboard/page.tsx @@ -30,41 +30,43 @@ export default async function LeaderboardPage() { {group.rows.length > 0 ? ( - - - - - - - - - - - - - - - {group.rows.map((row) => ( - - - - - - - - - +
+
#HandleHostRage/1kSwearsWordsTopShare
{row.rank}{row.handle}{row.hostApp}{row.ratePerThousandWords}{row.scoredProfanityCount}{row.userWordCount}{row.topIntensity ?? '-'} - - Open - -
+ + + + + + + + + + - ))} - -
#HandleHostRage/1kSwearsWordsTopShare
+ + + {group.rows.map((row) => ( + + {row.rank} + {row.handle} + {row.hostApp} + {row.ratePerThousandWords} + {row.scoredProfanityCount} + {row.userWordCount} + {row.topIntensity ?? '-'} + + + Open + + + + ))} + + + ) : (

No rankable rows yet.

)} diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 3ef164c..746f8de 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -7,6 +7,10 @@ import { getLeaderboardRows } from '@/lib/leaderboard' export const dynamic = 'force-dynamic' +function formatHostApp(hostApp: string): string { + return hostApp === 'claude' ? 'Claude' : 'Codex' +} + export default async function HomePage() { const rows = await getLeaderboardRows('daily').catch(() => []) const topHost = rows[0]?.hostApp @@ -41,37 +45,39 @@ export default async function HomePage() { {rows.length > 0 ? ( - - - - - - - - - - - - - {rows.map((row) => ( - - - - - - - +
+
#HandleHostRage/1kWordsShare
{row.rank}{row.handle}{row.hostApp}{row.ratePerThousandWords}{row.userWordCount} - - Open - -
+ + + + + + + + - ))} - -
#HandleHostRage/1kWordsShare
+ + + {rows.map((row) => ( + + {row.rank} + {row.handle} + {row.hostApp} + {row.ratePerThousandWords} + {row.userWordCount} + + + Open + + + + ))} + + + ) : (
No published rage yet. Suspiciously calm. @@ -88,7 +94,7 @@ export default async function HomePage() {

{topHost - ? `${topHost} is testing everyone's patience today.` + ? `${formatHostApp(topHost)} is testing everyone's patience today.` : 'The tools are behaving, or everyone is bottling it up.'}

diff --git a/apps/web/src/app/share/[rowId]/opengraph-image.tsx b/apps/web/src/app/share/[rowId]/opengraph-image.tsx index add82c6..7ae6fc9 100644 --- a/apps/web/src/app/share/[rowId]/opengraph-image.tsx +++ b/apps/web/src/app/share/[rowId]/opengraph-image.tsx @@ -96,7 +96,7 @@ export default async function Image({ params }: ShareImageProps) { Rage AI

- {formatWindow(data.window)} aggregate share + {`${formatWindow(data.window)} aggregate share`}
diff --git a/apps/web/src/components/ui/card.tsx b/apps/web/src/components/ui/card.tsx index 482d3c2..dfc80d3 100644 --- a/apps/web/src/components/ui/card.tsx +++ b/apps/web/src/components/ui/card.tsx @@ -2,7 +2,12 @@ import type * as React from 'react' import { cn } from '@/lib/utils' export function Card({ className, ...props }: React.HTMLAttributes) { - return
+ return ( +
+ ) } export function CardHeader({ className, ...props }: React.HTMLAttributes) { diff --git a/packages/rage-core/src/__tests__/share.test.ts b/packages/rage-core/src/__tests__/share.test.ts index 4af48f6..cef2fd9 100644 --- a/packages/rage-core/src/__tests__/share.test.ts +++ b/packages/rage-core/src/__tests__/share.test.ts @@ -85,6 +85,20 @@ describe('share drafts', () => { expect(draft.text).toContain('aggregate-only') }) + it('does not duplicate aggregate-only wording for non-rankable scores', () => { + const draft = createShareDraft({ + handle: 'wise', + platform: 'linkedin', + tone: 'professional', + window: 'daily', + url: shareUrl, + scores: [{ ...(scores[0] as ShareScore), rankEligible: false }], + }) + + expect(draft.text).toContain('This is an aggregate-only share.') + expect(draft.text).not.toContain('aggregate-only, aggregate-only') + }) + it('does not include private or sensitive field names', () => { const draft = createShareDraft({ handle: 'wise', diff --git a/packages/rage-core/src/share.ts b/packages/rage-core/src/share.ts index f3547b0..11b47ff 100644 --- a/packages/rage-core/src/share.ts +++ b/packages/rage-core/src/share.ts @@ -77,6 +77,20 @@ function formatScore(score: ShareScore): string { return `${formatHostApp(score.hostApp)} ${formatRate(score.ratePerThousandWords)}/1k` } +function scoreBoundary(score: ShareScore): string { + return score.rankEligible ? 'rankable, aggregate-only' : 'aggregate-only' +} + +function scoreBoundaryStart(score: ShareScore): string { + return score.rankEligible ? 'Rankable, aggregate-only' : 'Aggregate-only' +} + +function shareBoundarySentence(score: ShareScore): string { + return score.rankEligible + ? 'This is a rankable, aggregate-only share.' + : 'This is an aggregate-only share.' +} + function comparisonLine(scores: ShareScore[]): string { return scores.map(formatScore).join(' vs ') } @@ -106,20 +120,20 @@ function createSingleHostDraft(input: ShareDraftInput, score: ShareScore): strin const window = formatWindow(input.window) const host = formatHostApp(score.hostApp) const rate = formatRate(score.ratePerThousandWords) - const rankable = score.rankEligible ? 'rankable' : 'aggregate-only' + const boundary = scoreBoundary(score) if (input.platform === 'x') { if (input.tone === 'snark') { - return `${host} extracted ${rate} rage hits/1k words from me ${window}. ${rankable} Rage AI score, transcripts stay local. ${input.url}` + return `${host} extracted ${rate} rage hits/1k words from my ${window} window. ${scoreBoundaryStart(score)} Rage AI score, transcripts stay local. ${input.url}` } - return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${rankable}, aggregate-only, transcripts stay local. ${input.url}` + return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${boundary}, transcripts stay local. ${input.url}` } if (input.tone === 'snark') { - return `${host} delivered my ${window} Rage AI score: ${rate} rage hits per 1,000 words.\n\nThe share is ${rankable} and aggregate-only. No raw transcripts, no matched words, no model names.\n\n${input.url}` + return `${host} delivered my ${window} Rage AI score: ${rate} rage hits per 1,000 words.\n\nThe share is ${boundary}. No raw transcripts, no matched words, no model names.\n\n${input.url}` } - return `My ${window} Rage AI score for ${host} is ${rate} rage hits per 1,000 words.\n\nThis is a ${rankable}, aggregate-only share. No raw transcripts, no matched words, no model names.\n\n${input.url}` + return `My ${window} Rage AI score for ${host} is ${rate} rage hits per 1,000 words.\n\n${shareBoundarySentence(score)} No raw transcripts, no matched words, no model names.\n\n${input.url}` } function fitXDraft(text: string, input: ShareDraftInput, scores: ShareScore[]): string { diff --git a/plugins/rage-claude/bin/rage.js b/plugins/rage-claude/bin/rage.js index 893a186..3670d01 100755 --- a/plugins/rage-claude/bin/rage.js +++ b/plugins/rage-claude/bin/rage.js @@ -14829,6 +14829,15 @@ function bestScore(scores) { function formatScore(score) { return `${formatHostApp(score.hostApp)} ${formatRate(score.ratePerThousandWords)}/1k`; } +function scoreBoundary(score) { + return score.rankEligible ? "rankable, aggregate-only" : "aggregate-only"; +} +function scoreBoundaryStart(score) { + return score.rankEligible ? "Rankable, aggregate-only" : "Aggregate-only"; +} +function shareBoundarySentence(score) { + return score.rankEligible ? "This is a rankable, aggregate-only share." : "This is an aggregate-only share."; +} function comparisonLine(scores) { return scores.map(formatScore).join(" vs "); } @@ -14859,23 +14868,23 @@ function createSingleHostDraft(input, score) { const window = formatWindow(input.window); const host = formatHostApp(score.hostApp); const rate = formatRate(score.ratePerThousandWords); - const rankable = score.rankEligible ? "rankable" : "aggregate-only"; + const boundary = scoreBoundary(score); if (input.platform === "x") { if (input.tone === "snark") { - return `${host} extracted ${rate} rage hits/1k words from me ${window}. ${rankable} Rage AI score, transcripts stay local. ${input.url}`; + return `${host} extracted ${rate} rage hits/1k words from my ${window} window. ${scoreBoundaryStart(score)} Rage AI score, transcripts stay local. ${input.url}`; } - return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${rankable}, aggregate-only, transcripts stay local. ${input.url}`; + return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${boundary}, transcripts stay local. ${input.url}`; } if (input.tone === "snark") { return `${host} delivered my ${window} Rage AI score: ${rate} rage hits per 1,000 words. -The share is ${rankable} and aggregate-only. No raw transcripts, no matched words, no model names. +The share is ${boundary}. No raw transcripts, no matched words, no model names. ${input.url}`; } return `My ${window} Rage AI score for ${host} is ${rate} rage hits per 1,000 words. -This is a ${rankable}, aggregate-only share. No raw transcripts, no matched words, no model names. +${shareBoundarySentence(score)} No raw transcripts, no matched words, no model names. ${input.url}`; } diff --git a/plugins/rage-codex/bin/rage.js b/plugins/rage-codex/bin/rage.js index 893a186..3670d01 100755 --- a/plugins/rage-codex/bin/rage.js +++ b/plugins/rage-codex/bin/rage.js @@ -14829,6 +14829,15 @@ function bestScore(scores) { function formatScore(score) { return `${formatHostApp(score.hostApp)} ${formatRate(score.ratePerThousandWords)}/1k`; } +function scoreBoundary(score) { + return score.rankEligible ? "rankable, aggregate-only" : "aggregate-only"; +} +function scoreBoundaryStart(score) { + return score.rankEligible ? "Rankable, aggregate-only" : "Aggregate-only"; +} +function shareBoundarySentence(score) { + return score.rankEligible ? "This is a rankable, aggregate-only share." : "This is an aggregate-only share."; +} function comparisonLine(scores) { return scores.map(formatScore).join(" vs "); } @@ -14859,23 +14868,23 @@ function createSingleHostDraft(input, score) { const window = formatWindow(input.window); const host = formatHostApp(score.hostApp); const rate = formatRate(score.ratePerThousandWords); - const rankable = score.rankEligible ? "rankable" : "aggregate-only"; + const boundary = scoreBoundary(score); if (input.platform === "x") { if (input.tone === "snark") { - return `${host} extracted ${rate} rage hits/1k words from me ${window}. ${rankable} Rage AI score, transcripts stay local. ${input.url}`; + return `${host} extracted ${rate} rage hits/1k words from my ${window} window. ${scoreBoundaryStart(score)} Rage AI score, transcripts stay local. ${input.url}`; } - return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${rankable}, aggregate-only, transcripts stay local. ${input.url}`; + return `${window} Rage AI score for ${host}: ${rate} rage hits/1k words. ${boundary}, transcripts stay local. ${input.url}`; } if (input.tone === "snark") { return `${host} delivered my ${window} Rage AI score: ${rate} rage hits per 1,000 words. -The share is ${rankable} and aggregate-only. No raw transcripts, no matched words, no model names. +The share is ${boundary}. No raw transcripts, no matched words, no model names. ${input.url}`; } return `My ${window} Rage AI score for ${host} is ${rate} rage hits per 1,000 words. -This is a ${rankable}, aggregate-only share. No raw transcripts, no matched words, no model names. +${shareBoundarySentence(score)} No raw transcripts, no matched words, no model names. ${input.url}`; }