mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
feat(lifecycle): revision findings ledger — structured failure feedback, persisted and delivered down the chain (#486)
* feat(lifecycle): revision findings ledger — structured QA/PR/PM/CEO failure feedback, persisted and delivered down the chain Every bounce used to survive only as flattened prose: rounds overwrote each other in notes_structured, request_changes persisted nothing, two raw dev_notes appends were silently destroyed by the next handoff note, and the dev prompt pointed at fields (qa_notes via evidence(), pm_notes) the API never delivered. Agents re-interpreted and re-discovered every failure before they could start fixing it. - task_review_findings (migration 071, append-only): file/line/severity/ criterion(AC-id-validated)/expected/actual/fix/evidence per finding, with origin (qa|pr_gate|pm|ceo), round, and an open->addressed->verified lifecycle (waived reserved); new tasks.pm_notes + PmReviewContent give request_changes a structured home - producers: fail_review/pr_fail/request_changes take findings=[...] (prose issues shimmed+merged for one release, deprecation-logged); ceo_reject validates its reason (no 500), lands an origin=ceo finding, and bumps round+audit on branchless coordination roots; guardrails at the verb chokepoint (nudge >5, hard reject >10, field caps, traversal-safe file); the dev_notes data-loss appends are removed; new task.request_changes + task.ceo_reject audit events close rework attribution - delivery: qa_notes/pr_reviewer_notes/pm_notes carry the deterministic [F-id8] rendering; claim briefings, evidence(), the REVISION_REQUIRED spawn prompt, PM triage bounced-blocks, and A2A bodies deliver open findings; round-N+1 QA and gate reviewers get the full prior ledger; panel Findings tab + bounced-xN chip; metrics pm_rejects/ceo_rejects + findings counts; vault task notes render a Findings section (fail-open) - resolution closes for every origin: i_am_done and submit_up/submit_root take resolved_findings gated by FINDINGS_ADDRESSED (owner-gated so a stale non-owner PM can never mutate the ledger); pass_review/pr_pass/ complete verify-stamp same-transaction; ceo_approve stamps best-effort - 24 real-DB integration tests drive the full loop through the real choreographer; full suite 12856 green * docs: revision findings ledger sweep — CLAUDE.md, map, RAG corpus - CLAUDE.md: new ledger section + corrected request_changes row - docs/map/review-findings.md (new subsystem map) + surgical updates to task-service/pr-gate-review/metrics-observability/vault/panel maps - docs/rag: producers' findings contract across qa/pr-reviewer/developer/ cell-pm/main-pm/ceo role docs (the PM docs were missing request_changes entirely), verb references, and a new architecture/review-findings.md disambiguating ledger findings from convention findings * test(e2e): resubmit resolves the pr_fail finding per the ledger contract The scripted pr_fail revision loop resubmitted submit_up without resolved_findings — correctly rejected now that FINDINGS_ADDRESSED gates the PM resubmit verbs (green locally, red only in CI since the e2e suite skips without ROBOCO_E2E_SMOKE=1). The scripted PM now reads the open ledger row pr_fail persisted (new open_finding_ids arc helper) and resolves it on resubmit, asserting the open set drains — exercising the coordinator half of the new contract end to end. --------- Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
@@ -204,6 +204,12 @@ function ReworkCard() {
|
||||
<th className="py-1 font-medium text-right">
|
||||
PR fails
|
||||
</th>
|
||||
<th className="py-1 font-medium text-right">
|
||||
PM rejects
|
||||
</th>
|
||||
<th className="py-1 font-medium text-right">
|
||||
CEO rejects
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -216,6 +222,8 @@ function ReworkCard() {
|
||||
<td className="py-1 text-right">{pct(a.rate)}</td>
|
||||
<td className="py-1 text-right">{a.qa_fails}</td>
|
||||
<td className="py-1 text-right">{a.pr_fails}</td>
|
||||
<td className="py-1 text-right">{a.pm_rejects}</td>
|
||||
<td className="py-1 text-right">{a.ceo_rejects}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -238,6 +246,12 @@ function ReworkCard() {
|
||||
<ResponsiveTableCardRow label="PR fails">
|
||||
{a.pr_fails}
|
||||
</ResponsiveTableCardRow>
|
||||
<ResponsiveTableCardRow label="PM rejects">
|
||||
{a.pm_rejects}
|
||||
</ResponsiveTableCardRow>
|
||||
<ResponsiveTableCardRow label="CEO rejects">
|
||||
{a.ceo_rejects}
|
||||
</ResponsiveTableCardRow>
|
||||
</div>
|
||||
</ResponsiveTableCard>
|
||||
))}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { TaskStatus, Team, TaskType, type Task } from "@/types";
|
||||
import type { TaskFindingsResponse } from "@/lib/api/tasks";
|
||||
|
||||
// Mirrors tab-progress-collapse.test.tsx's shape: mock the data hook
|
||||
// directly rather than wiring a real QueryClient — TabFindings only reads
|
||||
// the hook's return value.
|
||||
const { useTaskFindings } = vi.hoisted(() => ({ useTaskFindings: vi.fn() }));
|
||||
|
||||
vi.mock("@/hooks/use-tasks", () => ({ useTaskFindings }));
|
||||
|
||||
import { TabFindings } from "../tab-findings";
|
||||
|
||||
function buildTask(overrides: Partial<Task> = {}): Task {
|
||||
return {
|
||||
id: "t1",
|
||||
title: "Task",
|
||||
description: "d",
|
||||
status: TaskStatus.NEEDS_REVISION,
|
||||
team: Team.BACKEND,
|
||||
task_type: TaskType.CODE,
|
||||
acceptance_criteria: [],
|
||||
...overrides,
|
||||
} as unknown as Task;
|
||||
}
|
||||
|
||||
describe("TabFindings", () => {
|
||||
it("renders the empty state when the task was never bounced", () => {
|
||||
useTaskFindings.mockReturnValue({
|
||||
data: { findings: [], summary: [], total: 0, truncated: false },
|
||||
});
|
||||
render(<TabFindings task={buildTask()} />);
|
||||
expect(
|
||||
screen.getByText("No revision findings recorded yet."),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("groups findings by round and renders severity/status", () => {
|
||||
const response: TaskFindingsResponse = {
|
||||
findings: [
|
||||
{
|
||||
id: "aaaaaaaa-0000-0000-0000-000000000000",
|
||||
task_id: "t1",
|
||||
origin: "qa",
|
||||
round: 2,
|
||||
author_slug: "be-qa",
|
||||
file: "roboco/services/task.py",
|
||||
line: 42,
|
||||
severity: "blocker",
|
||||
criterion: null,
|
||||
expected: "the endpoint returns 404",
|
||||
actual: "the endpoint returns 500",
|
||||
fix: "add a not-found guard",
|
||||
evidence: null,
|
||||
status: "open",
|
||||
addressed_by_commit: null,
|
||||
resolution_note: null,
|
||||
created_at: "2026-07-11T00:00:00Z",
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
id: "bbbbbbbb-0000-0000-0000-000000000000",
|
||||
task_id: "t1",
|
||||
origin: "qa",
|
||||
round: 1,
|
||||
author_slug: "be-qa",
|
||||
file: "roboco/services/task.py",
|
||||
line: 10,
|
||||
severity: "minor",
|
||||
criterion: null,
|
||||
expected: "x",
|
||||
actual: "y",
|
||||
fix: null,
|
||||
evidence: null,
|
||||
status: "verified",
|
||||
addressed_by_commit: "abc1234def",
|
||||
resolution_note: null,
|
||||
created_at: "2026-07-10T00:00:00Z",
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
summary: [
|
||||
{ origin: "qa", open: 1, addressed: 0, verified: 1, waived: 0 },
|
||||
],
|
||||
total: 2,
|
||||
truncated: false,
|
||||
};
|
||||
useTaskFindings.mockReturnValue({ data: response, isLoading: false });
|
||||
render(<TabFindings task={buildTask()} />);
|
||||
|
||||
expect(screen.getByText("Round 2")).toBeInTheDocument();
|
||||
expect(screen.getByText("Round 1")).toBeInTheDocument();
|
||||
expect(screen.getByText("blocker")).toBeInTheDocument();
|
||||
expect(screen.getByText("minor")).toBeInTheDocument();
|
||||
expect(screen.getByText("abc1234")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/more not shown/)).toBeNull();
|
||||
});
|
||||
|
||||
it("annotates a truncated ledger with the not-shown remainder", () => {
|
||||
const response: TaskFindingsResponse = {
|
||||
findings: [
|
||||
{
|
||||
id: "cccccccc-0000-0000-0000-000000000000",
|
||||
task_id: "t1",
|
||||
origin: "qa",
|
||||
round: 1,
|
||||
author_slug: "be-qa",
|
||||
file: null,
|
||||
line: null,
|
||||
severity: "minor",
|
||||
criterion: null,
|
||||
expected: "x",
|
||||
actual: "y",
|
||||
fix: null,
|
||||
evidence: null,
|
||||
status: "open",
|
||||
addressed_by_commit: null,
|
||||
resolution_note: null,
|
||||
created_at: "2026-07-11T00:00:00Z",
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
summary: [
|
||||
{ origin: "qa", open: 501, addressed: 0, verified: 0, waived: 0 },
|
||||
],
|
||||
total: 501,
|
||||
truncated: true,
|
||||
};
|
||||
useTaskFindings.mockReturnValue({ data: response, isLoading: false });
|
||||
render(<TabFindings task={buildTask()} />);
|
||||
expect(
|
||||
screen.getByText("… 500 more not shown (501 total)"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -10,6 +10,7 @@ export { TabProgress } from "./tab-progress";
|
||||
export { TabCommits } from "./tab-commits";
|
||||
export { TabNotes } from "./tab-notes";
|
||||
export { TabDependencies } from "./tab-dependencies";
|
||||
export { TabFindings } from "./tab-findings";
|
||||
export { AcceptanceCriteria } from "./acceptance-criteria";
|
||||
export { ProgressTimeline } from "./progress-timeline";
|
||||
export { CheckpointCard } from "./checkpoint-card";
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
"use client";
|
||||
|
||||
import { Task } from "@/types";
|
||||
import { useTaskFindings } from "@/hooks/use-tasks";
|
||||
import type { TaskFinding } from "@/lib/api/tasks";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { ListChecks } from "lucide-react";
|
||||
|
||||
interface TabFindingsProps {
|
||||
task: Task;
|
||||
}
|
||||
|
||||
const SEVERITY_CLASS: Record<string, string> = {
|
||||
blocker: "bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",
|
||||
major:
|
||||
"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300",
|
||||
minor:
|
||||
"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",
|
||||
nit: "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",
|
||||
};
|
||||
|
||||
const STATUS_CLASS: Record<string, string> = {
|
||||
open: "border-red-300 text-red-700 dark:border-red-800 dark:text-red-300",
|
||||
addressed:
|
||||
"border-blue-300 text-blue-700 dark:border-blue-800 dark:text-blue-300",
|
||||
verified:
|
||||
"border-green-300 text-green-700 dark:border-green-800 dark:text-green-300",
|
||||
waived: "border-border text-muted-foreground",
|
||||
};
|
||||
|
||||
const ORIGIN_LABEL: Record<string, string> = {
|
||||
qa: "QA",
|
||||
pr_gate: "PR Review",
|
||||
pm: "PM",
|
||||
ceo: "CEO",
|
||||
};
|
||||
|
||||
function FindingCard({ finding }: { finding: TaskFinding }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="pt-4 space-y-2">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Badge className={SEVERITY_CLASS[finding.severity] ?? SEVERITY_CLASS.nit}>
|
||||
{finding.severity}
|
||||
</Badge>
|
||||
<Badge variant="outline" className={STATUS_CLASS[finding.status]}>
|
||||
{finding.status}
|
||||
</Badge>
|
||||
{finding.file && (
|
||||
<code className="text-xs text-muted-foreground">
|
||||
{finding.file}
|
||||
{finding.line != null ? `:${finding.line}` : ""}
|
||||
</code>
|
||||
)}
|
||||
{finding.criterion && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
· {finding.criterion}
|
||||
</span>
|
||||
)}
|
||||
{finding.addressed_by_commit && (
|
||||
<code className="ml-auto text-xs text-muted-foreground">
|
||||
{finding.addressed_by_commit.slice(0, 7)}
|
||||
</code>
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-1 text-sm">
|
||||
<p>
|
||||
<span className="text-muted-foreground">Expected:</span>{" "}
|
||||
{finding.expected}
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-muted-foreground">Actual:</span>{" "}
|
||||
{finding.actual}
|
||||
</p>
|
||||
{finding.fix && (
|
||||
<p>
|
||||
<span className="text-muted-foreground">Fix:</span> {finding.fix}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{finding.evidence && (
|
||||
<details className="text-xs text-muted-foreground">
|
||||
<summary className="cursor-pointer select-none">Evidence</summary>
|
||||
<pre className="mt-1 whitespace-pre-wrap rounded bg-muted/50 p-2">
|
||||
{finding.evidence}
|
||||
</pre>
|
||||
</details>
|
||||
)}
|
||||
{finding.resolution_note && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Resolution: {finding.resolution_note}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
export function TabFindings({ task }: TabFindingsProps) {
|
||||
const { data, isLoading } = useTaskFindings(task.id);
|
||||
const findings = data?.findings ?? [];
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<Skeleton className="h-24 w-full" />
|
||||
<Skeleton className="h-24 w-full" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (findings.length === 0) {
|
||||
return (
|
||||
<div className="py-12 text-center text-muted-foreground">
|
||||
<ListChecks className="mx-auto mb-4 h-12 w-12 opacity-50" />
|
||||
<p>No revision findings recorded yet.</p>
|
||||
<p className="mt-2 text-sm">
|
||||
Findings appear here after the first QA / PR-review / PM / CEO
|
||||
bounce.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Findings arrive newest-round-first; group while preserving that order.
|
||||
const rounds: { round: number; origin: string; items: TaskFinding[] }[] = [];
|
||||
for (const f of findings) {
|
||||
const last = rounds[rounds.length - 1];
|
||||
if (last && last.round === f.round) last.items.push(f);
|
||||
else rounds.push({ round: f.round, origin: f.origin, items: [f] });
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{(data?.summary.length ?? 0) > 0 && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{data!.summary.map((s) => (
|
||||
<Badge key={s.origin} variant="outline">
|
||||
{ORIGIN_LABEL[s.origin] ?? s.origin}: {s.open} open ·{" "}
|
||||
{s.addressed + s.verified + s.waived} closed
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{rounds.map((group) => (
|
||||
<div key={group.round} className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-sm font-semibold">Round {group.round}</h3>
|
||||
<Badge variant="outline">
|
||||
{ORIGIN_LABEL[group.origin] ?? group.origin}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{group.items.map((f) => (
|
||||
<FindingCard key={f.id} finding={f} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{data?.truncated && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
… {data.total - findings.length} more not shown ({data.total} total)
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import {
|
||||
Send,
|
||||
ThumbsUp,
|
||||
ThumbsDown,
|
||||
RotateCcw,
|
||||
} from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { TaskTypeBadge } from "../task-type-badge";
|
||||
@@ -142,6 +143,7 @@ export function TaskHeader({ task, onAction, nav }: TaskHeaderProps) {
|
||||
const overrideStatuses: TaskStatus[] = Object.values(TaskStatus).filter(
|
||||
(s) => s !== task.status && !nextStatuses.includes(s),
|
||||
);
|
||||
const revisionCount = task.revision_count ?? 0;
|
||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||
|
||||
// Inline editing states
|
||||
@@ -604,6 +606,22 @@ export function TaskHeader({ task, onAction, nav }: TaskHeaderProps) {
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Bounced chip — hidden for a never-bounced task. */}
|
||||
{revisionCount > 0 && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-amber-300 bg-amber-100 px-2 text-xs font-medium text-amber-800 dark:border-amber-800 dark:bg-amber-900 dark:text-amber-300">
|
||||
<RotateCcw className="h-3 w-3" />
|
||||
bounced x{revisionCount}
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
Sent back to needs_revision {revisionCount} time
|
||||
{revisionCount === 1 ? "" : "s"} — see the Findings tab
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||
import { Task } from "@/types";
|
||||
import { useTaskFindings } from "@/hooks/use-tasks";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
@@ -15,6 +16,7 @@ import { TabProgress } from "./tab-progress";
|
||||
import { TabCommits } from "./tab-commits";
|
||||
import { TabNotes } from "./tab-notes";
|
||||
import { TabDependencies } from "./tab-dependencies";
|
||||
import { TabFindings } from "./tab-findings";
|
||||
import {
|
||||
FileText,
|
||||
Layout,
|
||||
@@ -22,6 +24,7 @@ import {
|
||||
GitCommit,
|
||||
StickyNote,
|
||||
Link2,
|
||||
ListChecks,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
|
||||
@@ -53,6 +56,8 @@ export function TaskTabs({ task }: TaskTabsProps) {
|
||||
(task.auditor_notes ? 1 : 0) +
|
||||
(task.quick_context ? 1 : 0);
|
||||
const depsCount = task.dependency_ids.length + task.blocker_ids.length;
|
||||
const { data: findingsData } = useTaskFindings(task.id);
|
||||
const findingsCount = findingsData?.total ?? 0;
|
||||
|
||||
const tabs: TabDef[] = [
|
||||
{
|
||||
@@ -96,6 +101,13 @@ export function TaskTabs({ task }: TaskTabsProps) {
|
||||
hint: "Dependencies and blockers",
|
||||
count: depsCount > 0 ? depsCount : undefined,
|
||||
},
|
||||
{
|
||||
value: "findings",
|
||||
label: "Findings",
|
||||
icon: ListChecks,
|
||||
hint: "Revision-findings ledger — QA / PR-review / PM / CEO bounce feedback",
|
||||
count: findingsCount > 0 ? findingsCount : undefined,
|
||||
},
|
||||
];
|
||||
|
||||
// The active tab lives in the URL (?tab=) so it survives reloads,
|
||||
@@ -116,7 +128,7 @@ export function TaskTabs({ task }: TaskTabsProps) {
|
||||
|
||||
return (
|
||||
<Tabs value={activeTab} onValueChange={handleTabChange} className="mt-6">
|
||||
<TabsList className="grid w-full grid-cols-6 lg:w-auto lg:inline-grid">
|
||||
<TabsList className="grid w-full grid-cols-7 lg:w-auto lg:inline-grid">
|
||||
{tabs.map((tab) => (
|
||||
<Tooltip key={tab.value}>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -154,6 +166,9 @@ export function TaskTabs({ task }: TaskTabsProps) {
|
||||
<TabsContent value="dependencies">
|
||||
<TabDependencies task={task} />
|
||||
</TabsContent>
|
||||
<TabsContent value="findings">
|
||||
<TabFindings task={task} />
|
||||
</TabsContent>
|
||||
</div>
|
||||
</Tabs>
|
||||
);
|
||||
|
||||
@@ -28,6 +28,7 @@ export const taskKeys = {
|
||||
subtasks: (parentId: string) =>
|
||||
[...taskKeys.all, "subtasks", parentId] as const,
|
||||
boardReview: (id: string) => [...taskKeys.all, "board-review", id] as const,
|
||||
findings: (id: string) => [...taskKeys.all, "findings", id] as const,
|
||||
stats: () => [...taskKeys.all, "stats"] as const,
|
||||
statsByTeam: () => [...taskKeys.all, "stats-by-team"] as const,
|
||||
};
|
||||
@@ -68,6 +69,18 @@ export function useBoardReview(taskId: string, enabled = true) {
|
||||
});
|
||||
}
|
||||
|
||||
// The revision-findings ledger for the panel's Findings tab. Cheap enough to
|
||||
// fetch eagerly alongside the task (mirrors useBoardReview's shape) so the
|
||||
// tab's badge count is available without an extra click.
|
||||
export function useTaskFindings(taskId: string) {
|
||||
return useQuery({
|
||||
queryKey: taskKeys.findings(taskId),
|
||||
queryFn: () => tasksApi.getFindings(taskId),
|
||||
enabled: !!taskId,
|
||||
staleTime: 30000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useSubtasks(parentTaskId: string) {
|
||||
return useQuery({
|
||||
queryKey: taskKeys.subtasks(parentTaskId),
|
||||
|
||||
@@ -34,6 +34,47 @@ export interface BoardReviewEntry {
|
||||
timestamp: string | null;
|
||||
}
|
||||
|
||||
// One row of the revision-findings ledger. Matches the backend
|
||||
// TaskFindingResponse schema (roboco/api/schemas/tasks.py).
|
||||
export interface TaskFinding {
|
||||
id: string;
|
||||
task_id: string;
|
||||
origin: "qa" | "pr_gate" | "pm" | "ceo";
|
||||
round: number;
|
||||
author_slug: string | null;
|
||||
file: string | null;
|
||||
line: number | null;
|
||||
severity: "blocker" | "major" | "minor" | "nit";
|
||||
criterion: string | null;
|
||||
expected: string;
|
||||
actual: string;
|
||||
fix: string | null;
|
||||
evidence: string | null;
|
||||
status: "open" | "addressed" | "verified" | "waived";
|
||||
addressed_by_commit: string | null;
|
||||
resolution_note: string | null;
|
||||
created_at: string;
|
||||
updated_at: string | null;
|
||||
}
|
||||
|
||||
// Per-origin status counts — matches TaskFindingsSummaryRow.
|
||||
export interface TaskFindingsSummaryRow {
|
||||
origin: string;
|
||||
open: number;
|
||||
addressed: number;
|
||||
verified: number;
|
||||
waived: number;
|
||||
}
|
||||
|
||||
export interface TaskFindingsResponse {
|
||||
findings: TaskFinding[];
|
||||
summary: TaskFindingsSummaryRow[];
|
||||
// Whole-ledger aggregates: the findings list is capped server-side, and
|
||||
// truncated flags when it holds fewer rows than total.
|
||||
total: number;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
// Wire shape of GET /tasks/summary (backend TaskSummaryResponse) — exactly
|
||||
// the fields list views render; everything fat stays on GET /tasks/{id}.
|
||||
interface TaskSummaryWire {
|
||||
@@ -160,6 +201,18 @@ export const tasksApi = {
|
||||
return data;
|
||||
},
|
||||
|
||||
// The revision-findings ledger (qa_fail/pr_fail/request_changes/ceo_reject),
|
||||
// newest round first, plus per-origin status counts. Empty for a task
|
||||
// never bounced.
|
||||
getFindings: async (taskId: string): Promise<TaskFindingsResponse> => {
|
||||
if (isMockMode())
|
||||
return { findings: [], summary: [], total: 0, truncated: false };
|
||||
const { data } = await api.get<TaskFindingsResponse>(
|
||||
"/tasks/" + taskId + "/findings",
|
||||
);
|
||||
return data;
|
||||
},
|
||||
|
||||
// Create task
|
||||
create: async (task: TaskCreate): Promise<Task> => {
|
||||
if (isMockMode()) {
|
||||
|
||||
@@ -276,6 +276,9 @@ export interface Task {
|
||||
// Review Status
|
||||
self_verified: boolean;
|
||||
qa_verified: boolean | null;
|
||||
// Bounces into needs_revision (task-header "bounced xN" chip). Optional:
|
||||
// summaries and mocks omit it.
|
||||
revision_count?: number;
|
||||
// Git/Development Context
|
||||
branch_name: string | null;
|
||||
pr_number: number | null;
|
||||
@@ -1345,6 +1348,8 @@ export interface AgentReworkRate {
|
||||
rate: number;
|
||||
qa_fails: number;
|
||||
pr_fails: number;
|
||||
pm_rejects: number;
|
||||
ceo_rejects: number;
|
||||
}
|
||||
|
||||
export interface TeamReworkRate {
|
||||
@@ -1391,8 +1396,12 @@ export interface TaskMetrics {
|
||||
revision_count: number;
|
||||
qa_fails: number;
|
||||
pr_fails: number;
|
||||
pm_rejects: number;
|
||||
ceo_rejects: number;
|
||||
stints: number;
|
||||
stages: StageEffort[];
|
||||
findings_open: number;
|
||||
findings_total: number;
|
||||
}
|
||||
|
||||
export interface MemberScorecard {
|
||||
|
||||
Reference in New Issue
Block a user