generated from coulomb/repo-seed
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
from phase_memory.contracts import profile_from_markitect
|
|
from phase_memory.planner import plan_profile_execution
|
|
|
|
|
|
def test_profile_execution_plan_reports_capabilities_and_gates() -> None:
|
|
profile_data = json.loads((Path(__file__).parent / "fixtures" / "memory-profile.json").read_text(encoding="utf-8"))
|
|
profile = profile_from_markitect(profile_data).value
|
|
|
|
plan = plan_profile_execution(profile)
|
|
|
|
assert plan.ready
|
|
assert "activation.plan" in plan.capabilities
|
|
assert "retention.plan" in plan.capabilities
|
|
assert "durable_writes:review-gated" in plan.policy_gates
|
|
assert "secrets:denied" in plan.policy_gates
|
|
assert "phase_memory.profile.planned" in plan.observability_events
|
|
|
|
|
|
def test_profile_execution_plan_degrades_when_adapter_is_missing() -> None:
|
|
profile_data = json.loads((Path(__file__).parent / "fixtures" / "memory-profile.json").read_text(encoding="utf-8"))
|
|
profile_data["stores"]["knowledge"] = "external-graph-store"
|
|
profile = profile_from_markitect(profile_data).value
|
|
|
|
plan = plan_profile_execution(profile, available_adapters={"local-event-log"})
|
|
|
|
assert not plan.ready
|
|
assert "external-graph-store" in plan.missing_adapters
|
|
assert plan.fallback_behavior["missing_runtime_store"] == "degrade-to-dry-run"
|
|
assert any(diagnostic.code == "missing_adapter" for diagnostic in plan.diagnostics)
|