@@ -280,6 +280,55 @@ def test_include_paths_multiple_dirs(self, analyzer, ts_repo):
280280 assert any ('packages/schema' in f for f in file_paths )
281281 assert not any ('backend' in f for f in file_paths )
282282
283+ def test_include_paths_with_corrupt_data (self , analyzer , ts_repo ):
284+ """Corrupt jsonb from DB should not crash -- non-strings are filtered out"""
285+ graph = analyzer .build_dependency_graph (
286+ str (ts_repo ),
287+ include_paths = [123 , None , '' , 'packages/effect' , True ]
288+ )
289+ file_paths = set (graph ['dependencies' ].keys ())
290+ # Should only include effect files, corrupt entries filtered
291+ assert all ('packages/effect' in f for f in file_paths )
292+ assert len (file_paths ) > 0
293+
294+ def test_include_paths_all_corrupt_scans_everything (self , analyzer , ts_repo ):
295+ """If all include_paths entries are invalid, fall back to full scan"""
296+ graph = analyzer .build_dependency_graph (
297+ str (ts_repo ),
298+ include_paths = [123 , None , '' , False ]
299+ )
300+ file_paths = set (graph ['dependencies' ].keys ())
301+ # Should fall back to scanning everything
302+ assert any ('backend' in f for f in file_paths )
303+ assert any ('packages/effect' in f for f in file_paths )
304+
305+ def test_include_paths_empty_list_scans_everything (self , analyzer , ts_repo ):
306+ """Empty list should be treated same as None"""
307+ graph = analyzer .build_dependency_graph (str (ts_repo ), include_paths = [])
308+ file_paths = set (graph ['dependencies' ].keys ())
309+ assert any ('backend' in f for f in file_paths )
310+
311+ def test_include_paths_traversal_rejected (self , analyzer , ts_repo ):
312+ """Path traversal attempts should be stripped, not crash"""
313+ graph = analyzer .build_dependency_graph (
314+ str (ts_repo ),
315+ include_paths = ['../etc/passwd' , 'packages/effect' , '../../secrets' ]
316+ )
317+ file_paths = set (graph ['dependencies' ].keys ())
318+ # Traversal entries filtered, only packages/effect remains
319+ assert all ('packages/effect' in f for f in file_paths )
320+ assert len (file_paths ) > 0
321+
322+ def test_include_paths_backslash_normalized (self , analyzer , ts_repo ):
323+ """Windows-style backslashes should be normalized"""
324+ graph = analyzer .build_dependency_graph (
325+ str (ts_repo ),
326+ include_paths = ['packages\\ effect' ]
327+ )
328+ file_paths = set (graph ['dependencies' ].keys ())
329+ assert all ('packages/effect' in f for f in file_paths )
330+ assert len (file_paths ) > 0
331+
283332
284333class TestGraphMetrics :
285334 """Verify graph statistics are correct"""
0 commit comments