feat(fairway): wire real CoachHelm engine into Team Brief (Phase 1, #922) - #932
feat(fairway): wire real CoachHelm engine into Team Brief (Phase 1, #922)#932njrini99-code wants to merge 1 commit into
Conversation
) Problem: FairwayBrief's hero + category-detail rows only ever rendered hand-written template prose (generateCategoryInsights in team-category-insights.ts) — a team trend/attention-count/standout sentence with no real strokes-gained signal, even though every golf_coach_insights row already carries a genuine per-cause counterfactual (evidence.counterfactual.strokes_saved_per_round) and standing snapshot. Fix (per the approved docs/fairway-coachhelm-insight-rebuild.md, Phase 1 scope only — no ThemeCard/cascade chrome, no schema change): - New pure, read-time-only assembler (src/lib/coachhelm/v3/brief/assemble.ts) that takes the team's already ranked + deduped + visibility-filtered EvidenceInsight[] (fetched via the SAME insight-delivery read path the Signals surfaces use — getInsightsForCoachWithMeta, no player_id, RLS-scoped to the coach's team) and derives ONE genuine sentence per Brief category: a live strokes-saved figure when the counterfactual is non-suppressed, or an honest "top signal" framing when it's diagnostic-only. A category with no visible engine row is simply absent — the caller falls back to the existing template text. - Wired additively into getTeamCategoryInsightsImpl: the engine fetch + assembly happens AFTER the existing trend/rating loop (PR #929 territory, untouched) and only prepends to categories[].insights; any failure degrades to template-only insights, never breaks the read. - FairwayBrief.tsx's CategoryHealthRow badges an engine-backed row with its real strokes-saved figure (small, additive; hero + category rows both already read insights[0], so both surfaces inherit the genuine sentence with zero data-fetching changes to the component itself). - Replaced the pre-Fairway GenericPageSkeleton loading fallback for /golf/dashboard/intelligence with a shape-matched fw-token skeleton mirroring FairwayBrief's real layout (hero / strengths-weaknesses / pulse strip / category rows / deep-analysis disclosure), same pattern as dashboard/insights/loading.tsx and FairwayBrief's own DeepAnalysisSkeleton. Gates: npx tsc --noEmit -p tsconfig.json (clean); npx eslint on all 5 changed files (clean); npx vitest run on the new assembler suite (44 passed) + team-category-insights-helpers, insight-delivery-*, v3/themes/* suites, and the B8-FILES coverage-contract gate (all green, no regressions). Fixes #922 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
🤖 Mission Control — PR summary What it changes: Wires the real CoachHelm v3 engine into the Team Brief (Phase 1 of #922). Adds a pure, read-time-only assembler ( Area: GolfHelm / CoachHelm (read-only; no schema change). Risk / reviewers watch:
CI: 4 required gates green (typecheck / lint / vitest / build). CodeRabbit posted advisory changes and the PR is |
Problem
FairwayBrief.tsx's hero ("Work on this first" foot strip) and category-detail rows only ever rendered hand-written template prose (generateCategoryInsightsinteam-category-insights.ts) — a team trend / attention-count / standout sentence with no real strokes-gained signal — even though everygolf_coach_insightsrow already carries a genuine per-cause counterfactual (evidence.counterfactual.strokes_saved_per_round) and standing snapshot.Fix
Per the approved
docs/fairway-coachhelm-insight-rebuild.md, Phase 1 scope only (no ThemeCard/cascade chrome — that's Phase 2 /IntelligenceCommandCenterterritory, explicitly out of scope here; no schema change):src/lib/coachhelm/v3/brief/assemble.ts, no IO) that takes the team's already ranked + deduped + visibility-filteredEvidenceInsight[]— fetched via the same insight-delivery read path the Signals surfaces use (getInsightsForCoachWithMeta, noplayer_id→ RLS-scoped to the coach's team,applyInsightVisibilityapplied) — and derives one genuine sentence per Brief category:driving→teecategory alias mirrorsFairwayBrief.tsx's ownsignalsHrefalias so the lookup lands on the same rows the deep-link doesgetTeamCategoryInsightsImpl: the engine fetch + assembly happens after the existing trend/rating loop (PR fix(coachhelm): unify player/team trend across Brief, Players tab, Team Stats #929 territory — untouched, not rewritten) and only prepends tocategories[].insights. Wrapped in try/catch — any failure degrades to template-only insights, never breaks the read.FairwayBrief.tsx—CategoryHealthRowbadges an engine-backed row with its real strokes-saved figure (small, additive). The hero's foot strip and the category-detail rows both already readcat.insights[0], so both surfaces inherit the genuine engine sentence with zero data-fetching changes to the component itself (its own header comment forbids that) — only the upstream prose source changed.GenericPageSkeletonfallback for/golf/dashboard/intelligencewith a shape-matched fw-token skeleton mirroringFairwayBrief's real layout (hero / strengths-weaknesses split / pulse strip / 5 category rows / deep-analysis disclosure bar) — same pattern asdashboard/insights/loading.tsxandFairwayBrief.tsx's ownDeepAnalysisSkeleton(~line 1048).Scope guardrails honored
IntelligenceCommandCenter's chrome (Phase 2).golf_coach_insights.evidence.team-category-insights.ts'scomputeTrend/rating math (PR fix(coachhelm): unify player/team trend across Brief, Players tab, Team Stats #929 territory) is completely untouched; the new step is appended after the categories array is fully built.Gates
npx tsc --noEmit -p tsconfig.json— cleannpx eslinton all 5 changed files — cleannpx vitest run— new assembler suite (44 passed across unit/integration/business/rls projects) +team-category-insights-helpers,insight-delivery-meta-and-feedback,insight-delivery-coach-feed,insight-delivery-themes,insight-delivery-rank, fullv3/themes/suite (468 passed), and the B8-FILEScoverage-contractgate — all green, no regressionsFixes #922
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg