generated from coulomb/repo-seed
Kontextual Engine Integration Boundary
This commit is contained in:
86
tests/test_legacy_pilot.py
Normal file
86
tests/test_legacy_pilot.py
Normal file
@@ -0,0 +1,86 @@
|
||||
from pathlib import Path
|
||||
|
||||
from infospace_bench import load_infospace
|
||||
from infospace_bench.engine import plan_asset_sync
|
||||
from infospace_bench.evaluation_io import read_entity_evaluation, read_history
|
||||
from infospace_bench.history import read_metrics_file
|
||||
from infospace_bench.inspection import export_mermaid, relationship_summary
|
||||
from infospace_bench.markdown_adapter import validate_infospace_artifacts
|
||||
from infospace_bench.semantics import list_entities, list_relations
|
||||
from infospace_bench.viability import evaluate_viability
|
||||
|
||||
|
||||
ROOT = Path("infospaces/wealth-vsm-legacy-slice")
|
||||
|
||||
|
||||
def test_legacy_slice_is_loadable_and_pruned() -> None:
|
||||
infospace = load_infospace(ROOT)
|
||||
|
||||
assert infospace.config.slug == "wealth-vsm-legacy-slice"
|
||||
assert infospace.config.topic.name == "The Wealth of Nations / VSM Legacy Slice"
|
||||
assert [artifact.kind for artifact in infospace.artifacts] == [
|
||||
"source",
|
||||
"entity",
|
||||
"entity",
|
||||
"relation",
|
||||
]
|
||||
assert len(list(ROOT.rglob("*.md"))) < 20
|
||||
|
||||
|
||||
def test_legacy_slice_validates_and_parses_entities_and_relations() -> None:
|
||||
validation = validate_infospace_artifacts(ROOT)
|
||||
entities = list_entities(ROOT)
|
||||
relations = list_relations(ROOT)
|
||||
|
||||
assert validation
|
||||
assert all(result.valid for result in validation)
|
||||
assert [entity.slug for entity in entities] == [
|
||||
"division-of-labour",
|
||||
"market-extent",
|
||||
]
|
||||
assert relations[0].subject_entity_id == "entity/division-of-labour.md"
|
||||
assert relations[0].object_entity_id == "entity/market-extent.md"
|
||||
assert relations[0].is_feedback_member is True
|
||||
|
||||
|
||||
def test_legacy_slice_evaluation_metrics_and_viability() -> None:
|
||||
evaluation = read_entity_evaluation(
|
||||
ROOT / "output" / "evaluations" / "division-of-labour.md"
|
||||
)
|
||||
metrics = read_metrics_file(ROOT / "output" / "metrics" / "metrics.yaml")
|
||||
history = read_history(ROOT / "output" / "metrics" / "history.yaml")
|
||||
viability = evaluate_viability(metrics, load_infospace(ROOT).config.viability)
|
||||
|
||||
assert evaluation.artifact_id == "entity/division-of-labour.md"
|
||||
assert round(evaluation.overall_score, 2) == 4.60
|
||||
assert metrics["per_artifact_mean"] == 4.6
|
||||
assert history[0].artifact_count == 2
|
||||
assert history[0].metadata["legacy_source"] == "markitect-main/examples/infospace-with-history"
|
||||
assert viability.passed is True
|
||||
|
||||
|
||||
def test_legacy_slice_graph_and_engine_plan_are_traceable() -> None:
|
||||
infospace = load_infospace(ROOT)
|
||||
summary = relationship_summary(infospace.artifacts)
|
||||
mermaid = export_mermaid(summary)
|
||||
plan = plan_asset_sync(ROOT)
|
||||
|
||||
assert summary.edge_count == 3
|
||||
assert "relation/division-of-labour-constrains-market-extent.md" in mermaid
|
||||
assert [action.action for action in plan.actions] == [
|
||||
"create",
|
||||
"create",
|
||||
"create",
|
||||
"create",
|
||||
]
|
||||
assert plan.actions[3].workflow_id == "legacy-migration"
|
||||
|
||||
|
||||
def test_legacy_slice_migration_report_names_parity_and_gaps() -> None:
|
||||
report = (ROOT / "reports" / "migration-report.md").read_text(encoding="utf-8")
|
||||
|
||||
assert "Pruned Legacy Reference Pilot" in report
|
||||
assert "Replaced" in report
|
||||
assert "Delegated" in report
|
||||
assert "Remaining gaps" in report
|
||||
assert "generated bulk was intentionally not migrated" in report
|
||||
Reference in New Issue
Block a user