feat(oracle): prepare first capture packets
This commit is contained in:
@@ -118,6 +118,9 @@ def test_oracle_collection_queue_can_write_draft_evidence_packets(tmp_path: Path
|
||||
assert packet["metadata"]["source_artifact"] == "references/oracle/artifacts/"
|
||||
assert packet["metadata"]["tool_name"] == ""
|
||||
assert packet["target_placeholders"]["target.vimshottari_start_date"] is None
|
||||
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"}
|
||||
assert packet["integrity_checks"]["must_not_come_from_local_engine"] is True
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Tests for preparing first external oracle capture packets."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_prepare_oracle_capture_packets_writes_packets_manifest_and_next_steps(tmp_path: Path) -> None:
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/prepare_oracle_capture_packets.py",
|
||||
"--oracle-file",
|
||||
"references/oracle/dasha_shadbala_oracle_cases.json",
|
||||
"--output-dir",
|
||||
str(tmp_path),
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=30,
|
||||
check=False,
|
||||
)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["scope"] == "external_oracle_capture_packet_preparation"
|
||||
assert report["packet_count"] == 5
|
||||
assert report["validator_summary"]["valid_packets"] == 0
|
||||
assert report["validator_summary"]["ready_for_calibration"] == 0
|
||||
assert report["first_priority_packet"].endswith("external_template_steve_jobs_dasha_lahiri.json")
|
||||
|
||||
packet = tmp_path / "external_template_steve_jobs_dasha_lahiri.json"
|
||||
manifest = tmp_path / "capture_manifest.json"
|
||||
next_steps = tmp_path / "OPERATOR_NEXT_STEPS.md"
|
||||
assert packet.exists()
|
||||
assert manifest.exists()
|
||||
assert next_steps.exists()
|
||||
|
||||
packet_data = json.loads(packet.read_text(encoding="utf-8"))
|
||||
assert packet_data["status"] == "draft"
|
||||
assert packet_data["metadata"]["source_artifact"] == "references/oracle/artifacts/"
|
||||
assert packet_data["target_placeholders"]["target.vimshottari_start_date"] is None
|
||||
|
||||
manifest_data = json.loads(manifest.read_text(encoding="utf-8"))
|
||||
assert manifest_data["scope"] == "external_oracle_capture_packet_manifest"
|
||||
assert manifest_data["packet_count"] == 5
|
||||
assert packet.name in manifest_data["packets"]
|
||||
|
||||
guide = next_steps.read_text(encoding="utf-8")
|
||||
assert "external_template_steve_jobs_dasha_lahiri.json" in guide
|
||||
assert "oracle_evidence_validator.py" in guide
|
||||
assert "--apply-packet" in guide
|
||||
assert "不得把本仓库本地输出当作 external oracle" in guide
|
||||
Reference in New Issue
Block a user