docs: tools/CONTRACT.md als Nachschlage-Dokument strukturiert, AGENTS.md-Routing angepasst (schliesst #92)
CI / verify (push) Successful in 52s
Release / release (push) Successful in 36s

Files changed:
- AGENTS.md
- CHANGES.md
- VERSION
- tools/CONTRACT.md
- tools/chemenu/tests/test_docs_verify.py
This commit is contained in:
torben committed 2026-09-11 12:51:04 +02:00
1 parent 203084477f
commit 95ab40827a
5 files changed
+284 -18

No files matched your search

+41
View File
@@ -172,6 +172,47 @@ def test_a_renamed_error_contracts_heading_is_reported_not_silently_scanned(tmp_
assert not any("§ Error contracts" in issue and "not documented" in issue for issue in issues)
def test_a_section_runs_on_past_its_own_subheadings():
"""`###` groups inside a section must not end it. Both tables are split
into per-group subsections, each with its own table header, so a lookahead
that stopped at any `#` would truncate § Commands at its first group and
report every later command as undocumented."""
text = (
"## Commands\n\n"
"### Pages\n\n| `alpha` | does things |\n\n"
"### Git\n\n| `beta` | does other things |\n\n"
"## Error contracts\n\n| `gamma` | never | yes | retry |\n"
)
section = docs_verify.section_text(text, "## Commands")
assert docs_verify.documented_commands(section) == ["alpha", "beta"]
assert "gamma" not in section
def test_grouped_tables_are_still_checked_in_both_directions(tmp_path, monkeypatch):
"""The section split and the `###` grouping compose: each table is still
read as one pot of rows within its own section, however many subsections
and table headers it is broken into."""
fake = _fake_contract(
tmp_path,
commands_rows=(
"### Pages\n\n| Command | Purpose |\n| `alpha` | does things |\n\n"
"### Git\n\n| Command | Purpose |\n" # `beta`'s row was deleted here
),
error_rows=(
"### Pages\n\n| `alpha` | never | yes | retry |\n\n"
"### Git\n\n| `beta` | never | yes | retry |\n"
),
)
monkeypatch.setattr(docs_verify, "CLI_README", fake)
monkeypatch.setattr(docs_verify, "registered_commands", lambda: {"alpha", "beta"})
issues = docs_verify.check_cli_readme()
assert any(
"beta" in issue and "§ Commands" in issue and "not documented" in issue
for issue in issues
)
assert not any("§ Error contracts" in issue for issue in issues)
def test_collection_contracts_exist():
assert docs_verify.check_collection_contracts() == []