feat(oracle): add dasha closure status board

This commit is contained in:
732642856
2026-06-26 17:56:47 +08:00
parent 82e8d7252a
commit d1e3110e7a
5 changed files with 357 additions and 0 deletions
+11
View File
@@ -214,6 +214,17 @@ python3 scripts/public_benchmark_dashboard.py \
当前看板固定输出 `can_claim_global_first: false`,直到外部 oracle 样本、差异审计和长期公开 benchmark 都达到生产调参标准。
Dasha 外部 oracle 最短闭环状态板用于把“大运外部真值”从 Shadbala 绝对值大包中拆出来,优先推进第一条可验证边界日期:
```bash
python3 scripts/dasha_oracle_closure_status.py \
--oracle-file references/oracle/dasha_shadbala_oracle_cases.json \
--format markdown \
--output docs/benchmark/dasha_external_oracle_closure_status.md
```
当前第一优先级是 `external_template_steve_jobs_dasha_lahiri`。该状态板只要求 `target.vimshottari_start_date` 和外部证据 metadata,不要求同时填完 Shadbala 七曜六分量;这样可以先完成 Dasha oracle 的第一条闭环,再单独推进 Shadbala 绝对值闭环。
Tajika/Sahams 年运系统使用独立的外部 oracle 队列,专门追踪 Varshaphala、太阳回归、Muntha、Year Lord、Mudda Dasha、Sahams 与 Tajika Yogas 的外部验证状态:
```bash
@@ -0,0 +1,56 @@
{
"scope": "dasha_external_oracle_closure_status",
"schema_version": 1,
"summary": {
"dasha_task_count": 3,
"external_verified_dasha_tasks": 0,
"can_claim_dasha_oracle_closure": false,
"production_tuning_allowed": false
},
"first_priority": {
"case_id": "template_steve_jobs_dasha_lahiri",
"capture_id": "external_template_steve_jobs_dasha_lahiri",
"packet_path": "references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri.json",
"birth": {
"year": 1955,
"month": 2,
"day": 24,
"hour": 19,
"minute": 15,
"second": 0,
"lat": 37.7749,
"lon": -122.4194,
"tz": -8
},
"settings": {
"ayanamsa": "lahiri",
"node_mode": "true"
},
"required_target_fields": [
"target.vimshottari_start_date"
],
"missing_fields": [
"metadata.tool_name",
"metadata.tool_version_or_url",
"metadata.capture_date",
"metadata.operator_note",
"metadata.source_artifact",
"target.vimshottari_start_date"
],
"external_sources": [
"JHora Vimshottari Dasha screenshot",
"PyJHora black-box dasha output",
"documented printed/software example"
],
"artifact_policy": "Save redacted screenshots or stdout snippets under references/oracle/artifacts/.",
"apply_command": "python3 scripts/oracle_collection_queue.py --oracle-file references/oracle/dasha_shadbala_oracle_cases.json --apply-packet references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri.json --format json",
"validate_command": "python3 scripts/oracle_collection_queue.py --oracle-file references/oracle/dasha_shadbala_oracle_cases.json --format json > /tmp/jyotish_oracle_queue_filled.json && python3 scripts/oracle_evidence_validator.py --queue-file /tmp/jyotish_oracle_queue_filled.json"
},
"next_actions": [
"Open the first priority packet and fill metadata from an external oracle.",
"Fill target.vimshottari_start_date only from JHora/PyJHora/book example, not from this repository.",
"Set status to external_verified after the artifact path and Dasha target are filled.",
"Apply the packet, regenerate the queue, and run oracle_evidence_validator.py."
],
"boundary": "This board isolates the Dasha shortest path. Shadbala remains a separate absolute-value closure task and must not block collecting the first Dasha boundary date."
}
@@ -0,0 +1,35 @@
# Dasha External Oracle Closure Status
- dasha_task_count: `3`
- external_verified_dasha_tasks: `0`
- can_claim_dasha_oracle_closure: `false`
- production_tuning_allowed: `false`
## First Priority Packet
- case_id: `template_steve_jobs_dasha_lahiri`
- capture_id: `external_template_steve_jobs_dasha_lahiri`
- packet_path: `references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri.json`
- required_target_fields: `target.vimshottari_start_date`
- missing_fields: `metadata.tool_name, metadata.tool_version_or_url, metadata.capture_date, metadata.operator_note, metadata.source_artifact, target.vimshottari_start_date`
## Commands
```bash
python3 scripts/oracle_collection_queue.py --oracle-file references/oracle/dasha_shadbala_oracle_cases.json --apply-packet references/oracle/artifacts/pending_packets/external_template_steve_jobs_dasha_lahiri.json --format json
```
```bash
python3 scripts/oracle_collection_queue.py --oracle-file references/oracle/dasha_shadbala_oracle_cases.json --format json > /tmp/jyotish_oracle_queue_filled.json && python3 scripts/oracle_evidence_validator.py --queue-file /tmp/jyotish_oracle_queue_filled.json
```
## Next Actions
- Open the first priority packet and fill metadata from an external oracle.
- Fill target.vimshottari_start_date only from JHora/PyJHora/book example, not from this repository.
- Set status to external_verified after the artifact path and Dasha target are filled.
- Apply the packet, regenerate the queue, and run oracle_evidence_validator.py.
## Boundary
This board isolates the Dasha shortest path. Shadbala remains a separate absolute-value closure task and must not block collecting the first Dasha boundary date.
+194
View File
@@ -0,0 +1,194 @@
#!/usr/bin/env python3
"""Report the shortest path to the first Dasha external-oracle closure."""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
PYTHON = sys.executable
FIRST_PRIORITY_CASE_ID = "template_steve_jobs_dasha_lahiri"
DASHA_TARGET_FIELD = "target.vimshottari_start_date"
def _run_json(command: list[str]) -> dict[str, Any]:
completed = subprocess.run(
command,
cwd=ROOT,
text=True,
capture_output=True,
timeout=60,
check=False,
)
if completed.returncode != 0:
raise RuntimeError(completed.stderr.strip() or completed.stdout.strip())
return json.loads(completed.stdout)
def _metadata_missing(packet: dict[str, Any]) -> list[str]:
metadata = packet.get("metadata", {})
missing: list[str] = []
for field in packet.get("required_metadata_fields", []):
value = metadata.get(field)
if value is None or value == "" or value == [] or value == {}:
missing.append(f"metadata.{field}")
source_artifact = metadata.get("source_artifact")
if source_artifact in {"references/oracle/artifacts/", "references/oracle/artifacts", "", None}:
if "metadata.source_artifact" not in missing:
missing.append("metadata.source_artifact")
return missing
def _target_missing(packet: dict[str, Any], fields: list[str]) -> list[str]:
placeholders = packet.get("target_placeholders", {})
missing: list[str] = []
for field in fields:
value = placeholders.get(field)
if value is None or value == "" or value == [] or value == {}:
missing.append(field)
return missing
def _apply_command(packet_path: str, oracle_file: str) -> str:
return (
"python3 scripts/oracle_collection_queue.py "
f"--oracle-file {oracle_file} "
f"--apply-packet {packet_path} "
"--format json"
)
def _validate_command(oracle_file: str) -> str:
return (
"python3 scripts/oracle_collection_queue.py "
f"--oracle-file {oracle_file} --format json > /tmp/jyotish_oracle_queue_filled.json && "
"python3 scripts/oracle_evidence_validator.py --queue-file /tmp/jyotish_oracle_queue_filled.json"
)
def build_status(oracle_file: str) -> dict[str, Any]:
queue = _run_json([PYTHON, "scripts/oracle_collection_queue.py", "--oracle-file", oracle_file, "--format", "json"])
dasha_tasks = [
task for task in queue.get("tasks", [])
if DASHA_TARGET_FIELD in task.get("target_fields", [])
]
priority = next((task for task in dasha_tasks if task.get("case_id") == FIRST_PRIORITY_CASE_ID), None)
if priority is None and dasha_tasks:
priority = dasha_tasks[0]
if priority is None:
raise RuntimeError("No Dasha target task found")
packet = priority["evidence_packet"]
capture_id = packet["capture_id"]
packet_path = f"references/oracle/artifacts/pending_packets/{capture_id}.json"
required_target_fields = [DASHA_TARGET_FIELD]
missing_fields = _metadata_missing(packet) + _target_missing(packet, required_target_fields)
external_verified = [
task for task in dasha_tasks
if task.get("status") == "external_verified" and not _target_missing(task.get("evidence_packet", {}), required_target_fields)
]
return {
"scope": "dasha_external_oracle_closure_status",
"schema_version": 1,
"summary": {
"dasha_task_count": len(dasha_tasks),
"external_verified_dasha_tasks": len(external_verified),
"can_claim_dasha_oracle_closure": bool(dasha_tasks) and len(external_verified) == len(dasha_tasks),
"production_tuning_allowed": False,
},
"first_priority": {
"case_id": priority["case_id"],
"capture_id": capture_id,
"packet_path": packet_path,
"birth": priority.get("birth", {}),
"settings": priority.get("settings", {}),
"required_target_fields": required_target_fields,
"missing_fields": missing_fields,
"external_sources": [
"JHora Vimshottari Dasha screenshot",
"PyJHora black-box dasha output",
"documented printed/software example",
],
"artifact_policy": "Save redacted screenshots or stdout snippets under references/oracle/artifacts/.",
"apply_command": _apply_command(packet_path, oracle_file),
"validate_command": _validate_command(oracle_file),
},
"next_actions": [
"Open the first priority packet and fill metadata from an external oracle.",
"Fill target.vimshottari_start_date only from JHora/PyJHora/book example, not from this repository.",
"Set status to external_verified after the artifact path and Dasha target are filled.",
"Apply the packet, regenerate the queue, and run oracle_evidence_validator.py.",
],
"boundary": (
"This board isolates the Dasha shortest path. Shadbala remains a separate absolute-value "
"closure task and must not block collecting the first Dasha boundary date."
),
}
def render_markdown(report: dict[str, Any]) -> str:
summary = report["summary"]
first = report["first_priority"]
lines = [
"# Dasha External Oracle Closure Status",
"",
f"- dasha_task_count: `{summary['dasha_task_count']}`",
f"- external_verified_dasha_tasks: `{summary['external_verified_dasha_tasks']}`",
f"- can_claim_dasha_oracle_closure: `{str(summary['can_claim_dasha_oracle_closure']).lower()}`",
f"- production_tuning_allowed: `{str(summary['production_tuning_allowed']).lower()}`",
"",
"## First Priority Packet",
"",
f"- case_id: `{first['case_id']}`",
f"- capture_id: `{first['capture_id']}`",
f"- packet_path: `{first['packet_path']}`",
f"- required_target_fields: `{', '.join(first['required_target_fields'])}`",
f"- missing_fields: `{', '.join(first['missing_fields'])}`",
"",
"## Commands",
"",
"```bash",
first["apply_command"],
"```",
"",
"```bash",
first["validate_command"],
"```",
"",
"## Next Actions",
"",
]
lines.extend(f"- {item}" for item in report["next_actions"])
lines.extend(["", "## Boundary", "", report["boundary"], ""])
return "\n".join(lines)
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Report Dasha external oracle closure status")
parser.add_argument("--oracle-file", default="references/oracle/dasha_shadbala_oracle_cases.json")
parser.add_argument("--format", choices=["json", "markdown"], default="json")
parser.add_argument("--output", help="Optional output path")
return parser.parse_args(argv)
def main(argv: list[str] | None = None) -> int:
args = parse_args(argv)
report = build_status(args.oracle_file)
text = json.dumps(report, ensure_ascii=False, indent=2) if args.format == "json" else render_markdown(report)
if args.output:
output = Path(args.output)
output.parent.mkdir(parents=True, exist_ok=True)
output.write_text(text, encoding="utf-8")
print(text)
return 0
if __name__ == "__main__":
raise SystemExit(main())
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
"""Tests for the shortest Dasha external-oracle closure status board."""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def run_status(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[
sys.executable,
"scripts/dasha_oracle_closure_status.py",
"--oracle-file",
"references/oracle/dasha_shadbala_oracle_cases.json",
*args,
],
cwd=ROOT,
text=True,
capture_output=True,
timeout=60,
check=False,
)
def test_dasha_oracle_closure_status_identifies_first_shortest_packet() -> None:
completed = run_status("--format", "json")
assert completed.returncode == 0, completed.stderr or completed.stdout
report = json.loads(completed.stdout)
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"]["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"]["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"]["apply_command"]
assert report["first_priority"]["validate_command"]
def test_dasha_oracle_closure_status_markdown_can_be_written(tmp_path: Path) -> None:
output = tmp_path / "dasha_status.md"
completed = run_status("--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 "# 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 "target.vimshottari_start_date" in markdown