stack: SKILL.md-Links auf repo-root-relative Pfade umgestellt, docs verify/instructions verify pruefen Linkziele
CI / verify (push) Successful in 52s
Release / release (push) Successful in 36s

Files changed:
- CHANGES.md
- VERSION
- instructions/CONTRACT.md
- instructions/dev/doc-pull-through.md
- instructions/dev/stack-close/SKILL.md
- instructions/dev/stack-dev/SKILL.md
- instructions/wiki-ingest/SKILL.md
- instructions/wiki-lint/SKILL.md
- instructions/wiki-manage/SKILL.md
- instructions/wiki-query/SKILL.md
- instructions/wiki-status/SKILL.md
- tools/CONTRACT.md
- tools/chemenu/commands/docs_verify.py
- tools/chemenu/commands/instructions_cmd.py
- tools/chemenu/tests/test_docs_verify.py
- tools/chemenu/tests/test_instructions_cmd.py
This commit is contained in:
torben committed 2026-09-12 23:21:45 +02:00
1 parent dc688e5726
commit 0fb8fd6122
16 files changed
+442 -78

No files matched your search

+66
View File
@@ -533,6 +533,72 @@ def test_no_shipped_document_cites_an_issue():
assert docs_verify.check_no_issue_references() == []
def test_a_dead_relative_link_is_reported(tmp_path, monkeypatch):
"""Regression guard for the bug this check exists to catch: a `../` count
wrong for the file's own depth is invisible to every other check - the
name it links to is real, the text renders, and nothing resolves the
target to notice it lands nowhere."""
fake = tmp_path / "example.md"
fake.write_text("See [tools/CONTRACT.md](../tools/CONTRACT.md) for the command table.\n", encoding="utf-8")
monkeypatch.setattr(docs_verify.toc, "target_files", lambda: [fake])
issues = docs_verify.check_reference_targets()
assert len(issues) == 1
assert "example.md:1" in issues[0]
assert "../tools/CONTRACT.md" in issues[0]
def test_a_resolving_relative_link_is_not_reported(tmp_path, monkeypatch):
(tmp_path / "tools").mkdir()
(tmp_path / "tools" / "CONTRACT.md").write_text("# Contract\n", encoding="utf-8")
fake = tmp_path / "example.md"
fake.write_text("See [tools/CONTRACT.md](tools/CONTRACT.md) for the command table.\n", encoding="utf-8")
monkeypatch.setattr(docs_verify.toc, "target_files", lambda: [fake])
assert docs_verify.check_reference_targets() == []
def test_an_absolute_url_is_not_resolved_as_a_path(tmp_path, monkeypatch):
fake = tmp_path / "example.md"
fake.write_text("See [Anthropic](https://www.anthropic.com).\n", encoding="utf-8")
monkeypatch.setattr(docs_verify.toc, "target_files", lambda: [fake])
assert docs_verify.check_reference_targets() == []
def test_a_section_anchor_is_stripped_before_resolving(tmp_path, monkeypatch):
"""CommonMark anchors are not filesystem paths - only the path part of
`target#anchor` is checked for existence."""
(tmp_path / "kb").mkdir()
(tmp_path / "kb" / "CONVENTIONS.md").write_text("## Tone\n", encoding="utf-8")
fake = tmp_path / "example.md"
fake.write_text("See [kb/CONVENTIONS.md § Tone](kb/CONVENTIONS.md#tone).\n", encoding="utf-8")
monkeypatch.setattr(docs_verify.toc, "target_files", lambda: [fake])
assert docs_verify.check_reference_targets() == []
def test_link_syntax_shown_as_an_example_in_a_fence_is_not_flagged(tmp_path, monkeypatch):
"""A passage documenting bad link syntax must not be mistaken for a real
reference - code fences are masked before scanning, mirroring `toc.py`."""
fake = tmp_path / "example.md"
fake.write_text(
"Do not write it like this:\n\n```markdown\n[gates.md](../nonexistent.md)\n```\n",
encoding="utf-8",
)
monkeypatch.setattr(docs_verify.toc, "target_files", lambda: [fake])
assert docs_verify.check_reference_targets() == []
def test_every_reference_files_link_targets_resolve():
"""Forward direction, against the real tree: every relative link in a file
`toc.target_files()` covers must resolve - this is what a `../` count
wrong for the file's own depth is caught by."""
assert docs_verify.check_reference_targets() == []
def test_verify_raises_when_a_reference_target_is_dead(monkeypatch):
monkeypatch.setattr(docs_verify, "check_reference_targets", lambda: ["dangling"])
with pytest.raises(typer.Exit):
docs_verify.verify()
def test_a_cited_issue_number_is_reported(monkeypatch):
monkeypatch.setattr(
docs_verify,