the-custodian/tests/test_scan_workstream_terminology.py
codex 36f0336ca6
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 3s
Python Tests / pytest (push) Successful in 41s
Fix stale terminology-allowlist test, not the config (CUST-WP-0060 follow-up)
Root-caused the xfail left in place at end of the test-coverage review:
git history (commit e0f9330, CUST-WP-0055 T02/T06/T07, 2026-07-08) shows
the agentic-resources exclude_repo: true -> path_prefixes narrowing was
deliberate, done to bring the repo's real source under the terminology
scan while still excluding the generated session_memory/.store/ tree.
The test was never updated to match and had been silently failing since.

Replaced the stale whole-repo-exclusion assertion with one that checks
the actual current contract: session_memory/.store/ stays excluded,
README.md (and everything else) is now in scope. No xfail marker needed
-- config was correct, only the test was wrong.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 23:17:34 +02:00

58 lines
No EOL
2.1 KiB
Python

from __future__ import annotations
from pathlib import Path
from tools.scan_workstream_terminology import (
DEFAULT_ALLOWLIST_PATH,
load_allowlist,
path_is_excluded,
prose_gate_violations,
)
def test_load_allowlist_reads_fleet_config() -> None:
config = load_allowlist(DEFAULT_ALLOWLIST_PATH)
assert config["version"] == 1
assert "the-custodian" in config["per_repo"]
def test_path_is_excluded_for_archived_workplans() -> None:
config = load_allowlist(DEFAULT_ALLOWLIST_PATH)
assert path_is_excluded("any-repo", "workplans/archived/foo.md", config)
assert not path_is_excluded("any-repo", "workplans/CUST-WP-0001.md", config)
def test_path_is_excluded_for_state_hub_compat_router() -> None:
config = load_allowlist(DEFAULT_ALLOWLIST_PATH)
assert path_is_excluded(
"state-hub",
"api/routers/workstreams.py",
config,
)
assert not path_is_excluded(
"state-hub",
"dashboard/src/index.md",
config,
)
def test_path_is_excluded_for_generated_tree_not_whole_repo() -> None:
"""agentic-resources' exclusion was deliberately narrowed from
exclude_repo: true to just the generated session_memory/.store/ tree
(commit e0f9330, CUST-WP-0055 T02/T06/T07, 2026-07-08) so the
terminology scan would cover the repo's real source. This replaces a
stale test that still asserted the old whole-repo exclusion (found
while wiring CI for tests/, CUST-WP-0060 test-coverage review)."""
config = load_allowlist(DEFAULT_ALLOWLIST_PATH)
assert path_is_excluded(
"agentic-resources", "session_memory/.store/foo.json", config
)
assert not path_is_excluded("agentic-resources", "README.md", config)
def test_prose_gate_violations_detect_user_facing_workstream() -> None:
root = Path(__file__).parent.parent
config = load_allowlist(DEFAULT_ALLOWLIST_PATH)
violations = prose_gate_violations(root, "the-custodian", config)
prose_paths = {path for path, _ in violations}
assert "canon/standards/workplan-terminology-fleet_v0.1.md" not in prose_paths