docs toc/verify: die .template-Form einer Referenzdatei steht im Dateisatz, Version 6.0.1 freigegeben (schliesst #106)
CI / verify (push) Successful in 48s
Release / release (push) Successful in 41s

Files changed:
- CHANGES.md
- VERSION
- instructions/dev/doc-pull-through.md
- kb/CONVENTIONS.md.template
- tools/CONTRACT.md
- tools/chemenu/commands/docs_verify.py
- tools/chemenu/tests/test_docs_verify.py
- tools/chemenu/tests/test_toc.py
- tools/chemenu/toc.py
This commit is contained in:
torben committed 2026-09-16 06:43:36 +02:00
1 parent 5d26698cd0
commit f3c80747a5
9 files changed
+158 -9

No files matched your search

+27
View File
@@ -571,6 +571,33 @@ def test_every_reference_files_toc_is_current():
assert docs_verify.check_toc_regions() == []
def test_a_shipped_template_over_the_threshold_without_a_region_is_reported(tmp_path, monkeypatch):
"""Regression guard for the defect this scope extension fixes: the template
an instance adopts was maintained by nothing and checked by nothing, so
`kb/CONVENTIONS.md.template` grew past the threshold carrying no region -
and every instance that adopted it got a `kb/CONVENTIONS.md` that fails
`docs verify` at the end of `setup-instance.md`, the one command that step
ends with. Before the template entered `toc.target_files()`, this check
returned nothing here."""
from chemenu import config, toc as toc_mod
monkeypatch.setattr(config, "ROOT", tmp_path)
(tmp_path / "kb").mkdir()
long_body = "# Conventions\n\nIntro.\n" + "".join(
f"\n## Section {i}\n\n" + "Body line.\n" * 12 for i in range(8)
)
assert toc_mod.needs_toc(long_body)
# The adopted file is current; only the template it was adopted from is not.
(tmp_path / "kb" / "CONVENTIONS.md").write_text(toc_mod.upsert(long_body), encoding="utf-8")
(tmp_path / "kb" / "CONVENTIONS.md.template").write_text(long_body, encoding="utf-8")
issues = docs_verify.check_toc_regions()
assert len(issues) == 1
assert "kb/CONVENTIONS.md.template" in issues[0]
assert "docs toc --apply" in issues[0]
def test_no_shipped_document_cites_an_issue():
"""Forward direction, against the real tree: a `#42` in a file `dist export`
ships points at a board only the origin repo has, and the reader of a