44 DEFAULT_CLIENT_SETTINGS ,
55 EnvironmentId ,
66 ProjectId ,
7+ RunId ,
78 ThreadId ,
89 type ClientSettings ,
910 type ReviewBranchCommitsResult ,
@@ -35,6 +36,8 @@ const state = vi.hoisted(() => ({
3536 localRefs : null as unknown as ResultAtom < VcsListRefsResult > ,
3637 remoteRefs : null as unknown as ResultAtom < VcsListRefsResult > ,
3738 commits : null as unknown as ResultAtom < ReviewBranchCommitsResult > ,
39+ checkpoints : [ ] as unknown [ ] ,
40+ checkpointDiff : null as { diff : string } | null ,
3841} ) ) ;
3942
4043vi . mock ( "~/state/server" , ( ) => ( {
@@ -59,7 +62,7 @@ vi.mock("~/state/vcs", () => ({
5962vi . mock ( "~/state/entities" , ( ) => ( {
6063 useQuietThreadShell : ( ) => state . thread ,
6164 useProject : ( ) => ( { workspaceRoot : "/project" , repositoryIdentity : null } ) ,
62- useThreadCheckpointSummaries : ( ) => [ ] ,
65+ useThreadCheckpointSummaries : ( ) => state . checkpoints ,
6366 useQuietThreadVisibleTurnItems : ( ) => [ ] ,
6467} ) ) ;
6568vi . mock ( "~/state/filesystem" , ( ) => ( {
@@ -77,7 +80,7 @@ vi.mock("~/hooks/useTheme", () => ({
7780 subscribeRenderedAppearance : ( ) => ( ) => { } ,
7881} ) ) ;
7982vi . mock ( "~/state/queries" , ( ) => ( {
80- useCheckpointDiff : ( ) => ( { data : null , error : null , isPending : false } ) ,
83+ useCheckpointDiff : ( ) => ( { data : state . checkpointDiff , error : null , isPending : false } ) ,
8184 useTurnItemDetail : ( ) => ( { data : null , error : null , isPending : false } ) ,
8285 useDebouncedValue : < A , > ( value : A ) => value ,
8386} ) ) ;
@@ -126,6 +129,8 @@ function setup(failedBaseRef: string | null) {
126129 } ;
127130 reset ( ) ;
128131 state . diffFilesCollapsed = false ;
132+ state . checkpoints = [ ] ;
133+ state . checkpointDiff = null ;
129134 const patch = Atom . make < AsyncResult . AsyncResult < ReviewDiffPreviewSource , Error > > (
130135 AsyncResult . initial ( ) ,
131136 ) ;
@@ -267,3 +272,33 @@ it.each([false, true])(
267272 await expect . element ( toggle ) . toHaveAttribute ( "aria-expanded" , "false" ) ;
268273 } ,
269274) ;
275+
276+ it ( "says a turn diff cut off at the server's size limit is incomplete" , async ( ) => {
277+ using context = setup ( "origin/orphan" ) ;
278+ state . checkpoints = [
279+ {
280+ runId : "run" ,
281+ checkpointTurnCount : 1 ,
282+ checkpointRef : "ref" ,
283+ status : "ready" ,
284+ files : [ ] ,
285+ assistantMessageId : null ,
286+ completedAt : "2026-01-01T00:00:00Z" ,
287+ } ,
288+ ] ;
289+ state . checkpointDiff = {
290+ diff : "diff --git a/first.txt b/first.txt\n--- a/first.txt\n+++ b/first.txt\n@@ -0,0 +1 @@\n+visible\n\n[truncated]" ,
291+ } ;
292+ useDiffPanelStore . getState ( ) . selectTurn ( context . threadRef , RunId . make ( "run" ) ) ;
293+ await using screen = await render (
294+ < RegistryContext . Provider value = { context . registry } >
295+ < div style = { { height : 600 , display : "flex" , flexDirection : "column" } } >
296+ < DiffPanel composerDraftTarget = { context . threadRef } workspaceMutationId = { null } visible />
297+ </ div >
298+ </ RegistryContext . Provider > ,
299+ ) ;
300+ await expect . element ( screen . getByText ( "first.txt" , { exact : true } ) . first ( ) ) . toBeVisible ( ) ;
301+ await expect
302+ . element ( screen . getByText ( "This preview exceeds the size limit. Changes shown are incomplete." ) )
303+ . toBeVisible ( ) ;
304+ } ) ;
0 commit comments