feat(skill): validate dasha oracle evidence
This commit is contained in:
@@ -37,17 +37,17 @@ def test_dasha_oracle_closure_status_identifies_first_shortest_packet() -> None:
|
||||
assert report["scope"] == "dasha_external_oracle_closure_status"
|
||||
assert report["schema_version"] == 1
|
||||
assert report["summary"]["dasha_task_count"] == 3
|
||||
assert report["summary"]["external_verified_dasha_tasks"] == 0
|
||||
assert report["summary"]["external_verified_dasha_tasks"] == 1
|
||||
assert report["summary"]["can_claim_dasha_oracle_closure"] is False
|
||||
assert report["first_priority"]["case_id"] == "template_steve_jobs_dasha_lahiri"
|
||||
assert report["first_priority"]["capture_id"] == "external_template_steve_jobs_dasha_lahiri"
|
||||
assert report["first_priority"]["case_id"] == "template_user_REDACTED_YEAR_moon_longitude_lahiri"
|
||||
assert report["first_priority"]["capture_id"] == "external_template_user_REDACTED_YEAR_moon_longitude_lahiri"
|
||||
assert report["first_priority"]["required_target_fields"] == ["target.vimshottari_start_date"]
|
||||
assert "metadata.tool_name" in report["first_priority"]["missing_fields"]
|
||||
assert "target.vimshottari_start_date" in report["first_priority"]["missing_fields"]
|
||||
assert report["first_priority"]["missing_groups"]["metadata"]["count"] == 5
|
||||
assert report["first_priority"]["missing_groups"]["target"]["count"] == 1
|
||||
assert report["first_priority"]["prefilled_fields"]["metadata"]["ayanamsa"] == "Lahiri"
|
||||
assert report["first_priority"]["prefilled_fields"]["metadata"]["timezone"] == "UTC-08:00"
|
||||
assert report["first_priority"]["prefilled_fields"]["metadata"]["ayanamsa"] == "lahiri"
|
||||
assert report["first_priority"]["prefilled_fields"]["metadata"]["timezone"] == 8
|
||||
assert report["first_priority"]["manual_fill_plan"]["status_value"] == "external_verified"
|
||||
assert report["first_priority"]["manual_fill_plan"]["manual_entry_count"] == 6
|
||||
assert report["first_priority"]["apply_command"]
|
||||
@@ -63,8 +63,57 @@ def test_dasha_oracle_closure_status_markdown_can_be_written(tmp_path: Path) ->
|
||||
markdown = output.read_text(encoding="utf-8")
|
||||
assert "# Dasha External Oracle Closure Status" in markdown
|
||||
assert "can_claim_dasha_oracle_closure: `false`" in markdown
|
||||
assert "external_template_steve_jobs_dasha_lahiri" in markdown
|
||||
assert "external_template_user_REDACTED_YEAR_moon_longitude_lahiri" in markdown
|
||||
assert "target.vimshottari_start_date" in markdown
|
||||
assert "## Missing Summary" in markdown
|
||||
assert "## Prefilled Fields" in markdown
|
||||
assert "## Manual Fill Plan" in markdown
|
||||
|
||||
|
||||
def test_dasha_oracle_closure_status_advances_after_first_packet_is_filled(tmp_path: Path) -> None:
|
||||
oracle_file = tmp_path / "oracle_cases.json"
|
||||
oracle_file.write_text(
|
||||
(ROOT / "references/oracle/dasha_shadbala_oracle_cases.json").read_text(encoding="utf-8"),
|
||||
encoding="utf-8",
|
||||
)
|
||||
packet = ROOT / "references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri_pyjhora_20260627.json"
|
||||
apply_completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/oracle_collection_queue.py",
|
||||
"--oracle-file",
|
||||
str(oracle_file),
|
||||
"--apply-packet",
|
||||
str(packet),
|
||||
"--format",
|
||||
"json",
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=60,
|
||||
check=False,
|
||||
)
|
||||
assert apply_completed.returncode == 0, apply_completed.stderr or apply_completed.stdout
|
||||
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/dasha_oracle_closure_status.py",
|
||||
"--oracle-file",
|
||||
str(oracle_file),
|
||||
"--format",
|
||||
"json",
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=60,
|
||||
check=False,
|
||||
)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["summary"]["external_verified_dasha_tasks"] == 1
|
||||
assert report["first_priority"]["case_id"] != "template_steve_jobs_dasha_lahiri"
|
||||
assert report["first_priority"]["missing_fields"]
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Tests for Dasha-only external oracle evidence validation."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
PYJHORA_PACKET = ROOT / "references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri_pyjhora_20260627.json"
|
||||
|
||||
|
||||
def _run_validator(queue_file: Path) -> subprocess.CompletedProcess[str]:
|
||||
return subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/dasha_oracle_evidence_validator.py",
|
||||
"--queue-file",
|
||||
str(queue_file),
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=60,
|
||||
check=False,
|
||||
)
|
||||
|
||||
|
||||
def _queue_from_packet(tmp_path: Path, packet: dict) -> Path:
|
||||
queue = {
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "collect_template_steve_jobs_dasha_lahiri",
|
||||
"case_id": "template_steve_jobs_dasha_lahiri",
|
||||
"status": packet.get("status", "draft"),
|
||||
"target_fields": ["target.vimshottari_start_date", "target.shadbala_components"],
|
||||
"evidence_packet": packet,
|
||||
}
|
||||
]
|
||||
}
|
||||
queue_file = tmp_path / "queue.json"
|
||||
queue_file.write_text(json.dumps(queue, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
return queue_file
|
||||
|
||||
|
||||
def test_dasha_validator_accepts_dasha_only_external_pyjhora_packet(tmp_path: Path) -> None:
|
||||
packet = json.loads(PYJHORA_PACKET.read_text(encoding="utf-8"))
|
||||
queue_file = _queue_from_packet(tmp_path, packet)
|
||||
|
||||
completed = _run_validator(queue_file)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["scope"] == "dasha_external_oracle_evidence_validation"
|
||||
assert report["summary"]["total_dasha_packets"] == 1
|
||||
assert report["summary"]["valid_dasha_packets"] == 1
|
||||
assert report["summary"]["ready_for_dasha_calibration"] == 1
|
||||
assert report["summary"]["all_dasha_packets_external_verified"] is True
|
||||
assert report["packets"][0]["valid"] is True
|
||||
assert report["packets"][0]["problems"] == []
|
||||
|
||||
|
||||
def test_dasha_validator_rejects_local_engine_dasha_artifact(tmp_path: Path) -> None:
|
||||
packet = json.loads(PYJHORA_PACKET.read_text(encoding="utf-8"))
|
||||
packet["metadata"]["tool_name"] = "local engine"
|
||||
packet["metadata"]["operator_note"] = "Generated from scripts/jyotish_engine.py"
|
||||
queue_file = _queue_from_packet(tmp_path, packet)
|
||||
|
||||
completed = _run_validator(queue_file)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["summary"]["valid_dasha_packets"] == 0
|
||||
assert report["summary"]["ready_for_dasha_calibration"] == 0
|
||||
assert report["packets"][0]["valid"] is False
|
||||
assert "local_engine_artifact_rejected" in report["packets"][0]["problems"]
|
||||
|
||||
|
||||
def test_dasha_validator_rejects_missing_dasha_date(tmp_path: Path) -> None:
|
||||
packet = json.loads(PYJHORA_PACKET.read_text(encoding="utf-8"))
|
||||
packet["target_placeholders"]["target.vimshottari_start_date"] = ""
|
||||
queue_file = _queue_from_packet(tmp_path, packet)
|
||||
|
||||
completed = _run_validator(queue_file)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["summary"]["valid_dasha_packets"] == 0
|
||||
assert "placeholder_unfilled:target.vimshottari_start_date" in report["packets"][0]["problems"]
|
||||
@@ -39,13 +39,14 @@ def test_oracle_closure_master_dashboard_aggregates_all_hard_fronts() -> None:
|
||||
assert report["scope"] == "jyotish_external_oracle_closure_master_dashboard"
|
||||
assert report["schema_version"] == 1
|
||||
assert report["summary"]["total_tasks"] == 12
|
||||
assert report["summary"]["external_verified_tasks"] == 0
|
||||
assert report["summary"]["open_tasks"] == 12
|
||||
assert report["summary"]["external_verified_tasks"] == 1
|
||||
assert report["summary"]["open_tasks"] == 11
|
||||
assert report["summary"]["can_claim_global_oracle_closure"] is False
|
||||
assert report["fronts"]["dasha"]["task_count"] == 3
|
||||
assert report["fronts"]["shadbala"]["task_count"] == 4
|
||||
assert report["fronts"]["tajika_sahams"]["task_count"] == 5
|
||||
assert report["fronts"]["dasha"]["first_priority"]["case_id"] == "template_steve_jobs_dasha_lahiri"
|
||||
assert report["fronts"]["dasha"]["external_verified_tasks"] == 1
|
||||
assert report["fronts"]["dasha"]["first_priority"]["case_id"] == "template_user_REDACTED_YEAR_moon_longitude_lahiri"
|
||||
assert report["fronts"]["shadbala"]["first_priority"]["case_id"] == "template_redacted_place_shadbala_raman"
|
||||
assert report["fronts"]["tajika_sahams"]["first_priority"]["case_id"] == "template_steve_jobs_varshaphala_1984_lahiri"
|
||||
assert report["fronts"]["dasha"]["first_priority"]["missing_groups"]["metadata"]["count"] == 5
|
||||
@@ -69,7 +70,7 @@ def test_oracle_closure_master_dashboard_markdown_can_be_written(tmp_path: Path)
|
||||
assert "# Jyotish External Oracle Closure Master Dashboard" in markdown
|
||||
assert "total_tasks: `12`" in markdown
|
||||
assert "can_claim_global_oracle_closure: `false`" in markdown
|
||||
assert "template_steve_jobs_dasha_lahiri" in markdown
|
||||
assert "template_user_REDACTED_YEAR_moon_longitude_lahiri" in markdown
|
||||
assert "template_redacted_place_shadbala_raman" in markdown
|
||||
assert "template_steve_jobs_varshaphala_1984_lahiri" in markdown
|
||||
assert "manual entries" in markdown
|
||||
|
||||
@@ -42,8 +42,10 @@ def test_public_benchmark_dashboard_outputs_stable_json_summary() -> None:
|
||||
assert report["oracle_readiness"]["valid_packets"] == 0
|
||||
assert report["oracle_readiness"]["ready_for_calibration"] == 0
|
||||
assert report["oracle_readiness"]["production_tuning_allowed"] is False
|
||||
assert report["dasha_oracle_readiness"]["valid_dasha_packets"] == 1
|
||||
assert report["dasha_oracle_readiness"]["total_dasha_packets"] == 3
|
||||
assert report["boundary_audit"]["production_tuning_recommended"] is False
|
||||
assert "Dasha/Shadbala" in report["global_first_gap"]
|
||||
assert "Dasha-only external oracle readiness is 1/3" in report["global_first_gap"]
|
||||
assert report["public_claim"]["can_claim_global_first"] is False
|
||||
assert report["public_claim"]["reason"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user