@@ -48,6 +48,7 @@ describe("CheckpointDiffQueryLive", () => {
4848 readonly fromCheckpointRef : CheckpointRef ;
4949 readonly toCheckpointRef : CheckpointRef ;
5050 readonly cwd : string ;
51+ readonly ignoreWhitespace : boolean ;
5152 } > = [ ] ;
5253
5354 const threadCheckpointContext = makeThreadCheckpointContext ( {
@@ -68,9 +69,14 @@ describe("CheckpointDiffQueryLive", () => {
6869 return true ;
6970 } ) ,
7071 restoreCheckpoint : ( ) => Effect . succeed ( true ) ,
71- diffCheckpoints : ( { fromCheckpointRef, toCheckpointRef, cwd } ) =>
72+ diffCheckpoints : ( { fromCheckpointRef, toCheckpointRef, cwd, ignoreWhitespace } ) =>
7273 Effect . sync ( ( ) => {
73- diffCheckpointsCalls . push ( { fromCheckpointRef, toCheckpointRef, cwd } ) ;
74+ diffCheckpointsCalls . push ( {
75+ fromCheckpointRef,
76+ toCheckpointRef,
77+ cwd,
78+ ignoreWhitespace,
79+ } ) ;
7480 return "diff patch" ;
7581 } ) ,
7682 deleteCheckpointRefs : ( ) => Effect . void ,
@@ -102,6 +108,7 @@ describe("CheckpointDiffQueryLive", () => {
102108 threadId,
103109 fromTurnCount : 0 ,
104110 toTurnCount : 1 ,
111+ ignoreWhitespace : true ,
105112 } ) ;
106113 } ) . pipe ( Effect . provide ( layer ) ) ,
107114 ) ;
@@ -113,6 +120,7 @@ describe("CheckpointDiffQueryLive", () => {
113120 cwd : "/tmp/workspace" ,
114121 fromCheckpointRef : expectedFromRef ,
115122 toCheckpointRef,
123+ ignoreWhitespace : true ,
116124 } ,
117125 ] ) ;
118126 expect ( result ) . toEqual ( {
@@ -123,6 +131,67 @@ describe("CheckpointDiffQueryLive", () => {
123131 } ) ;
124132 } ) ;
125133
134+ it ( "defaults to hide whitespace changes" , async ( ) => {
135+ const projectId = ProjectId . make ( "project-default-whitespace" ) ;
136+ const threadId = ThreadId . make ( "thread-default-whitespace" ) ;
137+ const toCheckpointRef = checkpointRefForThreadTurn ( threadId , 1 ) ;
138+ const diffCheckpointsCalls : Array < { readonly ignoreWhitespace : boolean } > = [ ] ;
139+
140+ const threadCheckpointContext = makeThreadCheckpointContext ( {
141+ projectId,
142+ threadId,
143+ workspaceRoot : "/tmp/workspace" ,
144+ worktreePath : null ,
145+ checkpointTurnCount : 1 ,
146+ checkpointRef : toCheckpointRef ,
147+ } ) ;
148+
149+ const checkpointStore : CheckpointStoreShape = {
150+ isGitRepository : ( ) => Effect . succeed ( true ) ,
151+ captureCheckpoint : ( ) => Effect . void ,
152+ hasCheckpointRef : ( ) => Effect . succeed ( true ) ,
153+ restoreCheckpoint : ( ) => Effect . succeed ( true ) ,
154+ diffCheckpoints : ( { ignoreWhitespace } ) =>
155+ Effect . sync ( ( ) => {
156+ diffCheckpointsCalls . push ( { ignoreWhitespace } ) ;
157+ return "diff patch" ;
158+ } ) ,
159+ deleteCheckpointRefs : ( ) => Effect . void ,
160+ } ;
161+
162+ const layer = CheckpointDiffQueryLive . pipe (
163+ Layer . provideMerge ( Layer . succeed ( CheckpointStore , checkpointStore ) ) ,
164+ Layer . provideMerge (
165+ Layer . succeed ( ProjectionSnapshotQuery , {
166+ getSnapshot : ( ) =>
167+ Effect . die ( "CheckpointDiffQuery should not request the full orchestration snapshot" ) ,
168+ getShellSnapshot : ( ) =>
169+ Effect . die ( "CheckpointDiffQuery should not request the orchestration shell snapshot" ) ,
170+ getCounts : ( ) => Effect . succeed ( { projectCount : 0 , threadCount : 0 } ) ,
171+ getActiveProjectByWorkspaceRoot : ( ) => Effect . succeed ( Option . none ( ) ) ,
172+ getProjectShellById : ( ) => Effect . succeed ( Option . none ( ) ) ,
173+ getFirstActiveThreadIdByProjectId : ( ) => Effect . succeed ( Option . none ( ) ) ,
174+ getThreadCheckpointContext : ( ) => Effect . succeed ( Option . some ( threadCheckpointContext ) ) ,
175+ getThreadShellById : ( ) => Effect . succeed ( Option . none ( ) ) ,
176+ getThreadDetailById : ( ) => Effect . succeed ( Option . none ( ) ) ,
177+ } ) ,
178+ ) ,
179+ ) ;
180+
181+ await Effect . runPromise (
182+ Effect . gen ( function * ( ) {
183+ const query = yield * CheckpointDiffQuery ;
184+ return yield * query . getTurnDiff ( {
185+ threadId,
186+ fromTurnCount : 0 ,
187+ toTurnCount : 1 ,
188+ } ) ;
189+ } ) . pipe ( Effect . provide ( layer ) ) ,
190+ ) ;
191+
192+ expect ( diffCheckpointsCalls ) . toEqual ( [ { ignoreWhitespace : true } ] ) ;
193+ } ) ;
194+
126195 it ( "fails when the thread is missing from the snapshot" , async ( ) => {
127196 const threadId = ThreadId . make ( "thread-missing" ) ;
128197
0 commit comments