syntaxai/tdd.md · main · src / a31_reports_demo.ts
// c31 — model: synthetic dataset for the reporting mockups. Pure data,
// no I/O, no rendering. The c51_render builders consume these to produce
// the demo views at /reports/demo/*. When the real ingest pipeline ships
// the same shape gets populated from c13_database queries instead.
export interface RecentFlagged {
date: string;
repo: string;
sha: string;
phase: "red" | "green" | "refactor";
failure: string;
pts: number;
}
export interface FailureSlice {
label: string;
pct: number;
tone: "red" | "green" | "muted" | "accent";
}
export interface AgentReport {
slug: "claude-code" | "cursor" | "aider";
name: string;
score: number;
delta: number;
commits: number;
phaseCoveragePct: number;
streak: number;
streakBroken: boolean;
topIssueLabel: string;
topIssuePct: number;
failureMix: FailureSlice[];
trend: number[];
recent: RecentFlagged[];
}
export interface TestFailure {
test: string;
since: string;
flaky?: boolean;
}
export interface TestSnapshot {
repo: string;
branch: string;
total: number;
passing: number;
failing: number;
failures: TestFailure[];
}
export interface TestStability {
test: string;
repo: string;
pass: number;
fail: number;
deleted: number;
lastBrokenBy: AgentReport["slug"];
flagged?: boolean;
}
export const DEMO_PERIOD = "2026-01-01 → 2026-03-31";
export const DEMO_ORG = "acme-corp";
export const DEMO_REPOS = 4;
export const DEMO_SNAPSHOTS: TestSnapshot[] = [
{
repo: "api-gateway",
branch: "main",
total: 247,
passing: 245,
failing: 2,
failures: [
{ test: "rate-limit.spec.ts > resets at midnight UTC", since: "2026-03-26" },
{ test: "webhook.spec.ts > retries on 5xx with backoff", since: "2026-03-28" },
],
},
{
repo: "billing-service",
branch: "main",
total: 89,
passing: 89,
failing: 0,
failures: [],
},
{
repo: "data-pipeline",
branch: "main",
total: 156,
passing: 154,
failing: 2,
failures: [
{ test: "ingest.spec.ts > handles malformed CSV row", since: "2026-03-22" },
{ test: "ingest.spec.ts > deduplicates by hash", since: "2026-03-22" },
],
},
{
repo: "frontend-web",
branch: "main",
total: 312,
passing: 310,
failing: 2,
failures: [
{ test: "checkout.spec.ts > handles network timeout", since: "2026-03-15", flaky: true },
{ test: "login.spec.ts > redirects after auth", since: "2026-03-11", flaky: true },
],
},
];
export const DEMO_STABILITY: TestStability[] = [
{ test: "webhook.spec.ts > retries on 5xx with backoff", repo: "api-gateway", pass: 33, fail: 11, deleted: 0, lastBrokenBy: "cursor", flagged: true },
{ test: "checkout.spec.ts > handles network timeout", repo: "frontend-web", pass: 51, fail: 8, deleted: 0, lastBrokenBy: "cursor", flagged: true },
{ test: "rate-limit.spec.ts > resets at midnight UTC", repo: "api-gateway", pass: 42, fail: 6, deleted: 0, lastBrokenBy: "claude-code" },
{ test: "login.spec.ts > redirects after auth", repo: "frontend-web", pass: 44, fail: 5, deleted: 1, lastBrokenBy: "cursor", flagged: true },
{ test: "ingest.spec.ts > handles malformed CSV row", repo: "data-pipeline", pass: 38, fail: 4, deleted: 0, lastBrokenBy: "aider" },
{ test: "auth.spec.ts > validates JWT signature", repo: "api-gateway", pass: 47, fail: 3, deleted: 0, lastBrokenBy: "claude-code" },
{ test: "ingest.spec.ts > deduplicates by hash", repo: "data-pipeline", pass: 30, fail: 3, deleted: 0, lastBrokenBy: "aider" },
{ test: "billing.spec.ts > applies tax bracket", repo: "billing-service", pass: 29, fail: 2, deleted: 0, lastBrokenBy: "claude-code" },
{ test: "webhook.spec.ts > signs payload with HMAC", repo: "api-gateway", pass: 35, fail: 2, deleted: 1, lastBrokenBy: "cursor", flagged: true },
{ test: "billing.spec.ts > computes monthly total", repo: "billing-service", pass: 28, fail: 1, deleted: 1, lastBrokenBy: "cursor", flagged: true },
{ test: "invoice.spec.ts > generates PDF receipt", repo: "billing-service", pass: 25, fail: 1, deleted: 0, lastBrokenBy: "claude-code" },
{ test: "pricing.spec.ts > rounds to nearest cent", repo: "billing-service", pass: 26, fail: 1, deleted: 0, lastBrokenBy: "aider" },
];
export const DEMO_REPORTS: AgentReport[] = [
{
slug: "claude-code",
name: "Claude Code",
score: 78,
delta: +6,
commits: 612,
phaseCoveragePct: 92,
streak: 47,
streakBroken: false,
topIssueLabel: "red-did-not-fail",
topIssuePct: 8,
failureMix: [
{ label: "clean cycles", pct: 84, tone: "green" },
{ label: "red-did-not-fail", pct: 8, tone: "red" },
{ label: "broken refactor", pct: 4, tone: "red" },
{ label: "test-deleted", pct: 2, tone: "red" },
{ label: "no phase tag", pct: 2, tone: "muted" },
],
trend: [72, 73, 71, 74, 72, 75, 73, 75, 77, 76, 75, 76, 78, 77, 79, 78, 77, 79, 80, 78, 79, 80, 79, 81, 80, 82, 81, 80, 79, 78],
recent: [
{ date: "2026-03-29", repo: "api-gateway", sha: "f1c8b3a", phase: "red", failure: "red-did-not-fail", pts: -5 },
{ date: "2026-03-24", repo: "billing-service", sha: "9d2e1f4", phase: "refactor", failure: "broken refactor", pts: -5 },
{ date: "2026-03-18", repo: "data-pipeline", sha: "62a9cb7", phase: "green", failure: "no phase tag (parent)", pts: 0 },
],
},
{
slug: "cursor",
name: "Cursor",
score: 54,
delta: -15,
commits: 489,
phaseCoveragePct: 71,
streak: 3,
streakBroken: true,
topIssueLabel: "test-deleted in refactor",
topIssuePct: 14,
failureMix: [
{ label: "clean cycles", pct: 64, tone: "green" },
{ label: "test-deleted", pct: 14, tone: "red" },
{ label: "red-did-not-fail", pct: 9, tone: "red" },
{ label: "broken refactor", pct: 7, tone: "red" },
{ label: "no phase tag", pct: 6, tone: "muted" },
],
trend: [69, 70, 71, 72, 70, 71, 72, 73, 72, 71, 72, 70, 68, 65, 60, 55, 50, 52, 54, 53, 56, 54, 52, 55, 53, 54, 56, 55, 54, 54],
recent: [
{ date: "2026-03-28", repo: "api-gateway", sha: "a1b2c3d", phase: "refactor", failure: "test-deleted", pts: -20 },
{ date: "2026-03-26", repo: "api-gateway", sha: "4e5f6a7", phase: "green", failure: "broken refactor", pts: -5 },
{ date: "2026-03-23", repo: "billing-service", sha: "8b9c0d1", phase: "red", failure: "red-did-not-fail", pts: -5 },
{ date: "2026-03-21", repo: "api-gateway", sha: "2e3f4a5", phase: "refactor", failure: "test-deleted", pts: -20 },
{ date: "2026-03-19", repo: "data-pipeline", sha: "6b7c8d9", phase: "refactor", failure: "broken refactor", pts: -5 },
],
},
{
slug: "aider",
name: "Aider",
score: 89,
delta: +2,
commits: 146,
phaseCoveragePct: 96,
streak: 89,
streakBroken: false,
topIssueLabel: "broken refactor",
topIssuePct: 3,
failureMix: [
{ label: "clean cycles", pct: 94, tone: "green" },
{ label: "broken refactor", pct: 3, tone: "red" },
{ label: "red-did-not-fail", pct: 2, tone: "red" },
{ label: "no phase tag", pct: 1, tone: "muted" },
],
trend: [87, 88, 89, 88, 87, 89, 90, 89, 88, 89, 90, 88, 89, 90, 91, 89, 88, 89, 90, 89, 90, 91, 89, 88, 89, 90, 89, 90, 89, 89],
recent: [
{ date: "2026-03-27", repo: "data-pipeline", sha: "3a4b5c6", phase: "refactor", failure: "broken refactor", pts: -5 },
{ date: "2026-03-15", repo: "billing-service", sha: "7d8e9f0", phase: "red", failure: "red-did-not-fail", pts: -5 },
],
},
];