magellan 3.3.4

Deterministic codebase mapping tool for local development
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
//! Orphan detection tests for delete operations.
//!
//! These tests verify that delete_file_facts() leaves the graph in a clean state
//! with no orphaned references or calls after file deletion.
//!
//! The validation module (src/graph/validation.rs) provides:
//! - validate_graph() - runs check_orphan_references() and check_orphan_calls()
//! - check_orphan_references() - finds Reference nodes without REFERENCES edges
//! - check_orphan_calls() - finds Call nodes without CALLER or CALLS edges
//!
//! Test scenarios:
//! 1. Delete file that has only local symbols (no cross-file refs/calls)
//! 2. Delete file that is referenced by other files (cross-file references)
//! 3. Delete file that calls symbols from other files (cross-file calls)
//! 4. Delete multiple files in sequence
//! 5. Delete file, then re-index same file (idempotency check)

use magellan::CodeGraph;
use tempfile::TempDir;

// ============================================================================
// Test 1: Single file deletion (baseline)
// ============================================================================

#[test]
fn test_delete_single_file_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create a graph with one file containing symbols
    let path = "test_single.rs";
    let source = br#"
fn main() {
    println!("hello");
}
"#;

    // Index the file
    graph.index_file(path, source).unwrap();
    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Verify graph is valid before delete
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete the file
    graph.delete_file(path).unwrap();

    // Run validate_graph() - should pass (no orphans)
    let report_after = graph.validate_graph();
    assert!(
        report_after.passed,
        "Graph should have no orphans after delete: {:?}",
        report_after.errors
    );
    assert!(
        report_after.errors.is_empty(),
        "Should have no orphan errors after delete"
    );
}

// ============================================================================
// Test 2: Cross-file references (referenced file deleted)
// ============================================================================

#[test]
fn test_delete_referenced_file_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // File A: defines function foo()
    let path_a = "lib_a.rs";
    let source_a = br#"
pub fn foo() -> i32 {
    42
}

pub fn bar() -> i32 {
    43
}
"#;

    // File B: references foo() from File A
    let path_b = "lib_b.rs";
    let source_b = br#"
fn call_foo() -> i32 {
    crate::lib_a::foo()
}
"#;

    // Index both files
    graph.index_file(path_a, source_a).unwrap();
    graph.index_references(path_a, source_a).unwrap();
    graph.index_calls(path_a, source_a).unwrap();

    graph.index_file(path_b, source_b).unwrap();
    graph.index_references(path_b, source_b).unwrap();
    graph.index_calls(path_b, source_b).unwrap();

    // Verify graph is valid before delete
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete File A (the definition)
    // Note: References in File B that pointed to File A's symbols will become orphans
    // because their target symbols no longer exist. This is expected behavior - references
    // can point to external/non-existent symbols. The validation detects this but it's
    // not a bug in the delete operation.
    graph.delete_file(path_a).unwrap();

    // Run validate_graph() to check the state
    // We expect ORPHAN_REFERENCE errors for File B's references to the deleted symbols
    let report_after = graph.validate_graph();

    // The key invariant: File A is completely deleted (no orphaned data FROM File A)
    // Any orphan errors are references IN File B pointing to deleted symbols IN File A
    // This is expected and correct - the delete operation cleaned up all File A's data
    let _orphan_refs_from_b: Vec<_> = report_after
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_REFERENCE" && e.details["file"] == "lib_b.rs")
        .collect();

    // These orphan references are expected - they're in File B, not File A
    // The delete operation correctly removed all of File A's data

    // Verify File B still exists with its symbols
    let symbols_b = graph.symbols_in_file(path_b).unwrap();
    assert!(!symbols_b.is_empty(), "File B should still have symbols");

    // Verify File A is gone
    let file_a = graph.get_file_node(path_a).unwrap();
    assert!(file_a.is_none(), "File A should be deleted");
}

// ============================================================================
// Test 3: Cross-file calls (caller deleted)
// ============================================================================

#[test]
fn test_delete_calling_file_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // File A: defines foo() and bar(), foo() calls bar()
    let path_a = "caller.rs";
    let source_a = br#"
fn foo() -> i32 {
    bar()
}

fn bar() -> i32 {
    42
}
"#;

    // File B: defines an independent function
    let path_b = "independent.rs";
    let source_b = br#"
pub fn other_function() -> i32 {
    100
}
"#;

    // Index both files
    graph.index_file(path_a, source_a).unwrap();
    graph.index_references(path_a, source_a).unwrap();
    graph.index_calls(path_a, source_a).unwrap();

    graph.index_file(path_b, source_b).unwrap();
    graph.index_references(path_b, source_b).unwrap();
    graph.index_calls(path_b, source_b).unwrap();

    // Verify graph is valid before delete
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete File A (which has internal calls)
    graph.delete_file(path_a).unwrap();

    // Run validate_graph() - should pass with no orphan calls
    let report_after = graph.validate_graph();
    assert!(
        report_after.passed,
        "Graph should have no orphan calls after deleting caller file: {:?}",
        report_after.errors
    );

    // Verify File B is unaffected
    let symbols_b = graph.symbols_in_file(path_b).unwrap();
    assert!(!symbols_b.is_empty(), "File B should still have symbols");
}

// ============================================================================
// Test 4: Multiple file deletion
// ============================================================================

#[test]
fn test_delete_multiple_files_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create 3 files with cross-references
    let paths = vec!["file1.rs", "file2.rs", "file3.rs"];

    for (i, path) in paths.iter().enumerate() {
        let source = format!(
            r#"
// File {}
pub fn function_{i}() -> i32 {{
    {i}
}}
"#,
            i + 1
        );
        let source_bytes = source.as_bytes();
        graph.index_file(path, source_bytes).unwrap();
        graph.index_references(path, source_bytes).unwrap();
        graph.index_calls(path, source_bytes).unwrap();
    }

    // Verify graph is valid before delete
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete all 3 files
    for path in &paths {
        graph.delete_file(path).unwrap();

        // Verify no orphans after each deletion
        let report = graph.validate_graph();
        assert!(
            report.passed,
            "Graph should have no orphans after deleting {}: {:?}",
            path, report.errors
        );
    }

    // Final verification
    let report_final = graph.validate_graph();
    assert!(
        report_final.passed,
        "Graph should have no orphans after deleting all files: {:?}",
        report_final.errors
    );

    // Verify all files are gone
    for path in &paths {
        let file_node = graph.get_file_node(path).unwrap();
        assert!(file_node.is_none(), "{} should be deleted", path);
    }
}

// ============================================================================
// Test 5: Delete and re-index (idempotency)
// ============================================================================

#[test]
fn test_delete_reindex_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    let path = "reindex_test.rs";
    let source = br#"
fn test_function() -> i32 {
    42
}

struct TestStruct {
    value: i32,
}

impl TestStruct {
    fn new(value: i32) -> Self {
        Self { value }
    }
}
"#;

    // Index the file
    let symbols_first = graph.index_file(path, source).unwrap();
    assert!(symbols_first > 0, "Should have indexed symbols");

    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Verify graph is valid
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete the file
    graph.delete_file(path).unwrap();

    // Verify file is gone
    let file_node = graph.get_file_node(path).unwrap();
    assert!(file_node.is_none(), "File should be deleted");

    // Verify no orphans after delete
    let report_after_delete = graph.validate_graph();
    assert!(
        report_after_delete.passed,
        "Graph should have no orphans after delete: {:?}",
        report_after_delete.errors
    );

    // Re-index the same file (same content)
    let symbols_second = graph.index_file(path, source).unwrap();
    assert_eq!(
        symbols_second, symbols_first,
        "Should index same number of symbols"
    );

    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Verify graph is clean after re-index
    let report_after_reindex = graph.validate_graph();
    assert!(
        report_after_reindex.passed,
        "Graph should have no orphans after re-index: {:?}",
        report_after_reindex.errors
    );
}

// ============================================================================
// Test 5b: Re-index without delete should not create duplicate file nodes
// ============================================================================

#[test]
fn test_reindex_no_duplicate_file_nodes() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    let path = "dup_test.rs";
    let source = br#"
fn first() -> i32 { 1 }
fn second() -> i32 { 2 }
"#;

    // First index
    let count1 = graph.index_file(path, source).unwrap();
    assert_eq!(count1, 2, "Should index 2 functions");

    // Second index (same file, simulating watcher re-index)
    let count2 = graph.index_file(path, source).unwrap();
    assert_eq!(count2, 2, "Should still index 2 functions");

    // Third index (same file again)
    let count3 = graph.index_file(path, source).unwrap();
    assert_eq!(
        count3, 2,
        "Should still index 2 functions after third index"
    );

    // Verify only ONE File node exists for this path
    let all_files = graph.all_file_nodes_readonly().unwrap();
    let matching: Vec<_> = all_files
        .keys()
        .filter(|p| p.contains("dup_test.rs"))
        .collect();
    assert_eq!(
        matching.len(),
        1,
        "Should have exactly 1 File node for dup_test.rs, found: {:?}",
        matching
    );

    // Verify only 2 Symbol nodes exist (not 6)
    let symbols = graph.symbols_in_file(path).unwrap();
    assert_eq!(
        symbols.len(),
        2,
        "Should have exactly 2 symbols, found {}",
        symbols.len()
    );
}

// ============================================================================
// Test 6: Complex graph with multiple symbol types
// ============================================================================

#[test]
fn test_delete_complex_file_no_orphans() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // File with: functions, structs, impls, methods
    let path = "complex.rs";
    let source = br#"
// Module-level function
fn module_function() -> i32 {
    42
}

// Struct definition
struct ComplexStruct {
    field1: i32,
    field2: String,
}

// impl block with methods
impl ComplexStruct {
    fn new(field1: i32, field2: String) -> Self {
        Self { field1, field2 }
    }

    fn get_field1(&self) -> i32 {
        self.field1
    }

    fn set_field1(&mut self, value: i32) {
        self.field1 = value;
    }
}

// Trait definition
trait MyTrait {
    fn trait_method(&self) -> i32;
}

// Trait implementation
impl MyTrait for ComplexStruct {
    fn trait_method(&self) -> i32 {
        self.field1
    }
}

// Enum
enum MyEnum {
    VariantA(i32),
    VariantB(String),
}

impl MyEnum {
    fn value(&self) -> i32 {
        match self {
            MyEnum::VariantA(v) => *v,
            MyEnum::VariantB(_) => 0,
        }
    }
}

// Function that uses the complex types
fn use_complex_types() -> i32 {
    let mut s = ComplexStruct::new(10, String::from("test"));
    s.set_field1(20);
    s.get_field1()
}
"#;

    // Index the file
    let symbol_count = graph.index_file(path, source).unwrap();
    assert!(
        symbol_count >= 10,
        "Should have indexed many symbols (got {})",
        symbol_count
    );

    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Verify graph is valid before delete
    let report_before = graph.validate_graph();
    assert!(
        report_before.passed,
        "Graph should be valid before delete: {:?}",
        report_before.errors
    );

    // Delete the file
    let delete_result = graph.delete_file(path).unwrap();
    assert!(
        delete_result.symbols_deleted > 0,
        "Should have deleted symbols"
    );

    // Verify all entity types and edges cleaned up
    let report_after = graph.validate_graph();
    assert!(
        report_after.passed,
        "Graph should have no orphans after deleting complex file: {:?}",
        report_after.errors
    );

    // Verify no orphan references
    let orphan_refs: Vec<_> = report_after
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_REFERENCE")
        .collect();
    assert!(
        orphan_refs.is_empty(),
        "Should have no ORPHAN_REFERENCE errors: {:?}",
        orphan_refs
    );

    // Verify no orphan calls
    let orphan_calls: Vec<_> = report_after
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_CALL_NO_CALLER" || e.code == "ORPHAN_CALL_NO_CALLEE")
        .collect();
    assert!(
        orphan_calls.is_empty(),
        "Should have no ORPHAN_CALL errors: {:?}",
        orphan_calls
    );
}

// ============================================================================
// Test 7: Code chunks deletion
// ============================================================================

#[test]
fn test_delete_file_code_chunks_removed() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Index file with multiple symbols (generates chunks)
    let path = "chunks_test.rs";
    let source = br#"
fn function_one() -> i32 {
    10
}

fn function_two() -> i32 {
    20
}

fn function_three() -> i32 {
    30
}
"#;

    graph.index_file(path, source).unwrap();

    // Verify code chunks exist
    let chunks_before = graph.get_code_chunks(path).unwrap();
    let chunk_count = chunks_before.len();
    assert!(
        chunk_count > 0,
        "Should have code chunks (got {})",
        chunk_count
    );

    // Delete file
    graph.delete_file(path).unwrap();

    // Verify chunks are gone via API
    let chunks_after = graph.get_code_chunks(path).unwrap();
    assert_eq!(chunks_after.len(), 0, "No chunks should remain");
}

// ============================================================================
// Test 8: Edge cleanup verification
// ============================================================================

#[test]
fn test_delete_file_edges_removed() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create file with symbols and DEFINES edges
    let path = "edges_test.rs";
    let source = br#"
fn test_func() -> i32 {
    42
}
"#;

    graph.index_file(path, source).unwrap();

    // Get the symbol nodes that were created
    let symbol_nodes = graph.symbol_nodes_in_file(path).unwrap();
    assert!(!symbol_nodes.is_empty(), "Should have symbols");

    // Delete file
    graph.delete_file(path).unwrap();

    // Verify file is gone
    let file_node = graph.get_file_node(path).unwrap();
    assert!(file_node.is_none(), "File should be deleted");

    // Verify symbols are gone (and thus edges were cleaned up)
    let symbols_after = graph.symbols_in_file(path).unwrap();
    assert_eq!(symbols_after.len(), 0, "All symbols should be deleted");
}

// ============================================================================
// Test 9: No ORPHAN_REFERENCE errors after delete
// ============================================================================

#[test]
fn test_no_orphan_reference_after_delete() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create a file with references
    let path = "ref_test.rs";
    let source = br#"
fn foo() -> i32 {
    42
}

fn bar() -> i32 {
    foo() + 1
}
"#;

    graph.index_file(path, source).unwrap();
    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Delete the file
    graph.delete_file(path).unwrap();

    // Run validation
    let report = graph.validate_graph();

    // Check for ORPHAN_REFERENCE errors specifically
    let orphan_refs: Vec<_> = report
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_REFERENCE")
        .collect();

    assert!(
        orphan_refs.is_empty(),
        "Should have no ORPHAN_REFERENCE errors after delete. Found: {:?}",
        orphan_refs
    );
}

// ============================================================================
// Test 10: No ORPHAN_CALL errors after delete
// ============================================================================

#[test]
fn test_no_orphan_call_after_delete() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create a file with calls
    let path = "call_test.rs";
    let source = br#"
fn caller() -> i32 {
    callee()
}

fn callee() -> i32 {
    42
}
"#;

    graph.index_file(path, source).unwrap();
    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Delete the file
    graph.delete_file(path).unwrap();

    // Run validation
    let report = graph.validate_graph();

    // Check for ORPHAN_CALL errors specifically
    let orphan_caller: Vec<_> = report
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_CALL_NO_CALLER")
        .collect();

    let orphan_callee: Vec<_> = report
        .errors
        .iter()
        .filter(|e| e.code == "ORPHAN_CALL_NO_CALLEE")
        .collect();

    assert!(
        orphan_caller.is_empty(),
        "Should have no ORPHAN_CALL_NO_CALLER errors after delete. Found: {:?}",
        orphan_caller
    );

    assert!(
        orphan_callee.is_empty(),
        "Should have no ORPHAN_CALL_NO_CALLEE errors after delete. Found: {:?}",
        orphan_callee
    );
}

// ============================================================================
// Test 11: Empty graph validation after delete all
// ============================================================================

#[test]
fn test_empty_graph_valid_after_delete_all() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    // Create and delete multiple files
    let files = vec!["file1.rs", "file2.rs", "file3.rs"];

    for path in &files {
        let source = br#"fn test() -> i32 { 42 }"#;
        graph.index_file(path, source).unwrap();
        graph.index_references(path, source).unwrap();
        graph.index_calls(path, source).unwrap();
    }

    // Delete all files
    for path in &files {
        graph.delete_file(path).unwrap();
    }

    // Verify empty graph is valid
    let report = graph.validate_graph();
    assert!(
        report.passed,
        "Empty graph should be valid after deleting all files: {:?}",
        report.errors
    );
    assert!(report.errors.is_empty(), "Should have no errors");
}

// ============================================================================
// Test 12: Validate specific error codes are not present
// ============================================================================

#[test]
fn test_validate_graph_after_delete_returns_clean_report() {
    let temp_dir = TempDir::new().unwrap();
    let db_path = temp_dir.path().join("test.db");
    let mut graph = CodeGraph::open(&db_path).unwrap();

    let path = "clean_test.rs";
    let source = br#"
fn main() {
    let x = 42;
    println!("{}", x);
}
"#;

    graph.index_file(path, source).unwrap();
    graph.index_references(path, source).unwrap();
    graph.index_calls(path, source).unwrap();

    // Delete
    graph.delete_file(path).unwrap();

    // Get validation report
    let report = graph.validate_graph();

    // Assert passed is true
    assert!(report.passed, "Report should indicate passed");

    // Assert is_clean is true
    assert!(
        report.is_clean(),
        "Report should indicate clean (no errors or warnings)"
    );

    // Assert total_issues is 0
    assert_eq!(report.total_issues(), 0, "Total issues should be 0");

    // Assert errors is empty
    assert!(report.errors.is_empty(), "Errors list should be empty");
}