fix: types/type-spec.schema.yaml enforced against real type-spec frontmatter, doc-pull-through.md docs/-page count corrected (closes #105)
CI / verify (push) Failing after 45s
Release / release (push) Successful in 38s

Files changed:
- CHANGES.md
- VERSION
- instructions/dev/doc-pull-through.md
- tools/CONTRACT.md
- tools/chemenu/commands/docs_verify.py
- tools/chemenu/tests/test_docs_verify.py
- types/type-spec.md
- types/type-spec.schema.yaml
This commit is contained in:
torben committed 2026-09-15 19:45:33 +02:00
1 parent 6eb3f84256
commit 55f65c1ab1
8 files changed
+161 -7

No files matched your search

+47 -1
View File
@@ -1,8 +1,9 @@
import pytest
import typer
from chemenu import config
from chemenu import config, type_resolver
from chemenu.commands import dist_cmd, docs_verify
from chemenu.type_resolver import TypeResolver
def test_every_registered_command_is_documented():
@@ -289,6 +290,51 @@ def test_an_absent_listed_doc_is_skipped_not_reported(tmp_path, monkeypatch):
assert docs_verify.check_readmes_have_no_command_table() == []
def test_this_repos_type_specs_validate_against_their_own_schema():
"""Regression guard for Gitea #105: types/type-spec.schema.yaml declared
`additionalProperties: false` while real type-specs already carried
`root:` and `capture_fields:`, and nothing ever validated a type-spec's
own frontmatter against it - so the mismatch shipped silently."""
assert docs_verify.check_type_spec_frontmatter() == []
def test_an_unknown_type_spec_field_is_reported(tmp_path, monkeypatch):
"""Once the schema is enforced, a type-spec frontmatter field its own
schema does not know about must fail loudly rather than validating
silently - the other direction of the #105 regression guard above."""
types_dir = tmp_path / "types"
types_dir.mkdir()
(types_dir / "type-spec.md").write_text(
"---\n"
"type: types/type-spec.md\n"
"name: type-spec\n"
"description: Authoring and validation contract for type specs\n"
"schema: types/type-spec.schema.yaml\n"
"---\n",
encoding="utf-8",
)
(types_dir / "type-spec.schema.yaml").write_text(
(config.ROOT / "types" / "type-spec.schema.yaml").read_text(encoding="utf-8"),
encoding="utf-8",
)
(types_dir / "widget.md").write_text(
"---\n"
"type: types/type-spec.md\n"
"name: widget\n"
"description: A type-spec with a field its own schema does not know\n"
"schema: null\n"
"not_a_real_field: true\n"
"---\n",
encoding="utf-8",
)
monkeypatch.setattr(config, "ROOT", tmp_path)
monkeypatch.setattr(config, "TYPES_DIR", types_dir)
monkeypatch.setattr(type_resolver, "resolver", TypeResolver(repo_root=tmp_path))
issues = docs_verify.check_type_spec_frontmatter()
assert any("widget.md" in issue and "not_a_real_field" in issue for issue in issues)
def test_legacy_type_blocks_are_absent():
assert docs_verify.check_legacy_type_blocks() == []