129 lines
5.0 KiB
Python
129 lines
5.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Tests for the skill-level gap truth audit."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import scripts.skill_gap_truth_audit as audit
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
REGISTRY = ROOT / "references" / "skill_gap_truth_registry.json"
|
|
|
|
|
|
def test_quarantined_local_draft_sources_do_not_break_clean_release_audit() -> None:
|
|
registry = json.loads(REGISTRY.read_text(encoding="utf-8"))
|
|
problems = audit._validate_registry(registry)
|
|
|
|
assert not any(problem.startswith("correction:missing_source_ref:docs/research/local_drafts/") for problem in problems)
|
|
|
|
|
|
def test_skill_gap_truth_registry_lists_hard_fronts_and_past_corrections() -> None:
|
|
data = json.loads(REGISTRY.read_text(encoding="utf-8"))
|
|
|
|
assert data["scope"] == "jyotish_skill_gap_truth_registry"
|
|
assert data["public_claim_rules"]["can_claim_global_first"] is False
|
|
assert data["public_claim_rules"]["can_claim_all_skills_complete"] is False
|
|
|
|
hard_fronts = data["hard_fronts"]
|
|
required_fronts = {
|
|
"dasha_external_oracle",
|
|
"shadbala_external_absolute_values",
|
|
"tajika_sahams_annual_closure",
|
|
"article_template_industrialization",
|
|
"long_term_public_benchmark",
|
|
}
|
|
assert required_fronts <= set(hard_fronts)
|
|
for front_id in required_fronts:
|
|
front = hard_fronts[front_id]
|
|
assert front["status"] in {
|
|
"blocked_external_evidence",
|
|
"active_gap",
|
|
"active_partial_external_evidence",
|
|
"active_target_set_closed",
|
|
}
|
|
assert front["priority"] in {"P0", "P1", "P2"}
|
|
assert front["completion_standard"]
|
|
assert front["forbidden_claims"]
|
|
assert front["next_actions"]
|
|
|
|
corrections = data["past_case_analysis_corrections"]
|
|
correction_ids = {item["id"] for item in corrections}
|
|
assert "ashtakoot_not_all_zero" in correction_ids
|
|
assert "panchanga_not_empty" in correction_ids
|
|
assert "covered_is_not_complete" in correction_ids
|
|
assert "single_factor_reading_risk" in correction_ids
|
|
|
|
|
|
def test_skill_gap_truth_audit_outputs_current_truth_boundary() -> None:
|
|
completed = subprocess.run(
|
|
[sys.executable, "scripts/skill_gap_truth_audit.py", "--format", "json"],
|
|
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"] == "jyotish_skill_gap_truth_audit"
|
|
assert report["valid"] is True
|
|
assert report["summary"]["technique_count"] >= 79
|
|
assert report["summary"]["capability_valid"] is True
|
|
assert report["summary"]["hard_front_count"] >= 5
|
|
assert report["summary"]["pyjhora_artifact_count"] >= 8
|
|
assert report["summary"]["pyjhora_packet_count"] >= 6
|
|
assert report["public_claim"]["can_claim_global_first"] is False
|
|
assert report["public_claim"]["can_claim_all_skills_complete"] is False
|
|
assert report["public_claim"]["can_claim_perfect_accuracy"] is False
|
|
assert "Dasha" in report["must_not_overclaim"][0]
|
|
assert report["oracle_closure"]["summary"]["can_claim_global_oracle_closure"] is False
|
|
assert report["pyjhora_blackbox_assets"]["fronts"]["tajika_sahams"]["artifact_count"] >= 1
|
|
assert report["remaining_hard_fronts"][0]["id"] == "dasha_external_oracle"
|
|
assert "covered_is_not_complete" in report["past_correction_ids"]
|
|
|
|
|
|
def test_skill_gap_truth_audit_markdown_is_human_readable() -> None:
|
|
completed = subprocess.run(
|
|
[sys.executable, "scripts/skill_gap_truth_audit.py", "--format", "markdown"],
|
|
cwd=ROOT,
|
|
text=True,
|
|
capture_output=True,
|
|
timeout=120,
|
|
check=False,
|
|
)
|
|
|
|
assert completed.returncode == 0, completed.stderr or completed.stdout
|
|
markdown = completed.stdout
|
|
assert "# Jyotish Skill Gap Truth Audit" in markdown
|
|
assert "can_claim_global_first: `false`" in markdown
|
|
assert "PyJHora Black-Box Assets" in markdown
|
|
assert "Dasha external oracle" in markdown
|
|
assert "Past Corrections" in markdown
|
|
|
|
|
|
def test_transit_reference_blocks_single_factor_override_claims() -> None:
|
|
transit = (ROOT / "references" / "transit-comprehensive-guide.md").read_text(encoding="utf-8")
|
|
kantaka = (ROOT / "references" / "navatara-kantaka-shani-guide.md").read_text(encoding="utf-8")
|
|
combined = transit + "\n" + kantaka
|
|
|
|
assert "Natal Promise First Protocol" in transit
|
|
assert "本命盘决定事件可发生的范围" in transit
|
|
assert "Dasha 决定主题是否进入兑现期" in transit
|
|
assert "Transit 主要负责触发" in transit
|
|
assert "是否获得奖项/地位必须再看10宫、11宫、D10、Dasha、AV与现实领域证据" in kantaka
|
|
|
|
forbidden_overclaims = [
|
|
"一票否决",
|
|
"完全反转",
|
|
"免疫纯粹灾难",
|
|
"土星过4宫必主",
|
|
]
|
|
for phrase in forbidden_overclaims:
|
|
assert phrase not in combined
|