Materialize Tajika annual first-priority packet

This commit is contained in:
732642856
2026-06-27 14:44:22 +08:00
parent 00db31bc20
commit 16a4c81746
3 changed files with 87 additions and 1 deletions
@@ -0,0 +1,65 @@
{
"capture_id": "external_template_einstein_varshaphala_1905_lahiri",
"status": "draft",
"case_id": "template_einstein_varshaphala_1905_lahiri",
"birth": {
"year": 1879,
"month": 3,
"day": 14,
"hour": 11,
"minute": 30,
"second": 0,
"lat": 48.3984,
"lon": 9.9916,
"tz": 0.883333
},
"settings": {
"ayanamsa": "lahiri",
"node_mode": "mean",
"annual_system": "varshaphala",
"target_year": 1905
},
"required_metadata_fields": [
"tool_name",
"tool_version_or_url",
"capture_date",
"source_artifact",
"ayanamsa",
"node_mode",
"timezone",
"annual_system",
"target_year",
"operator_note"
],
"metadata": {
"tool_name": "",
"tool_version_or_url": "",
"capture_date": "",
"source_artifact": "references/oracle/artifacts/",
"ayanamsa": "lahiri",
"node_mode": "mean",
"timezone": 0.883333,
"annual_system": "varshaphala",
"target_year": 1905,
"operator_note": ""
},
"target_placeholders": {
"target.solar_return_datetime": null,
"target.varsha_lagna_deg": null,
"target.muntha_sign": null,
"target.year_lord": null,
"target.mudda_dasha_first_lord": null,
"target.sahams.punya_saham": null,
"target.sahams.rajya_saham": null,
"target.sahams.vivah_saham": null,
"target.tajika_yogas": null,
"target.source_artifact": null
},
"integrity_checks": {
"must_not_come_from_local_engine": true,
"requires_external_artifact": true,
"requires_status_external_verified_before_calibration": true,
"requires_solar_return_convention": true
},
"promotion_status_after_fill": "external_verified"
}
+16 -1
View File
@@ -27,6 +27,7 @@ REQUIRED_TARGET_FIELDS = [
"target.tajika_yogas",
"target.source_artifact",
]
PENDING_PACKET_DIR = "references/oracle/artifacts/pending_packets"
def _run_json(command: list[str]) -> dict[str, Any]:
@@ -128,7 +129,21 @@ def _validate_command(oracle_file: str) -> str:
)
def _ensure_pending_packets(oracle_file: str) -> None:
_run_json([
PYTHON,
"scripts/tajika_annual_oracle_queue.py",
"--oracle-file",
oracle_file,
"--write-packet-dir",
PENDING_PACKET_DIR,
"--format",
"json",
])
def build_status(oracle_file: str) -> dict[str, Any]:
_ensure_pending_packets(oracle_file)
queue = _run_json([PYTHON, "scripts/tajika_annual_oracle_queue.py", "--oracle-file", oracle_file, "--format", "json"])
annual_tasks = queue.get("tasks", [])
priority = next((task for task in annual_tasks if not task.get("ready_for_calibration")), None)
@@ -141,7 +156,7 @@ def build_status(oracle_file: str) -> dict[str, Any]:
queue_packet = priority["evidence_packet"]
capture_id = queue_packet["capture_id"]
packet_path = f"references/oracle/artifacts/pending_packets/{capture_id}.json"
packet_path = f"{PENDING_PACKET_DIR}/{capture_id}.json"
template_path = FIRST_PRIORITY_TEMPLATE_PATH if priority["case_id"] == FIRST_PRIORITY_CASE_ID else packet_path
template_file = ROOT / template_path
if template_file.exists():
@@ -64,6 +64,12 @@ def test_tajika_annual_closure_status_identifies_first_annual_packet() -> None:
assert report["first_priority"]["manual_fill_plan"]["status_value"] == "external_verified"
assert report["first_priority"]["manual_fill_plan"]["manual_entry_count"] == 15
assert report["first_priority"]["validate_command"]
packet_path = ROOT / report["first_priority"]["packet_path"]
assert packet_path.exists(), report["first_priority"]["packet_path"]
packet = json.loads(packet_path.read_text(encoding="utf-8"))
assert packet["capture_id"] == "external_template_einstein_varshaphala_1905_lahiri"
assert packet["status"] == "draft"
assert packet["target_placeholders"]["target.solar_return_datetime"] is None
def test_tajika_annual_closure_status_markdown_can_be_written(tmp_path: Path) -> None: