Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from repo_manager.classification import ClassificationError, validate_classification
|
|
from repo_manager.observe import load_classification
|
|
|
|
|
|
def test_classification_contract_accepts_canon_values() -> None:
|
|
assert not validate_classification(
|
|
{
|
|
"category": "tooling",
|
|
"domain": "infotech",
|
|
"secondary_domains": ["agents"],
|
|
"capability_tags": ["repository-control"],
|
|
"business_stake": ["technology"],
|
|
"business_mechanics": ["control"],
|
|
}
|
|
)
|
|
|
|
|
|
def test_load_classification_rejects_invalid_authority(tmp_path: Path) -> None:
|
|
(tmp_path / ".repo-classification.yaml").write_text(
|
|
"repo_classification:\n"
|
|
" category: health\n"
|
|
" domain: infotech\n"
|
|
" secondary_domains: [infotech, nowhere]\n"
|
|
" capability_tags: [Bad_Tag]\n",
|
|
encoding="utf-8",
|
|
)
|
|
with pytest.raises(ClassificationError) as raised:
|
|
load_classification(tmp_path)
|
|
message = str(raised.value)
|
|
assert "category" in message
|
|
assert "secondary_domains" in message
|
|
assert "capability_tags" in message
|