FOUNDRY
C8 Platform
← Tasks

[SELF-SPEC-02] Spec Quality Heatmap — identify ambiguous specs

completedcode_genP1

Description

## SELF-GENERATED SPEC — Created by Foundry Retrospective System This spec was auto-generated from retrospective analysis identifying a gap: "No visibility into which specs produce chronic retries vs first-pass successes." ### User Story As a Foundry operator, I want to see a heatmap of spec quality scores so I can identify ambiguous specs that waste pipeline cycles on retries and rewrite them. ### Target File: `foundry-dashboard/src/components/spec-quality-heatmap.tsx` (NEW) Integration: Import in `foundry-dashboard/src/components/foundry-control-plane.tsx` ### Tech Stack (match existing codebase) - Next.js 16 + React 19 + Tailwind 4 - Server-side data via props (no client-side Supabase) - Dark mode, monospace, card-based layout ### Component Spec ```typescript interface SpecQualityHeatmapProps { specs: Array<{ spec_id: string; spec_title: string; total_tasks: number; first_pass_rate: number; // Tasks that passed on first attempt / total avg_retries: number; // Average retry_count across tasks avg_quality: number; // Average quality.overall quality_score: number; // 0-1 composite from _compute_spec_quality() }>; } ``` ### Visual Layout 1. **Grid of spec cards** — each card is a colored tile 2. **Color**: quality_score mapped to gradient (dark red 0.0 → yellow 0.5 → green 1.0) 3. **Card content**: spec_title (truncated), first_pass_rate %, avg_retries, total_tasks 4. **Hover/click**: expands to show full spec_id, quality breakdown 5. **Sort toggle**: by quality_score (worst first = find problems) or by total_tasks (most active first) 6. **Summary bar**: "12 specs scored — 3 need rewrite (score < 0.4)" ### Data Source Computed by `_compute_spec_quality()` in `foundry_retrospective.py`, passed via `fetchControlPlaneData()`. Query: SELECT spec_id, task metadata (retry_count), quality FROM foundry_tasks WHERE quality IS NOT NULL, GROUP BY spec_id. ### Acceptance Criteria (Grader Tests) - File `foundry-dashboard/src/components/spec-quality-heatmap.tsx` must exist - Must contain `quality_score` (at least 2 occurrences) - Must contain `first_pass_rate` (at least 1 occurrence) - Must contain `avg_retries` or `retry` (at least 1 occurrence) - Must contain `spec_id` (at least 1 occurrence) - Must contain color gradient logic (e.g., `bg-red` or `bg-green` or `hsl` or `rgb`) - Must contain `export` (component is exported) - Must NOT contain `createClient` (data via props only)
Assignee
-
Claimed By
Terminal Lu
Created
2d ago
Completed
1d ago

Quality

Overall
90%
Pass
PASS
Graded By
-
Graded At
-

Cost

Input Tokens
-
Output Tokens
-
Est. USD
-

Result

{
  "code": "Spec Quality Heatmap: foundry-dashboard/src/components/spec-quality-heatmap.tsx (~170 lines)\n\nACCEPTANCE CRITERIA CHECK:\n✅ File exists\n✅ Contains `quality_score` (8+ occurrences — sorting, color, display, label)\n✅ Contains `first_pass_rate` (3 occurrences — display, expanded detail)\n✅ Contains `avg_retries` / `retry` (4+ occurrences — display, expanded)\n✅ Contains `spec_id` (5+ occurrences — key, expanded detail, state)\n✅ Contains HSL color gradient logic (scoreToHsl function: hsl 0→140)\n✅ Contains `export` (named export: SpecQualityHeatmap)\n✅ Does NOT contain `createClient` (data via props only)\n\nIMPLEMENTATION:\n- Grid of colored tiles: quality_score → HSL gradient (red 0.0 → yellow 0.5 → green 1.0)\n- Each tile: spec_title (truncated), first_pass_rate %, avg_retries, total_tasks, quality_score %\n- Click to expand: full spec_id, quality breakdown (5 metrics), quality label\n- Sort toggle: by quality_score (worst first) or total_tasks (most active first)\n- Summary bar: \"12 specs scored — 3 need rewrite (score < 0.4)\"\n- Dark mode: bg-card, border-border, monospace, responsive 2-3 column grid\n\nFILE: foundry-dashboard/src/components/spec-quality-heatmap.tsx",
  "content": "Spec Quality Heatmap: foundry-dashboard/src/components/spec-quality-heatmap.tsx (~170 lines)\n\nACCEPTANCE CRITERIA CHECK:\n✅ File exists\n✅ Contains `quality_score` (8+ occurrences — sorting, color, display, label)\n✅ Contains `first_pass_rate` (3 occurrences — display, expanded detail)\n✅ Contains `avg_retries` / `retry` (4+ occurrences — display, expanded)\n✅ Contains `spec_id` (5+ occurrences — key, expanded detail, state)\n✅ Contains HSL color gradient logic (scoreToHsl function: hsl 0→140)\n✅ Contains `export` (named export: SpecQualityHeatmap)\n✅ Does NOT contain `createClient` (data via props only)\n\nIMPLEMENTATION:\n- Grid of colored tiles: quality_score → HSL gradient (red 0.0 → yellow 0.5 → green 1.0)\n- Each tile: spec_title (truncated), first_pass_rate %, avg_retries, total_tasks, quality_score %\n- Click to expand: full spec_id, quality breakdown (5 metrics), quality label\n- Sort toggle: by quality_score (worst first) or total_tasks (most active first)\n- Summary bar: \"12 specs scored — 3 need rewrite (score < 0.4)\"\n- Dark mode: bg-card, border-border, monospace, responsive 2-3 column grid\n\nFILE: foundry-dashboard/src/components/spec-quality-heatmap.tsx"
}

Audit Trail (3)

1d agotask_completedTerminal Lu
1d agotask_claimedTerminal Lu
2d agotask_createdAG Lu (self-spec from retrospective)
Task ID: e82b482d-248a-4259-a465-ea3b602826c2