Skip to main content

aft/lsp/
diagnostics.rs

1use std::collections::HashMap;
2use std::path::{Path, PathBuf};
3use std::time::Instant;
4
5use crate::lsp::registry::ServerKind;
6use crate::lsp::roots::ServerKey;
7
8/// A single diagnostic from an LSP server.
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct StoredDiagnostic {
11    pub file: PathBuf,
12    pub line: u32,
13    pub column: u32,
14    pub end_line: u32,
15    pub end_column: u32,
16    pub severity: DiagnosticSeverity,
17    pub message: String,
18    pub code: Option<String>,
19    pub source: Option<String>,
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum DiagnosticSeverity {
24    Error,
25    Warning,
26    Information,
27    Hint,
28}
29
30impl DiagnosticSeverity {
31    pub fn as_str(self) -> &'static str {
32        match self {
33            Self::Error => "error",
34            Self::Warning => "warning",
35            Self::Information => "information",
36            Self::Hint => "hint",
37        }
38    }
39}
40
41/// One server's published diagnostics for one file, plus bookkeeping that
42/// distinguishes "checked clean" (`diagnostics.is_empty()` AND
43/// `epoch.is_some()`) from "never checked" (entry not present).
44#[derive(Debug, Clone)]
45pub struct DiagnosticEntry {
46    pub diagnostics: Vec<StoredDiagnostic>,
47    /// Monotonic epoch when this entry was last replaced by a publish or
48    /// pull response. Used by callers to tell "fresh" results apart from
49    /// stale cache contents.
50    pub epoch: u64,
51    /// Optional resultId from a pull response. Sent back as `previousResultId`
52    /// on the next pull request to enable `kind: "unchanged"` short-circuiting.
53    pub result_id: Option<String>,
54    /// Document version this publish/pull was tagged against, when the
55    /// server provided one. Servers that participate in versioned text
56    /// document sync echo `version` on `publishDiagnostics`; we store it
57    /// so post-edit waiters can reject stale publishes deterministically
58    /// (`version == target_version`) instead of relying on epoch ordering
59    /// alone, which has a race when an old-version publish arrives after
60    /// the pre-edit drain. `None` = server didn't tag the publish.
61    pub version: Option<i32>,
62}
63
64/// Stores diagnostics from all LSP servers, keyed per `(ServerKey, file)`.
65///
66/// Key design points (driven by the v0.16 LSP audit):
67///
68/// 1. **Per-server state.** A single file can be served by multiple LSP
69///    servers (e.g., pyright + ty, or tsserver + ESLint). The cache key is
70///    `(ServerKey, PathBuf)` so each server's view is tracked independently.
71///
72/// 2. **Empty publishes are kept.** Earlier the store deleted entries on
73///    empty publishes, making "checked clean" indistinguishable from "never
74///    checked". Now we preserve the entry with `epoch = ...` so callers can
75///    answer the question honestly.
76///
77/// 3. **LRU cap.** `capacity` (default 5000, configurable via
78///    `Config::diagnostic_cache_size`) bounds memory. Set to 0 to disable.
79///    On insert when at capacity, the least-recently-touched entry is
80///    evicted. Eviction is tracked so directory-mode callers can list
81///    those files as `unchecked` rather than silently lose them.
82pub struct DiagnosticsStore {
83    /// Primary store keyed by `(ServerKey, canonical file path)`.
84    entries: HashMap<(ServerKey, PathBuf), DiagnosticEntry>,
85    /// Insertion/access order for LRU eviction. Most-recently-touched
86    /// entries are at the END of the vector.
87    order: Vec<(ServerKey, PathBuf)>,
88    /// Maximum number of entries before LRU eviction kicks in. 0 = no cap.
89    capacity: usize,
90    /// Monotonic epoch counter. Incremented on every publish.
91    next_epoch: u64,
92    /// Last time a server published/replaced diagnostics for a specific file.
93    /// Used as a per-file freshness proof for push-only servers.
94    last_publish_at_for_file: HashMap<(ServerKey, PathBuf), Instant>,
95}
96
97impl DiagnosticsStore {
98    pub fn new() -> Self {
99        Self::with_capacity(5000)
100    }
101
102    pub fn with_capacity(capacity: usize) -> Self {
103        Self {
104            entries: HashMap::new(),
105            order: Vec::new(),
106            capacity,
107            next_epoch: 0,
108            last_publish_at_for_file: HashMap::new(),
109        }
110    }
111
112    /// Set or change the LRU cap. If the new cap is smaller than the
113    /// current entry count, the oldest entries are evicted immediately
114    /// to fit.
115    pub fn set_capacity(&mut self, capacity: usize) {
116        self.capacity = capacity;
117        if capacity > 0 {
118            while self.entries.len() > capacity {
119                self.evict_lru();
120            }
121        }
122    }
123
124    /// Number of currently-tracked entries.
125    pub fn len(&self) -> usize {
126        self.entries.len()
127    }
128
129    pub fn is_empty(&self) -> bool {
130        self.entries.is_empty()
131    }
132
133    /// Replace diagnostics for a `(server_kind, file)` pair using the
134    /// server's lifecycle root from the active manager. Empty diagnostics
135    /// are preserved as "checked clean" (NOT deleted as before).
136    ///
137    /// Note: the `(server, file)` key uses `ServerKey { kind, root }` so
138    /// concurrent multi-workspace usage doesn't collapse different roots.
139    /// Callers without the root (legacy push handler) should call
140    /// `publish_with_kind` which derives the key.
141    pub fn publish(
142        &mut self,
143        server: ServerKey,
144        file: PathBuf,
145        diagnostics: Vec<StoredDiagnostic>,
146    ) {
147        self.publish_with_result_id(server, file, diagnostics, None);
148    }
149
150    /// Replace diagnostics and record a pull `resultId` for the next
151    /// request. Empty diagnostics are preserved as "checked clean".
152    pub fn publish_with_result_id(
153        &mut self,
154        server: ServerKey,
155        file: PathBuf,
156        diagnostics: Vec<StoredDiagnostic>,
157        result_id: Option<String>,
158    ) {
159        self.publish_full(server, file, diagnostics, result_id, None);
160    }
161
162    /// Replace diagnostics with full provenance (resultId + document version).
163    /// `version` should be the LSP `version` field from `publishDiagnostics`
164    /// when the server provided one, or `None` otherwise.
165    pub fn publish_full(
166        &mut self,
167        server: ServerKey,
168        file: PathBuf,
169        diagnostics: Vec<StoredDiagnostic>,
170        result_id: Option<String>,
171        version: Option<i32>,
172    ) {
173        let key = (server, file);
174        self.next_epoch = self.next_epoch.saturating_add(1);
175        let entry = DiagnosticEntry {
176            diagnostics,
177            epoch: self.next_epoch,
178            result_id,
179            version,
180        };
181
182        self.last_publish_at_for_file
183            .insert(key.clone(), Instant::now());
184
185        if self.entries.contains_key(&key) {
186            self.entries.insert(key.clone(), entry);
187            self.touch_existing(&key);
188        } else {
189            // New entry — apply LRU cap before inserting.
190            if self.capacity > 0 && self.entries.len() >= self.capacity {
191                self.evict_lru();
192            }
193            self.entries.insert(key.clone(), entry);
194            self.order.push(key);
195        }
196    }
197
198    /// Compatibility wrapper for the legacy push path that knows only the
199    /// `ServerKind`. Builds a `ServerKey` with an empty root, which is
200    /// adequate for the single-root-per-kind case the manager currently
201    /// uses for push diagnostics. Multi-root callers should use
202    /// `publish` directly with a real `ServerKey`.
203    pub fn publish_with_kind(
204        &mut self,
205        kind: ServerKind,
206        file: PathBuf,
207        diagnostics: Vec<StoredDiagnostic>,
208    ) {
209        let key = ServerKey {
210            kind,
211            root: PathBuf::new(),
212        };
213        self.publish(key, file, diagnostics);
214    }
215
216    /// Get all diagnostics for a specific file (across all servers).
217    /// Updates LRU position for each touched entry.
218    pub fn for_file(&self, file: &Path) -> Vec<&StoredDiagnostic> {
219        self.entries
220            .iter()
221            .filter(|((_, stored_file), _)| stored_file == file)
222            .flat_map(|(_, entry)| entry.diagnostics.iter())
223            .collect()
224    }
225
226    /// Get the full per-server entry for a file. Useful when callers need
227    /// to know epoch/resultId, not just the diagnostics array.
228    pub fn entries_for_file(&self, file: &Path) -> Vec<(&ServerKey, &DiagnosticEntry)> {
229        self.entries
230            .iter()
231            .filter(|((_, stored_file), _)| stored_file == file)
232            .map(|((key, _), entry)| (key, entry))
233            .collect()
234    }
235
236    /// True if any server has reported (even an empty result) for this file.
237    pub fn has_any_report_for_file(&self, file: &Path) -> bool {
238        self.entries.keys().any(|(_, f)| f == file)
239    }
240
241    /// True if this exact server instance has reported (even an empty result)
242    /// for this exact file.
243    pub fn has_report_for_server_file(&self, server: &ServerKey, file: &Path) -> bool {
244        self.entries
245            .contains_key(&(server.clone(), file.to_path_buf()))
246    }
247
248    /// True if this exact server instance published/replaced diagnostics for
249    /// this exact file after `since`. This is intentionally per `(kind, root,
250    /// file)`; a publish for another file must not prove freshness here.
251    pub fn has_publish_for_file_after(
252        &self,
253        server: &ServerKey,
254        file: &Path,
255        since: Instant,
256    ) -> bool {
257        self.last_publish_at_for_file
258            .get(&(server.clone(), file.to_path_buf()))
259            .is_some_and(|published_at| *published_at >= since)
260    }
261
262    /// Get all diagnostics for files under a directory.
263    pub fn for_directory(&self, dir: &Path) -> Vec<&StoredDiagnostic> {
264        self.entries
265            .iter()
266            .filter(|((_, stored_file), _)| stored_file.starts_with(dir))
267            .flat_map(|(_, entry)| entry.diagnostics.iter())
268            .collect()
269    }
270
271    /// All stored diagnostics, flattened.
272    pub fn all(&self) -> Vec<&StoredDiagnostic> {
273        self.entries
274            .values()
275            .flat_map(|entry| entry.diagnostics.iter())
276            .collect()
277    }
278
279    /// Drop all entries for a server kind (e.g., on server crash/restart).
280    /// Prefer `clear_for_server` for real manager cleanup so peer roots of the
281    /// same kind are not wiped.
282    pub fn clear_server(&mut self, server: ServerKind) {
283        self.entries
284            .retain(|(stored_key, _), _| stored_key.kind != server);
285        self.order
286            .retain(|(stored_key, _)| stored_key.kind != server);
287        self.last_publish_at_for_file
288            .retain(|(stored_key, _), _| stored_key.kind != server);
289    }
290
291    /// Drop all entries for a specific server instance.
292    pub fn clear_for_server(&mut self, key: &ServerKey) {
293        self.entries.retain(|(k, _), _| k != key);
294        self.order.retain(|(k, _)| k != key);
295        self.last_publish_at_for_file.retain(|(k, _), _| k != key);
296    }
297
298    /// Backward-compatible alias for tests/callers that already used the
299    /// instance-scoped name.
300    pub fn clear_server_instance(&mut self, key: &ServerKey) {
301        self.clear_for_server(key);
302    }
303
304    /// Remove the least-recently-used entry, returning its key for telemetry.
305    fn evict_lru(&mut self) -> Option<(ServerKey, PathBuf)> {
306        if self.order.is_empty() {
307            return None;
308        }
309        let evicted = self.order.remove(0);
310        self.entries.remove(&evicted);
311        self.last_publish_at_for_file.remove(&evicted);
312        Some(evicted)
313    }
314
315    fn touch_existing(&mut self, key: &(ServerKey, PathBuf)) {
316        if let Some(idx) = self.order.iter().position(|k| k == key) {
317            let removed = self.order.remove(idx);
318            self.order.push(removed);
319        }
320    }
321}
322
323impl Default for DiagnosticsStore {
324    fn default() -> Self {
325        Self::new()
326    }
327}
328
329/// Convert LSP diagnostics to our stored format.
330/// LSP uses 0-based line/character; we convert to 1-based.
331pub fn from_lsp_diagnostics(
332    file: PathBuf,
333    lsp_diagnostics: Vec<lsp_types::Diagnostic>,
334) -> Vec<StoredDiagnostic> {
335    lsp_diagnostics
336        .into_iter()
337        .map(|diagnostic| StoredDiagnostic {
338            file: file.clone(),
339            line: diagnostic.range.start.line + 1,
340            column: diagnostic.range.start.character + 1,
341            end_line: diagnostic.range.end.line + 1,
342            end_column: diagnostic.range.end.character + 1,
343            severity: match diagnostic.severity {
344                Some(lsp_types::DiagnosticSeverity::ERROR) => DiagnosticSeverity::Error,
345                Some(lsp_types::DiagnosticSeverity::WARNING) => DiagnosticSeverity::Warning,
346                Some(lsp_types::DiagnosticSeverity::INFORMATION) => DiagnosticSeverity::Information,
347                Some(lsp_types::DiagnosticSeverity::HINT) => DiagnosticSeverity::Hint,
348                _ => DiagnosticSeverity::Warning,
349            },
350            message: diagnostic.message,
351            code: diagnostic.code.map(|code| match code {
352                lsp_types::NumberOrString::Number(value) => value.to_string(),
353                lsp_types::NumberOrString::String(value) => value,
354            }),
355            source: diagnostic.source,
356        })
357        .collect()
358}
359
360#[cfg(test)]
361mod tests {
362    use std::path::{Path, PathBuf};
363
364    use lsp_types::{
365        Diagnostic, DiagnosticSeverity as LspDiagnosticSeverity, NumberOrString, Position, Range,
366    };
367
368    use super::{from_lsp_diagnostics, DiagnosticSeverity, DiagnosticsStore, StoredDiagnostic};
369    use crate::lsp::registry::ServerKind;
370    use crate::lsp::roots::ServerKey;
371
372    fn server_key(kind: ServerKind) -> ServerKey {
373        ServerKey {
374            kind,
375            root: PathBuf::from("/tmp/repo"),
376        }
377    }
378
379    fn diag(file: &str, line: u32, msg: &str, sev: DiagnosticSeverity) -> StoredDiagnostic {
380        StoredDiagnostic {
381            file: PathBuf::from(file),
382            line,
383            column: 1,
384            end_line: line,
385            end_column: 2,
386            severity: sev,
387            message: msg.into(),
388            code: None,
389            source: None,
390        }
391    }
392
393    #[test]
394    fn converts_lsp_positions_to_one_based() {
395        let file = PathBuf::from("/tmp/demo.rs");
396        let diagnostics = from_lsp_diagnostics(
397            file.clone(),
398            vec![Diagnostic {
399                range: Range::new(Position::new(0, 0), Position::new(1, 4)),
400                severity: Some(LspDiagnosticSeverity::ERROR),
401                code: Some(NumberOrString::String("E1".into())),
402                code_description: None,
403                source: Some("fake".into()),
404                message: "boom".into(),
405                related_information: None,
406                tags: None,
407                data: None,
408            }],
409        );
410
411        assert_eq!(diagnostics.len(), 1);
412        assert_eq!(diagnostics[0].file, file);
413        assert_eq!(diagnostics[0].line, 1);
414        assert_eq!(diagnostics[0].column, 1);
415        assert_eq!(diagnostics[0].end_line, 2);
416        assert_eq!(diagnostics[0].end_column, 5);
417        assert_eq!(diagnostics[0].severity, DiagnosticSeverity::Error);
418        assert_eq!(diagnostics[0].code.as_deref(), Some("E1"));
419    }
420
421    #[test]
422    fn publish_replaces_existing_file_diagnostics() {
423        let file = PathBuf::from("/tmp/demo.rs");
424        let mut store = DiagnosticsStore::new();
425        let key = server_key(ServerKind::Rust);
426
427        store.publish(
428            key.clone(),
429            file.clone(),
430            vec![diag(
431                "/tmp/demo.rs",
432                1,
433                "first",
434                DiagnosticSeverity::Warning,
435            )],
436        );
437        store.publish(
438            key.clone(),
439            file.clone(),
440            vec![diag("/tmp/demo.rs", 2, "second", DiagnosticSeverity::Error)],
441        );
442
443        let stored = store.for_file(&file);
444        assert_eq!(stored.len(), 1);
445        assert_eq!(stored[0].message, "second");
446    }
447
448    #[test]
449    fn empty_publish_is_preserved_as_checked_clean() {
450        // The whole point of the v0.16 audit fix: empty publish ≠ deletion.
451        // Agents need to be able to ask "has this file been checked yet?"
452        // and get a truthful answer.
453        let file = PathBuf::from("/tmp/clean.rs");
454        let mut store = DiagnosticsStore::new();
455        let key = server_key(ServerKind::Rust);
456
457        // First publish has an issue.
458        store.publish(
459            key.clone(),
460            file.clone(),
461            vec![diag(
462                "/tmp/clean.rs",
463                5,
464                "fix me",
465                DiagnosticSeverity::Warning,
466            )],
467        );
468        assert!(store.has_any_report_for_file(&file));
469        assert_eq!(store.for_file(&file).len(), 1);
470
471        // Second publish is empty (the fix worked). Entry is preserved as
472        // "checked clean" rather than deleted.
473        store.publish(key.clone(), file.clone(), Vec::new());
474        assert!(
475            store.has_any_report_for_file(&file),
476            "checked-clean must be distinguishable from never-checked"
477        );
478        assert_eq!(store.for_file(&file).len(), 0);
479
480        let entries = store.entries_for_file(&file);
481        assert_eq!(entries.len(), 1);
482        assert!(entries[0].1.epoch > 0);
483    }
484
485    #[test]
486    fn never_checked_returns_no_report() {
487        let store = DiagnosticsStore::new();
488        let file = PathBuf::from("/tmp/never.rs");
489        assert!(!store.has_any_report_for_file(&file));
490        assert!(store.for_file(&file).is_empty());
491    }
492
493    #[test]
494    fn per_server_state_is_tracked_independently() {
495        let file = PathBuf::from("/tmp/multi.py");
496        let mut store = DiagnosticsStore::new();
497        let pyright_key = server_key(ServerKind::Python);
498        let ty_key = server_key(ServerKind::Ty);
499
500        store.publish(
501            pyright_key,
502            file.clone(),
503            vec![diag(
504                "/tmp/multi.py",
505                1,
506                "pyright says X",
507                DiagnosticSeverity::Error,
508            )],
509        );
510        store.publish(
511            ty_key,
512            file.clone(),
513            vec![diag(
514                "/tmp/multi.py",
515                2,
516                "ty says Y",
517                DiagnosticSeverity::Warning,
518            )],
519        );
520
521        let messages: Vec<&str> = store
522            .for_file(&file)
523            .into_iter()
524            .map(|d| d.message.as_str())
525            .collect();
526
527        assert_eq!(messages.len(), 2, "both servers' reports preserved");
528        assert!(messages.iter().any(|m| m == &"pyright says X"));
529        assert!(messages.iter().any(|m| m == &"ty says Y"));
530    }
531
532    #[test]
533    fn lru_evicts_oldest_when_capacity_exceeded() {
534        let mut store = DiagnosticsStore::with_capacity(2);
535        let key = server_key(ServerKind::Rust);
536
537        store.publish(
538            key.clone(),
539            PathBuf::from("/a.rs"),
540            vec![diag("/a.rs", 1, "a", DiagnosticSeverity::Warning)],
541        );
542        store.publish(
543            key.clone(),
544            PathBuf::from("/b.rs"),
545            vec![diag("/b.rs", 1, "b", DiagnosticSeverity::Warning)],
546        );
547        assert_eq!(store.len(), 2);
548
549        // Inserting a third entry should evict /a.rs (oldest).
550        store.publish(
551            key.clone(),
552            PathBuf::from("/c.rs"),
553            vec![diag("/c.rs", 1, "c", DiagnosticSeverity::Warning)],
554        );
555        assert_eq!(store.len(), 2);
556        assert!(!store.has_any_report_for_file(Path::new("/a.rs")));
557        assert!(store.has_any_report_for_file(Path::new("/b.rs")));
558        assert!(store.has_any_report_for_file(Path::new("/c.rs")));
559    }
560
561    #[test]
562    fn touching_existing_entry_moves_it_to_end_of_lru() {
563        let mut store = DiagnosticsStore::with_capacity(2);
564        let key = server_key(ServerKind::Rust);
565
566        store.publish(
567            key.clone(),
568            PathBuf::from("/a.rs"),
569            vec![diag("/a.rs", 1, "a", DiagnosticSeverity::Warning)],
570        );
571        store.publish(
572            key.clone(),
573            PathBuf::from("/b.rs"),
574            vec![diag("/b.rs", 1, "b", DiagnosticSeverity::Warning)],
575        );
576
577        // Re-publish /a.rs — this should refresh its LRU position so it's
578        // newer than /b.rs. Inserting /c.rs should now evict /b.rs.
579        store.publish(
580            key.clone(),
581            PathBuf::from("/a.rs"),
582            vec![diag("/a.rs", 1, "a2", DiagnosticSeverity::Error)],
583        );
584        store.publish(
585            key.clone(),
586            PathBuf::from("/c.rs"),
587            vec![diag("/c.rs", 1, "c", DiagnosticSeverity::Warning)],
588        );
589
590        assert!(store.has_any_report_for_file(Path::new("/a.rs")));
591        assert!(!store.has_any_report_for_file(Path::new("/b.rs")));
592        assert!(store.has_any_report_for_file(Path::new("/c.rs")));
593    }
594
595    #[test]
596    fn capacity_zero_disables_eviction() {
597        let mut store = DiagnosticsStore::with_capacity(0);
598        let key = server_key(ServerKind::Rust);
599
600        for i in 0..50 {
601            store.publish(
602                key.clone(),
603                PathBuf::from(format!("/f{i}.rs")),
604                vec![diag(
605                    &format!("/f{i}.rs"),
606                    1,
607                    "x",
608                    DiagnosticSeverity::Warning,
609                )],
610            );
611        }
612        assert_eq!(store.len(), 50);
613    }
614
615    #[test]
616    fn set_capacity_evicts_on_shrink() {
617        let mut store = DiagnosticsStore::with_capacity(0);
618        let key = server_key(ServerKind::Rust);
619        for i in 0..10 {
620            store.publish(
621                key.clone(),
622                PathBuf::from(format!("/f{i}.rs")),
623                vec![diag(
624                    &format!("/f{i}.rs"),
625                    1,
626                    "x",
627                    DiagnosticSeverity::Warning,
628                )],
629            );
630        }
631        assert_eq!(store.len(), 10);
632
633        store.set_capacity(3);
634        assert_eq!(store.len(), 3);
635        // Most recent 3 should remain (/f7.rs, /f8.rs, /f9.rs).
636        assert!(store.has_any_report_for_file(Path::new("/f9.rs")));
637        assert!(!store.has_any_report_for_file(Path::new("/f0.rs")));
638    }
639
640    #[test]
641    fn epoch_increments_monotonically() {
642        let mut store = DiagnosticsStore::new();
643        let key = server_key(ServerKind::Rust);
644        let file = PathBuf::from("/e.rs");
645
646        store.publish(key.clone(), file.clone(), Vec::new());
647        let e1 = store.entries_for_file(&file)[0].1.epoch;
648
649        store.publish(key.clone(), file.clone(), Vec::new());
650        let e2 = store.entries_for_file(&file)[0].1.epoch;
651
652        assert!(e2 > e1, "epoch must increase on republish");
653    }
654
655    #[test]
656    fn result_id_is_round_tripped() {
657        let mut store = DiagnosticsStore::new();
658        let key = server_key(ServerKind::Rust);
659        let file = PathBuf::from("/r.rs");
660
661        store.publish_with_result_id(
662            key.clone(),
663            file.clone(),
664            Vec::new(),
665            Some("rev-42".to_string()),
666        );
667
668        let entries = store.entries_for_file(&file);
669        assert_eq!(entries[0].1.result_id.as_deref(), Some("rev-42"));
670    }
671
672    #[test]
673    fn clear_server_drops_all_entries_for_kind() {
674        let mut store = DiagnosticsStore::new();
675        let py_key = server_key(ServerKind::Python);
676        let rust_key = server_key(ServerKind::Rust);
677
678        store.publish(
679            py_key.clone(),
680            PathBuf::from("/a.py"),
681            vec![diag("/a.py", 1, "x", DiagnosticSeverity::Error)],
682        );
683        store.publish(
684            rust_key.clone(),
685            PathBuf::from("/b.rs"),
686            vec![diag("/b.rs", 1, "y", DiagnosticSeverity::Error)],
687        );
688
689        store.clear_server(ServerKind::Python);
690        assert!(!store.has_any_report_for_file(Path::new("/a.py")));
691        assert!(store.has_any_report_for_file(Path::new("/b.rs")));
692    }
693}