Skip to content

Commit ae495af

Browse files
committed
fix: tolerate legacy docs-cache symlinks
1 parent 37819fc commit ae495af

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

argus/corpus/paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ def _copy_tree(source: Path, destination: Path) -> int:
119119

120120
copied = 0
121121
for path in source.rglob("*"):
122+
if path.is_symlink() and not path.exists():
123+
continue
122124
relative = path.relative_to(source)
123125
target = destination / relative
124126
if path.is_dir():

tests/test_corpus.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for Argus corpus path resolution and legacy import."""
22

3+
import os
34
from pathlib import Path
45

56

@@ -27,3 +28,17 @@ def test_mirror_legacy_docs_cache(self, monkeypatch, tmp_path):
2728
assert result["docs_cache_files"] >= 1
2829
assert result["research_files"] >= 1
2930
assert Path(result["manifest_path"]).exists()
31+
32+
def test_mirror_legacy_docs_cache_skips_broken_symlinks(self, monkeypatch, tmp_path):
33+
legacy = tmp_path / "docs-cache"
34+
(legacy / "docs" / "cache" / "demo").mkdir(parents=True)
35+
(legacy / "docs" / "external").mkdir(parents=True)
36+
(legacy / "docs" / "cache" / "demo" / "README.md").write_text("# Demo\n", encoding="utf-8")
37+
os.symlink(legacy / "missing-target", legacy / "docs" / "external" / "broken-link")
38+
39+
monkeypatch.setenv("ARGUS_DATA_ROOT", str(tmp_path / "argus-data"))
40+
from argus.corpus import get_corpus_paths, mirror_legacy_docs_cache
41+
42+
result = mirror_legacy_docs_cache(legacy, get_corpus_paths())
43+
assert result["docs_cache_files"] >= 1
44+
assert Path(result["manifest_path"]).exists()

0 commit comments

Comments
 (0)