Consolidate oracle benchmark inventory

This commit is contained in:
732642856
2026-06-28 15:45:31 +08:00
parent 73d89586ca
commit 4439deeeb9
29 changed files with 1642 additions and 23 deletions
+9
View File
@@ -766,6 +766,15 @@ def test_fragment_audit_blocks_registry_surface_drift() -> None:
assert not any(problem['kind'] == 'missing_output_path' for problem in result['problems'])
def test_fragment_audit_accepts_script_symbol_output_paths() -> None:
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'scripts'))
from audit_fragments import output_path_exists
assert output_path_exists("scripts/yoga_engine.py:is_badhaka")[0] is True
assert output_path_exists("scripts/prashna.py:calc_sphutas")[0] is True
assert output_path_exists("scripts/tajika.py.graha_yuddha")[0] is True
def _sample_planets() -> dict:
return {
'Sun': {'lon': 80.0},
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env python3
"""Tests for the oracle/benchmark single-truth inventory."""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def run_inventory(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[sys.executable, "scripts/oracle_benchmark_inventory.py", *args],
cwd=ROOT,
text=True,
capture_output=True,
timeout=60,
check=False,
)
def test_oracle_benchmark_inventory_maps_high_value_assets() -> None:
completed = run_inventory("--format", "json")
assert completed.returncode == 0, completed.stderr or completed.stdout
report = json.loads(completed.stdout)
assert report["scope"] == "oracle_benchmark_single_truth_inventory"
assert report["schema_version"] == 1
assert report["summary"]["oracle_registry_count"] >= 3
assert report["summary"]["oracle_case_count"] >= 9
assert report["summary"]["pending_packet_count"] >= 18
assert report["summary"]["pyjhora_artifact_count"] >= 8
assert report["files"]["pyjhora_manifest"]["path"].endswith(
"references/oracle/artifacts/pyjhora_oracle_artifact_manifest.json"
)
registry_paths = {entry["path"] for entry in report["files"]["oracle_registries"]}
assert "references/oracle/dasha_shadbala_oracle_cases.json" in registry_paths
assert "references/oracle/tajika_annual_oracle_cases.json" in registry_paths
case_paths = {entry["path"] for entry in report["files"]["oracle_cases"]}
assert "references/oracle/cases/steve_jobs.json" in case_paths
assert "references/oracle/cases/marilyn_monroe.json" in case_paths
pending_paths = {entry["path"] for entry in report["files"]["pending_packets"]}
assert (
"references/oracle/artifacts/pending_packets/"
"external_template_steve_jobs_varshaphala_1984_lahiri.json"
) in pending_paths
assert (
"references/oracle/artifacts/pending_packets/"
"external_template_historical_dst_london_varshaphala_1943_lahiri.json"
) in pending_paths
assert report["fronts"]["dasha"]["pending_packet_count"] >= 3
assert report["fronts"]["shadbala"]["pending_packet_count"] >= 4
assert report["fronts"]["tajika_sahams"]["pending_packet_count"] >= 5
assert "external oracle evidence only" in report["boundary"]
def test_oracle_benchmark_inventory_outputs_markdown_and_can_write_file(tmp_path: Path) -> None:
output = tmp_path / "oracle_benchmark_inventory.md"
completed = run_inventory("--format", "markdown", "--output", str(output))
assert completed.returncode == 0, completed.stderr or completed.stdout
assert output.exists()
markdown = output.read_text(encoding="utf-8")
assert "# Oracle Benchmark Single-Truth Inventory" in markdown
assert "Oracle Registries" in markdown
assert "Pending Evidence Packets" in markdown
assert "PyJHora Black-Box Assets" in markdown
assert "Next Actions" in markdown
+24 -15
View File
@@ -53,27 +53,28 @@ def test_oracle_collection_queue_outputs_executable_json_tasks() -> None:
assert report["scope"] == "external_oracle_collection_queue"
assert report["summary"]["total_tasks"] == 5
assert report["summary"]["ready_for_calibration"] == 0
assert report["summary"]["by_status"]["template_only"] == 5
assert report["summary"]["ready_for_calibration"] == 4
assert report["summary"]["ready_for_collection"] == 1
assert report["summary"]["by_status"]["external_verified"] == 5
assert report["summary"]["production_tuning_allowed"] is False
first = report["tasks"][0]
assert first["case_id"] == "template_user_REDACTED_YEAR_moon_longitude_lahiri"
assert first["status"] == "template_only"
assert first["ready_for_collection"] is True
assert first["ready_for_calibration"] is False
assert "target.moon_sidereal_longitude_deg" in first["missing_target_fields"]
assert first["status"] == "external_verified"
assert first["ready_for_collection"] is False
assert first["ready_for_calibration"] is True
assert first["missing_target_fields"] == []
assert "longitude" in first["target_modules"]
assert "dasha" in first["target_modules"]
assert "shadbala" in first["target_modules"]
assert any("JHora" in source for source in first["preferred_sources"])
assert any("VedAstro" in source for source in first["preferred_sources"])
assert first["promotion_criteria"]
assert first["do_not_tune_production"] is True
assert first["do_not_tune_production"] is False
packet = first["evidence_packet"]
assert packet["capture_id"] == "external_template_user_REDACTED_YEAR_moon_longitude_lahiri"
assert packet["status"] == "draft"
assert packet["status"] == "external_verified"
assert packet["case_id"] == first["case_id"]
assert packet["birth"] == first["birth"]
assert packet["settings"] == first["settings"]
@@ -82,10 +83,17 @@ def test_oracle_collection_queue_outputs_executable_json_tasks() -> None:
assert "capture_date" in packet["required_metadata_fields"]
assert "source_artifact" in packet["required_metadata_fields"]
assert "target.moon_sidereal_longitude_deg" in packet["target_placeholders"]
assert packet["target_placeholders"]["target.moon_sidereal_longitude_deg"] is None
assert packet["target_placeholders"]["target.moon_sidereal_longitude_deg"] == 311.774424
assert packet["integrity_checks"]["must_not_come_from_local_engine"] is True
assert packet["integrity_checks"]["requires_external_artifact"] is True
blocked = next(task for task in report["tasks"] if task["case_id"] == "template_historical_epoch_lahiri")
assert blocked["status"] == "external_verified"
assert blocked["ready_for_collection"] is True
assert blocked["ready_for_calibration"] is False
assert blocked["do_not_tune_production"] is True
assert blocked["missing_target_fields"] == ["target.sun_sidereal_longitude_deg"]
def test_oracle_collection_queue_outputs_markdown_table() -> None:
completed = run_queue("--format", "markdown")
@@ -95,7 +103,8 @@ def test_oracle_collection_queue_outputs_markdown_table() -> None:
assert "# Dasha/Shadbala External Oracle Collection Queue" in markdown
assert "| task_id | case_id | status | missing fields | preferred sources |" in markdown
assert "collect_template_user_REDACTED_YEAR_moon_longitude_lahiri" in markdown
assert "`template_only`" in markdown
assert "`external_verified`" in markdown
assert "target.sun_sidereal_longitude_deg" in markdown
assert "production_tuning_allowed: `false`" in markdown
assert "Evidence Packet Fields" in markdown
assert "tool_name" in markdown
@@ -113,11 +122,11 @@ def test_oracle_collection_queue_can_write_draft_evidence_packets(tmp_path: Path
assert packet_path.exists()
packet = json.loads(packet_path.read_text(encoding="utf-8"))
assert packet["capture_id"] == "external_template_steve_jobs_dasha_lahiri"
assert packet["status"] == "draft"
assert packet["status"] == "external_verified"
assert packet["case_id"] == "template_steve_jobs_dasha_lahiri"
assert packet["metadata"]["source_artifact"] == "references/oracle/artifacts/"
assert packet["metadata"]["tool_name"] == ""
assert packet["target_placeholders"]["target.vimshottari_start_date"] is None
assert packet["metadata"]["source_artifact"].startswith("references/oracle/artifacts/")
assert packet["metadata"]["tool_name"] == "PyJHora"
assert packet["target_placeholders"]["target.vimshottari_start_date"] == "1939-03-22"
shadbala = packet["target_placeholders"]["target.shadbala_components"]
assert set(shadbala) == {"Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn"}
assert set(shadbala["Sun"]) == {"sthana", "dig", "kala", "chesta", "naisargika", "drik", "total_rupa"}
@@ -282,7 +291,7 @@ def test_oracle_collection_queue_preserves_external_verified_evidence(tmp_path:
assert first["ready_for_collection"] is False
assert first["ready_for_calibration"] is True
assert first["do_not_tune_production"] is False
assert report["summary"]["ready_for_calibration"] == 1
assert report["summary"]["ready_for_calibration"] == 4
assert report["summary"]["production_tuning_allowed"] is False
packet = first["evidence_packet"]