From 5968a6ba88fd5ad42bebfccbe59b79fca514f45f Mon Sep 17 00:00:00 2001 From: Lukas May Date: Fri, 6 Mar 2026 19:52:18 +0100 Subject: [PATCH] feat: split FileDiff into metadata FileDiff + hunk-bearing FileDiffDetail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prepares the review components for the backend phase that returns metadata-only file lists from getPhaseReviewDiff. FileDiff now holds only path/status/additions/deletions; FileDiffDetail extends it with hunks. Renames changeType→status and adds 'binary' to the union. Also fixes two pre-existing TypeScript errors: InitiativeReview was passing an unknown `comments` prop to DiffViewer (should be commentsByLine), and ConflictResolutionPanel destructured an unused `agent` variable. Co-Authored-By: Claude Sonnet 4.6 --- .../review/ConflictResolutionPanel.tsx | 2 +- apps/web/src/components/review/DiffViewer.tsx | 4 +-- apps/web/src/components/review/FileCard.tsx | 14 +++++---- .../components/review/InitiativeReview.tsx | 2 +- .../src/components/review/ReviewSidebar.tsx | 6 ++-- apps/web/src/components/review/parse-diff.ts | 22 +++++++------- apps/web/src/components/review/types.test.ts | 29 +++++++++++++++++++ apps/web/src/components/review/types.ts | 13 ++++++--- 8 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 apps/web/src/components/review/types.test.ts diff --git a/apps/web/src/components/review/ConflictResolutionPanel.tsx b/apps/web/src/components/review/ConflictResolutionPanel.tsx index ea2ff36..95dc750 100644 --- a/apps/web/src/components/review/ConflictResolutionPanel.tsx +++ b/apps/web/src/components/review/ConflictResolutionPanel.tsx @@ -11,7 +11,7 @@ interface ConflictResolutionPanelProps { } export function ConflictResolutionPanel({ initiativeId, conflicts, onResolved }: ConflictResolutionPanelProps) { - const { state, agent, questions, spawn, resume, stop, dismiss } = useConflictAgent(initiativeId); + const { state, agent: _agent, questions, spawn, resume, stop, dismiss } = useConflictAgent(initiativeId); const [showManual, setShowManual] = useState(false); const prevStateRef = useRef(null); diff --git a/apps/web/src/components/review/DiffViewer.tsx b/apps/web/src/components/review/DiffViewer.tsx index d4cfd1e..1ffbe22 100644 --- a/apps/web/src/components/review/DiffViewer.tsx +++ b/apps/web/src/components/review/DiffViewer.tsx @@ -1,4 +1,4 @@ -import type { FileDiff, DiffLine, ReviewComment } from "./types"; +import type { FileDiffDetail, DiffLine, ReviewComment } from "./types"; import { FileCard } from "./FileCard"; function getFileCommentMap( @@ -13,7 +13,7 @@ function getFileCommentMap( } interface DiffViewerProps { - files: FileDiff[]; + files: FileDiffDetail[]; commentsByLine: Map; onAddComment: ( filePath: string, diff --git a/apps/web/src/components/review/FileCard.tsx b/apps/web/src/components/review/FileCard.tsx index 4d6ed6f..4c84769 100644 --- a/apps/web/src/components/review/FileCard.tsx +++ b/apps/web/src/components/review/FileCard.tsx @@ -8,12 +8,12 @@ import { Circle, } from "lucide-react"; import { Badge } from "@/components/ui/badge"; -import type { FileDiff, FileChangeType, DiffLine, ReviewComment } from "./types"; +import type { FileDiffDetail, DiffLine, ReviewComment } from "./types"; import { HunkRows } from "./HunkRows"; import { useHighlightedFile } from "./use-syntax-highlight"; const changeTypeBadge: Record< - FileChangeType, + FileDiffDetail['status'], { label: string; classes: string } | null > = { added: { @@ -32,17 +32,19 @@ const changeTypeBadge: Record< "bg-status-active-bg text-status-active-fg border-status-active-border", }, modified: null, + binary: null, }; -const leftBorderClass: Record = { +const leftBorderClass: Record = { added: "border-l-2 border-l-status-success-fg", deleted: "border-l-2 border-l-status-error-fg", renamed: "border-l-2 border-l-status-active-fg", modified: "border-l-2 border-l-primary/40", + binary: "border-l-2 border-l-primary/40", }; interface FileCardProps { - file: FileDiff; + file: FileDiffDetail; commentsByLine: Map; onAddComment: ( filePath: string, @@ -80,7 +82,7 @@ export function FileCard({ [commentsByLine], ); - const badge = changeTypeBadge[file.changeType]; + const badge = changeTypeBadge[file.status]; // Flatten all hunk lines for syntax highlighting const allLines = useMemo( @@ -93,7 +95,7 @@ export function FileCard({
{/* File header — sticky so it stays visible when scrolling */}