Add interpretation source inventory gate
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regression tests for interpretation source inventory governance."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_interpretation_source_inventory_gate_reports_layered_source_pack() -> None:
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/interpretation_source_inventory_gate.py",
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=120,
|
||||
check=False,
|
||||
)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
|
||||
assert report["scope"] == "interpretation_source_inventory_gate"
|
||||
assert report["status"] == "pass"
|
||||
assert report["source_pack_status"] == "used"
|
||||
assert report["summary"]["missing_ref_count"] == 0
|
||||
assert report["summary"]["promoted_quarantined_count"] == 0
|
||||
assert report["summary"]["primary_truth_count"] >= 5
|
||||
assert report["summary"]["reference_layer_count"] >= 10
|
||||
assert report["summary"]["quarantined_draft_count"] >= 1
|
||||
|
||||
layers = report["layers"]
|
||||
assert "jyotish-app/interpretation.js" in layers["frontend_interpretation"]["source_refs"]
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-core/resources/qa_rules.md" in layers["qa_governance"]["source_refs"]
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-reader/resources/validation_rules.md" in layers["reader_validation"]["source_refs"]
|
||||
assert "references/yoga_rules.json" in layers["yoga_rules"]["source_refs"]
|
||||
assert "references/saham_rules.json" in layers["saham_rules"]["source_refs"]
|
||||
|
||||
draft_refs = layers["quarantined_drafts"]["source_refs"]
|
||||
source_refs = set(report["runtime_source_refs"])
|
||||
assert any("docs/research/local_drafts/" in path for path in draft_refs)
|
||||
assert all(path not in source_refs for path in draft_refs)
|
||||
|
||||
|
||||
def test_quality_gate_runs_interpretation_source_inventory_gate() -> None:
|
||||
quality_gate = (ROOT / "scripts" / "run_quality_gate.py").read_text(encoding="utf-8")
|
||||
|
||||
assert '"scripts/interpretation_source_inventory_gate.py"' in quality_gate
|
||||
assert '[PYTHON, "scripts/interpretation_source_inventory_gate.py"]' in quality_gate
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
|
||||
import jyotish_engine
|
||||
|
||||
from mcp_server import _collect_strict_evidence
|
||||
from mcp_server import _collect_strict_evidence, _existing_interpretation_source_pack
|
||||
|
||||
|
||||
def _base_career_result() -> dict:
|
||||
@@ -85,6 +85,16 @@ def test_career_strict_contract_attaches_existing_interpretation_source_pack() -
|
||||
assert source_pack["template_registry"]["template_count"] >= 11
|
||||
assert source_pack["frontend_planet_house_details"]["planet_count"] == 9
|
||||
assert source_pack["frontend_planet_house_details"]["house_count"] == 12
|
||||
assert source_pack["interpretation_source_inventory"]["status"] == "used"
|
||||
assert source_pack["frontend_interpretation_layer"]["status"] == "available"
|
||||
assert source_pack["frontend_interpretation_layer"]["source_refs"] == [
|
||||
"jyotish-app/interpretation.js",
|
||||
"jyotish-app/analysis-deep.js",
|
||||
]
|
||||
assert source_pack["yoga_rule_layer"]["status"] == "available"
|
||||
assert "references/yoga_rules.json" in source_pack["yoga_rule_layer"]["source_refs"]
|
||||
assert source_pack["reader_validation_layer"]["status"] == "available"
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-reader/resources/validation_rules.md" in source_pack["reader_validation_layer"]["source_refs"]
|
||||
|
||||
audit = strict["technique_audit_summary"]
|
||||
assert audit["interpretation_source_pack"]["used"] is True
|
||||
@@ -92,6 +102,24 @@ def test_career_strict_contract_attaches_existing_interpretation_source_pack() -
|
||||
assert audit["real_case_calibration"]["status"] == "blocked"
|
||||
|
||||
|
||||
def test_interpretation_source_inventory_classifies_sources_without_promoting_drafts() -> None:
|
||||
source_pack = _existing_interpretation_source_pack()
|
||||
inventory = source_pack["interpretation_source_inventory"]
|
||||
|
||||
assert inventory["status"] == "used"
|
||||
assert inventory["summary"]["primary_truth_count"] >= 4
|
||||
assert inventory["summary"]["reference_layer_count"] >= 4
|
||||
assert inventory["summary"]["quarantined_draft_count"] >= 1
|
||||
assert "jyotish-app/interpretation.js" in inventory["layers"]["frontend_interpretation"]["source_refs"]
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-core/resources/qa_rules.md" in inventory["layers"]["qa_governance"]["source_refs"]
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-reader/resources/validation_rules.md" in inventory["layers"]["reader_validation"]["source_refs"]
|
||||
assert "references/yoga_rules.json" in inventory["layers"]["yoga_rules"]["source_refs"]
|
||||
|
||||
draft_refs = inventory["layers"]["quarantined_drafts"]["source_refs"]
|
||||
assert any("docs/research/local_drafts/" in path for path in draft_refs)
|
||||
assert all(path not in source_pack["source_refs"] for path in draft_refs)
|
||||
|
||||
|
||||
def test_career_blocks_label_when_d10_is_missing_but_preserves_jaimini_context() -> None:
|
||||
result = _base_career_result()
|
||||
del result["modules"]["varga_full"]["D10_Dasamsa"]
|
||||
|
||||
@@ -43,6 +43,10 @@ def test_finance_strict_contract_attaches_existing_interpretation_source_pack()
|
||||
assert "yogi_asc_tight_orb_wealth" in source_pack["template_registry"]["template_ids"]
|
||||
assert source_pack["bphs_raman_layer"]["status"] == "available"
|
||||
assert source_pack["frontend_planet_house_details"]["coverage"] == "9_planets_x_12_houses"
|
||||
assert source_pack["interpretation_source_inventory"]["status"] == "used"
|
||||
assert source_pack["frontend_interpretation_layer"]["status"] == "available"
|
||||
assert source_pack["yoga_rule_layer"]["status"] == "available"
|
||||
assert source_pack["qa_governance_layer"]["status"] == "available"
|
||||
|
||||
audit = strict["technique_audit_summary"]
|
||||
assert audit["interpretation_source_pack"]["used"] is True
|
||||
|
||||
@@ -72,6 +72,10 @@ def test_relationship_strict_contract_attaches_existing_interpretation_source_pa
|
||||
assert "p1_p12" in source_pack["frameworks"]
|
||||
assert "house_framework" in source_pack["frameworks"]
|
||||
assert "raman_functional_house_judgment" in source_pack["frameworks"]
|
||||
assert source_pack["interpretation_source_inventory"]["status"] == "used"
|
||||
assert source_pack["qa_governance_layer"]["status"] == "available"
|
||||
assert source_pack["reader_validation_layer"]["status"] == "available"
|
||||
assert "references/open_source_sources/vedic-astro-skills/codex/skills/vedic-core/resources/qa_rules.md" in source_pack["qa_governance_layer"]["source_refs"]
|
||||
|
||||
audit = strict["technique_audit_summary"]
|
||||
assert audit["interpretation_source_pack"]["source"] == "repo_existing_interpretation_sources"
|
||||
|
||||
Reference in New Issue
Block a user