From ba7e3d9803e004a31971bcacec51a5495f261a5f Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 27 Aug 2026 19:21:59 +0300 Subject: [PATCH] fix: ignore slash-separated prose references Signed-off-by: Tomas --- src/skillspector/references.py | 3 +- tests/nodes/test_security_remediation.py | 35 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/skillspector/references.py b/src/skillspector/references.py index b91626d3..f1270f43 100644 --- a/src/skillspector/references.py +++ b/src/skillspector/references.py @@ -44,7 +44,8 @@ class ReferenceResolutionResult: _PLAIN_RELATIVE_PATH = re.compile( - r"(? None: + records = resolve_bundle_references( + tmp_path, + source_path="SKILL.md", + source_text=( + "Compare reads/writes, environment/profile settings, and operation/node behavior." + ), + known_paths=["SKILL.md"], + ) + + assert records == [] + + +@pytest.mark.parametrize( + ("source_text", "target_path"), + [ + ("Read references/guide.md before continuing.", "references/guide.md"), + ("Read ./references/guide before continuing.", "references/guide"), + ], +) +def test_plain_local_reference_requires_an_explicit_path_signal( + tmp_path: Path, source_text: str, target_path: str +) -> None: + records = resolve_bundle_references( + tmp_path, + source_path="SKILL.md", + source_text=source_text, + known_paths=["SKILL.md", target_path], + ) + + assert len(records) == 1 + assert records[0]["status"] == "resolved" + assert records[0]["target_path"] == target_path + + def test_reference_resolver_rejects_external_and_parent_escape(tmp_path: Path) -> None: records = resolve_bundle_references( tmp_path,