@@ -16,8 +16,13 @@ use git_ai::{
1616fn run_ai_tab_checkpoint ( repo : & TestRepo , hook_payload : serde_json:: Value ) {
1717 let hook_input = hook_payload. to_string ( ) ;
1818 let args: Vec < & str > = vec ! [ "checkpoint" , "ai_tab" , "--hook-input" , hook_input. as_str( ) ] ;
19- if let Err ( err) = repo. git_ai ( & args) {
20- panic ! ( "ai_tab checkpoint failed: {}" , err) ;
19+ match repo. git_ai ( & args) {
20+ Ok ( output) => {
21+ println ! ( "git_ai checkpoint output: {}" , output) ;
22+ }
23+ Err ( err) => {
24+ panic ! ( "ai_tab checkpoint failed: {}" , err) ;
25+ }
2126 }
2227}
2328
@@ -130,7 +135,10 @@ fn test_ai_tab_after_edit_checkpoint_includes_dirty_files_and_paths() {
130135 let edited = result
131136 . edited_filepaths
132137 . expect ( "after_edit should include edited filepaths" ) ;
133- assert_eq ! ( edited, vec![ "/Users/test/project/src/main.rs" . to_string( ) ] ) ;
138+ assert_eq ! (
139+ edited,
140+ vec![ "/Users/test/project/src/main.rs" . to_string( ) ]
141+ ) ;
134142
135143 let dirty_files = result
136144 . dirty_files
@@ -165,10 +173,7 @@ fn test_ai_tab_rejects_invalid_hook_event() {
165173 message
166174 ) ;
167175 }
168- other => panic ! (
169- "expected PresetError for invalid hook_event_name, got {:?}" ,
170- other
171- ) ,
176+ other => panic ! ( "expected PresetError for invalid hook_event_name, got {:?}" , other) ,
172177 }
173178}
174179
@@ -223,7 +228,7 @@ fn test_ai_tab_requires_non_empty_tool_and_model() {
223228fn test_ai_tab_e2e_marks_ai_lines ( ) {
224229 let repo = TestRepo :: new ( ) ;
225230 let relative_path = "notes_test.ts" ;
226- let file_path = repo. path ( ) . join ( relative_path) ;
231+ let file_path = repo. canonical_path ( ) . join ( relative_path) ;
227232
228233 let base_content = "console.log(\" hello world\" );\n " . to_string ( ) ;
229234 fs:: write ( & file_path, & base_content) . unwrap ( ) ;
@@ -238,7 +243,7 @@ fn test_ai_tab_e2e_marks_ai_lines() {
238243 "hook_event_name" : "before_edit" ,
239244 "tool" : "github-copilot-tab" ,
240245 "model" : "default" ,
241- "repo_working_dir" : repo. path ( ) . to_string_lossy( ) ,
246+ "repo_working_dir" : repo. canonical_path ( ) . to_string_lossy( ) ,
242247 "will_edit_filepaths" : [ file_path_str. clone( ) ] ,
243248 "dirty_files" : {
244249 file_path_str. clone( ) : base_content. clone( )
@@ -247,9 +252,7 @@ fn test_ai_tab_e2e_marks_ai_lines() {
247252 ) ;
248253
249254 // AI tab inserts new lines alongside the existing content
250- let ai_content =
251- "console.log(\" hello world\" );\n // Log hello world\n console.log(\" hello from ai\" );\n "
252- . to_string ( ) ;
255+ let ai_content = "console.log(\" hello world\" );\n // Log hello world\n console.log(\" hello from ai\" );\n " . to_string ( ) ;
253256 fs:: write ( & file_path, & ai_content) . unwrap ( ) ;
254257
255258 run_ai_tab_checkpoint (
@@ -258,16 +261,15 @@ fn test_ai_tab_e2e_marks_ai_lines() {
258261 "hook_event_name" : "after_edit" ,
259262 "tool" : "github-copilot-tab" ,
260263 "model" : "default" ,
261- "repo_working_dir" : repo. path ( ) . to_string_lossy( ) ,
264+ "repo_working_dir" : repo. canonical_path ( ) . to_string_lossy( ) ,
262265 "edited_filepaths" : [ file_path_str. clone( ) ] ,
263266 "dirty_files" : {
264267 file_path_str. clone( ) : ai_content. clone( )
265268 }
266269 } ) ,
267270 ) ;
268271
269- repo. stage_all_and_commit ( "Accept AI tab completion" )
270- . unwrap ( ) ;
272+ repo. stage_all_and_commit ( "Accept AI tab completion" ) . unwrap ( ) ;
271273
272274 let mut file = repo. filename ( relative_path) ;
273275 file. assert_lines_and_blame ( lines ! [
@@ -302,14 +304,17 @@ fn test_ai_tab_e2e_handles_dirty_files_map() {
302304 let lib_file_path_str = lib_file_path. to_string_lossy ( ) . to_string ( ) ;
303305 let readme_file_path_str = readme_file_path. to_string_lossy ( ) . to_string ( ) ;
304306
307+ println ! ( "lib_file_path_str: {}" , lib_file_path_str) ;
308+ println ! ( "readme_file_path_str: {}" , readme_file_path_str) ;
309+
305310 // Before edit snapshot includes all dirty files (AI target plus unrelated human edits)
306311 run_ai_tab_checkpoint (
307312 & repo,
308313 json ! ( {
309314 "hook_event_name" : "before_edit" ,
310315 "tool" : "github-copilot-tab" ,
311316 "model" : "default" ,
312- "repo_working_dir" : repo. path ( ) . to_string_lossy( ) ,
317+ "repo_working_dir" : repo. canonical_path ( ) . to_string_lossy( ) ,
313318 "will_edit_filepaths" : [ lib_file_path_str. clone( ) ] ,
314319 "dirty_files" : {
315320 lib_file_path_str. clone( ) : base_lib_content. clone( ) ,
@@ -330,7 +335,7 @@ fn test_ai_tab_e2e_handles_dirty_files_map() {
330335 "hook_event_name" : "after_edit" ,
331336 "tool" : "github-copilot-tab" ,
332337 "model" : "default" ,
333- "repo_working_dir" : repo. path ( ) . to_string_lossy( ) ,
338+ "repo_working_dir" : repo. canonical_path ( ) . to_string_lossy( ) ,
334339 "edited_filepaths" : [ lib_file_path_str. clone( ) ] ,
335340 "dirty_files" : {
336341 lib_file_path_str. clone( ) : ai_content. clone( ) ,
@@ -339,8 +344,19 @@ fn test_ai_tab_e2e_handles_dirty_files_map() {
339344 } ) ,
340345 ) ;
341346
342- repo. stage_all_and_commit ( "Record AI tab completion while other files dirty" )
343- . unwrap ( ) ;
347+ // Debug: Check working logs before commit
348+ let working_logs = repo. current_working_logs ( ) ;
349+ if let Ok ( checkpoints) = working_logs. read_all_checkpoints ( ) {
350+ println ! ( "Checkpoints before commit: {}" , checkpoints. len( ) ) ;
351+ for ( i, cp) in checkpoints. iter ( ) . enumerate ( ) {
352+ println ! ( "Checkpoint {}: kind={:?}, entries={}" , i, cp. kind, cp. entries. len( ) ) ;
353+ for entry in & cp. entries {
354+ println ! ( " File: {}, attributions={}" , entry. file, entry. attributions. len( ) ) ;
355+ }
356+ }
357+ }
358+
359+ repo. stage_all_and_commit ( "Record AI tab completion while other files dirty" ) . unwrap ( ) ;
344360
345361 let mut file = repo. filename ( & std:: path:: Path :: new ( "src" ) . join ( "lib.rs" ) . to_string_lossy ( ) ) ;
346362 file. assert_lines_and_blame ( lines ! [
@@ -351,4 +367,4 @@ fn test_ai_tab_e2e_handles_dirty_files_map() {
351367 " println!(\" from ai\" );" . ai( ) ,
352368 "}" . ai( ) ,
353369 ] ) ;
354- }
370+ }
0 commit comments