The canon owner disposed coordination-engine's candidate practice pattern as adapt, which unblocks COORDINATION-WP-0004-T01. Preserve the source, record the DecisionRecord, and register the assimilation. The TAMQ known use is implemented and tested, so the pattern enters at candidate. Canon placement is planned as proposed workplan INFO-WP-0030. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 121421@bnt-lap001 Assistant-Session: 36f8657c-ebfa-4a2e-9ba0-bff06738f233
242 lines
7.8 KiB
Python
242 lines
7.8 KiB
Python
from info_tech_canon.service import (
|
|
alignment_template,
|
|
artifact_graph,
|
|
generate_agent_briefs,
|
|
generate_indexes,
|
|
generate_tree,
|
|
inspect_canon,
|
|
list_artifacts,
|
|
list_models,
|
|
list_standards,
|
|
profile_graph,
|
|
profile_validate,
|
|
review_capability_record,
|
|
review_kit,
|
|
validate_canon,
|
|
)
|
|
from info_tech_canon.service import DEFAULT_INFOSPACE_ROOT
|
|
from pathlib import Path
|
|
import json
|
|
import shutil
|
|
|
|
|
|
def test_inspect_canon_counts_artifact_kinds() -> None:
|
|
payload = inspect_canon()
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["infospace"]["slug"] == "canon"
|
|
assert payload["infospace"]["artifact_count"] == 82
|
|
assert payload["infospace"]["kinds"] == {
|
|
"access-descriptor-set": 1,
|
|
"alignment-review-kit": 1,
|
|
"assimilation": 4,
|
|
"alignment-review-schema": 1,
|
|
"alignment-review-workflow": 1,
|
|
"alignment-scorecard": 1,
|
|
"benefit-analysis": 1,
|
|
"benchmark-findings": 1,
|
|
"benchmark-workspace": 1,
|
|
"capability-catalog": 1,
|
|
"capture-criteria": 1,
|
|
"caring-mapping": 1,
|
|
"comparison-frame": 1,
|
|
"comparison-report": 1,
|
|
"concept-catalog": 3,
|
|
"concept-area-seed": 1,
|
|
"conformance-pack": 1,
|
|
"consumer-workplan-brief": 3,
|
|
"consumer-workplan-template": 1,
|
|
"evaluation-pack": 1,
|
|
"evaluation-question-set": 1,
|
|
"example": 2,
|
|
"extension-candidate-set": 1,
|
|
"interface-card-expectation": 1,
|
|
"interface-card": 1,
|
|
"kernel": 2,
|
|
"mapping": 3,
|
|
"mapping-expectation": 1,
|
|
"model": 14,
|
|
"model-extension": 1,
|
|
"model-selection-guide": 1,
|
|
"native-concept-map": 1,
|
|
"pattern": 1,
|
|
"practice": 1,
|
|
"practice-pattern": 2,
|
|
"practice-pattern-scheme": 1,
|
|
"profile-alignment": 1,
|
|
"profile": 1,
|
|
"profile-artifact": 14,
|
|
"standard": 4,
|
|
"visualization-example-set": 1,
|
|
}
|
|
|
|
|
|
def test_model_and_standard_lists_are_filtered() -> None:
|
|
assert list_models()["count"] == 14
|
|
assert list_standards()["count"] == 4
|
|
|
|
|
|
def test_review_kit_exports_workflow_and_template() -> None:
|
|
payload = review_kit()
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["review_kit"]["id"] == "review-kit/alignment"
|
|
assert payload["components"]["workflow"]["content"]["id"] == (
|
|
"review-kit/alignment/workflow"
|
|
)
|
|
assert "## Current Fit" in payload["template"]["content"]
|
|
|
|
|
|
def test_alignment_template_exports_content() -> None:
|
|
payload = alignment_template()
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["path"] == "agent/templates/consumer-alignment-workplan.template.md"
|
|
assert "{{WORKPLAN_ID}}" in payload["content"]
|
|
|
|
|
|
def test_validate_canon_passes_scaffold() -> None:
|
|
payload = validate_canon()
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["errors"] == []
|
|
assert "warnings" in payload
|
|
assert payload["details"]["artifact_count"] == 82
|
|
|
|
|
|
def test_graph_exports_relationship_summary() -> None:
|
|
payload = artifact_graph()
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["graph"]["node_count"] == 82
|
|
assert payload["graph"]["edge_count"] > 15
|
|
|
|
|
|
def test_practice_patterns_are_registered() -> None:
|
|
payload = list_artifacts(kind="practice-pattern")
|
|
|
|
assert payload["count"] == 2
|
|
patterns = {pattern["id"]: pattern for pattern in payload["artifacts"]}
|
|
agentic = patterns["practice-pattern/agentic-drives-functional"]
|
|
assert agentic["title"] == "AgenticDrivesFunctional"
|
|
assert agentic["path"] == "patterns/AgenticDrivesFunctional.md"
|
|
strangler = patterns["practice-pattern/interface-deprecation-strangler"]
|
|
assert strangler["title"] == "InterfaceDeprecationStrangler"
|
|
assert strangler["path"] == "patterns/InterfaceDeprecationStrangler.md"
|
|
|
|
|
|
def test_capability_review_joins_a_minimal_record(tmp_path) -> None:
|
|
record = {
|
|
"record_id": "test",
|
|
"requires": [
|
|
{
|
|
"capability": "data.backup",
|
|
"profile": "database",
|
|
"minimum_maturity": "D5",
|
|
}
|
|
],
|
|
"provisions": [
|
|
{
|
|
"provider": "test.backup",
|
|
"capability": "data.backup",
|
|
"profile": "database",
|
|
"maturity": "D4",
|
|
"uses_provisions": [
|
|
{
|
|
"capability": "data.object",
|
|
"provider": "test.object",
|
|
"relation": "depends_on",
|
|
}
|
|
],
|
|
"consumes": [
|
|
{
|
|
"class": "H",
|
|
"quantity": {"value": None, "unit": "hour"},
|
|
"basis": "unknown",
|
|
"gap": "not recorded (owner: test)",
|
|
}
|
|
],
|
|
}
|
|
],
|
|
}
|
|
path = tmp_path / "case.json"
|
|
path.write_text(json.dumps(record))
|
|
payload = review_capability_record(path)
|
|
assert payload["ok"] is True
|
|
assert payload["requirements"][0]["status"] == "below_requirement"
|
|
|
|
|
|
def test_small_saas_profile_validates() -> None:
|
|
payload = profile_validate("small-saas")
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["errors"] == []
|
|
assert payload["details"]["kinds"]["tenant"] == 2
|
|
|
|
|
|
def test_small_saas_profile_graph_exports_slice() -> None:
|
|
payload = profile_graph("small-saas")
|
|
|
|
assert payload["ok"] is True
|
|
assert payload["profile"] == "small-saas"
|
|
assert "small-saas/service/billing-portal" in payload["graph"]["nodes"]
|
|
|
|
|
|
def test_small_saas_capability_requirements_meet_maturity_floors() -> None:
|
|
path = (
|
|
DEFAULT_INFOSPACE_ROOT
|
|
/ "profiles"
|
|
/ "small-saas"
|
|
/ "artifacts"
|
|
/ "capability-requirements.yaml"
|
|
)
|
|
payload = review_capability_record(path)
|
|
|
|
assert payload["ok"] is True
|
|
assert {item["status"] for item in payload["requirements"]} == {"met"}
|
|
assert len(payload["provisions"]) == 4
|
|
|
|
|
|
def test_generators_write_expected_assets(tmp_path) -> None:
|
|
root = tmp_path / "infospace"
|
|
shutil.copytree(DEFAULT_INFOSPACE_ROOT, root)
|
|
|
|
index_payload = generate_indexes(root)
|
|
tree_payload = generate_tree(root)
|
|
brief_payload = generate_agent_briefs(root)
|
|
|
|
assert index_payload["ok"] is True
|
|
assert tree_payload["ok"] is True
|
|
assert brief_payload["ok"] is True
|
|
assert (root / "indexes" / "concept-ownership.yaml").is_file()
|
|
assert (root / "views" / "by-standard.md").read_text(
|
|
encoding="utf-8"
|
|
).startswith("<!-- GENERATED")
|
|
assert (root / "agent" / "global-agent-brief.md").is_file()
|
|
assert (root / "agent" / "retrieval-index.md").is_file()
|
|
assert (root / "agent" / "retrieval-index.yaml").is_file()
|
|
assert (root / "agent" / "retrieval-index.json").is_file()
|
|
assert (root / "agent" / "briefs" / "model-access-control.md").is_file()
|
|
assert (
|
|
root / "agent" / "briefs" / "model-purpose-demand-extension.md"
|
|
).is_file()
|
|
assert (root / "agent" / "briefs" / "evaluation-user-engine.md").is_file()
|
|
assert (
|
|
root / "agent" / "briefs" / "conformance-railiance-fabric.md"
|
|
).is_file()
|
|
assert (
|
|
root / "agent" / "briefs" / "comparison-repo-scoping-report.md"
|
|
).is_file()
|
|
assert (
|
|
root / "agent" / "briefs" / "benchmark-caring-kubernetes-rbac.md"
|
|
).is_file()
|
|
assert (root / "agent" / "briefs" / "review-kit-alignment.md").is_file()
|
|
assert (root / "agent" / "briefs" / "standard-emission-cadence.md").is_file()
|
|
assert (
|
|
root / "agent" / "templates" / "consumer-alignment-workplan.template.md"
|
|
).is_file()
|
|
assert (root / "agent" / "briefs" / "pattern-intent-scope-purposes.md").is_file()
|
|
assert (
|
|
root / "agent" / "templates" / "canon-interface-card.template.yaml"
|
|
).is_file()
|
|
assert (root / "agent" / "consumer-briefs" / "user-engine.md").is_file()
|