Skip to content

Commit 9470d08

Browse files
committed
fix(discovery): skip ignored-name symlinks before recording limitation
Address rng1995 review on #499 (2026-09-18): apply the hidden-name and _SKIP_DIRS exclusion before recording multi_skill_symlinked_entry, so an intentionally ignored .git/.venv/node_modules symlink no longer makes an otherwise complete scan incomplete. The limitation is retained for genuinely eligible symlinked children. Adds an ignored-name symlink regression. Signed-off-by: Deepak Jain <[email protected]>
1 parent b3e3672 commit 9470d08

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

‎src/skillspector/multi_skill.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ def detect_skills(directory: Path) -> MultiSkillDetectionResult:
282282
child = Path(entry.path)
283283
try:
284284
if entry.is_symlink() or _is_link_or_junction(child):
285+
if entry.name in _SKIP_DIRS or (
286+
entry.name.startswith(".") and entry.name != ".aisop"
287+
):
288+
# Intentionally ignored names (e.g. `.git`, `.venv`,
289+
# `node_modules`) are not a discovery gap even when
290+
# they are symlinks; skip them before recording the
291+
# symlink limitation.
292+
continue
285293
limitations.append(
286294
MultiSkillDetectionLimitation(
287295
reason_code="read_error",

‎tests/test_multi_skill.py‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,52 @@ def test_symlinked_skill_directory_marks_discovery_incomplete(self, tmp_path: Pa
338338
assert result.limitations[0].reason_code == "read_error"
339339
assert result.limitations[0].resource == "multi_skill_symlinked_entry"
340340

341+
def test_ignored_name_symlinks_do_not_mark_discovery_incomplete(self, tmp_path: Path) -> None:
342+
"""Symlinks with intentionally ignored names are skipped, not recorded.
343+
344+
Closes rng1995 review on #499: a symlinked `.git`, `.venv`, or
345+
`node_modules` must not make an otherwise complete scan incomplete,
346+
while a genuinely eligible symlinked child still records the
347+
`multi_skill_symlinked_entry` limitation.
348+
"""
349+
for name in ("skill-a", "skill-b"):
350+
sub = tmp_path / name
351+
sub.mkdir()
352+
(sub / "SKILL.md").write_text(f"---\nname: {name}\n---\n", encoding="utf-8")
353+
external = tmp_path.parent / f"{tmp_path.name}-external-skill-499"
354+
external.mkdir()
355+
(external / "SKILL.md").write_text("---\nname: private\n---\n", encoding="utf-8")
356+
try:
357+
for ignored in (".git", ".venv", "node_modules"):
358+
(tmp_path / ignored).symlink_to(external, target_is_directory=True)
359+
(tmp_path / "linked-skill").symlink_to(external, target_is_directory=True)
360+
except OSError:
361+
pytest.skip("symlinks are not supported on this filesystem")
362+
363+
result = detect_skills(tmp_path)
364+
365+
assert result.is_multi_skill is True
366+
assert {skill.name for skill in result.skills} == {"skill-a", "skill-b"}
367+
assert [lim.resource for lim in result.limitations] == ["multi_skill_symlinked_entry"]
368+
369+
ignored_only = tmp_path / "ignored-only"
370+
ignored_only.mkdir()
371+
for name in ("skill-c", "skill-d"):
372+
sub = ignored_only / name
373+
sub.mkdir()
374+
(sub / "SKILL.md").write_text(f"---\nname: {name}\n---\n", encoding="utf-8")
375+
try:
376+
for ignored in (".git", "node_modules"):
377+
(ignored_only / ignored).symlink_to(external, target_is_directory=True)
378+
except OSError:
379+
pytest.skip("symlinks are not supported on this filesystem")
380+
381+
result = detect_skills(ignored_only)
382+
383+
assert result.complete is True
384+
assert result.limitations == ()
385+
assert {skill.name for skill in result.skills} == {"skill-c", "skill-d"}
386+
341387
def test_symlinked_root_is_not_detected(self, tmp_path: Path) -> None:
342388
"""Direct callers cannot use detection to inspect a symlinked root."""
343389
external = tmp_path / "external"

0 commit comments

Comments
 (0)