feat: queue VedAstro rectification evidence packets
* feat: queue VedAstro rectification evidence packets * fix: make report artifacts portable and normalize d11 * test: use portable runtime smoke temp directory * test: make frontend smoke temp paths portable
This commit is contained in:
@@ -10,6 +10,7 @@ import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
@@ -18,7 +19,7 @@ from typing import Any
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
APP = ROOT / "jyotish-app"
|
||||
API_SERVER = ROOT / "scripts" / "jyotish_api_server.py"
|
||||
TMP = Path(os.environ.get("TMPDIR", "/private/tmp"))
|
||||
TMP = Path(os.environ.get("TMPDIR") or tempfile.gettempdir())
|
||||
SYSTEM_CHROME = Path("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
|
||||
OFFLINE_CONSOLE_ERROR_MARKERS = [
|
||||
"ERR_CONNECTION_REFUSED",
|
||||
|
||||
@@ -8,6 +8,7 @@ import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
@@ -16,7 +17,7 @@ from typing import Any
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
APP = ROOT / "jyotish-app"
|
||||
API_SERVER = ROOT / "scripts" / "jyotish_api_server.py"
|
||||
TMP = Path(os.environ.get("TMPDIR", "/private/tmp"))
|
||||
TMP = Path(os.environ.get("TMPDIR") or tempfile.gettempdir())
|
||||
|
||||
|
||||
def run(cmd: list[str], *, cwd: Path = ROOT, timeout: int = 12, check: bool = True) -> subprocess.CompletedProcess[str]:
|
||||
|
||||
@@ -404,3 +404,40 @@ def test_gochara_conflict_downgrades_without_verified_timing_claim_red() -> None
|
||||
assert top["confidence_cap"] == "low"
|
||||
assert "gochara_transit" in top["downgrade_reasons"]
|
||||
assert scored["timing_claim_status"] == "exploratory_unvalidated"
|
||||
|
||||
|
||||
def test_high_rigor_event_rectification_queues_vedastro_packet(monkeypatch) -> None:
|
||||
monkeypatch.setattr(
|
||||
"scripts.rectification_three_engine_packet._enqueue_vedastro_gateway_job",
|
||||
lambda *_args, **_kwargs: {
|
||||
"scope": "vedastro_gateway_job_receipt",
|
||||
"status": "queued",
|
||||
"job_id": "vgw_rectification",
|
||||
"poll_path": "/api/vedastro_gateway/jobs/vgw_rectification",
|
||||
"raw_response_archive": {
|
||||
"status": "pending",
|
||||
"official_raw_response_available": False,
|
||||
},
|
||||
"boundary": "VedAstro raw response remains server-side; this receipt never returns request data or raw evidence.",
|
||||
},
|
||||
)
|
||||
result = _handler()._compute_active_rectification_events(
|
||||
{
|
||||
"birth_date": "1993-04-17",
|
||||
"start_time": "14:29",
|
||||
"end_time": "14:31",
|
||||
"lat": 36.683333,
|
||||
"lon": 114.35,
|
||||
"tz": 8,
|
||||
"high_rigor": True,
|
||||
"events": [
|
||||
{"id": "5cb071d6-6d99-46be-85dc-a9bf59ef6ac5", "domain": "education", "date": "2011-09", "precision": "month"},
|
||||
{"id": "0790866c-ad5e-4a45-b2b4-a5c73f6be6ea", "domain": "career", "date": "2019-07-01", "precision": "day"},
|
||||
{"id": "0ef52e51-ab5f-453b-81e5-adb44a929224", "domain": "relationship", "date": "2021", "precision": "year"},
|
||||
],
|
||||
}
|
||||
)
|
||||
receipt = result["three_engine_packet"]["vedastro"]
|
||||
assert receipt["status"] == "queued"
|
||||
assert receipt["job_id"] == "vgw_rectification"
|
||||
assert "1993" not in str(receipt)
|
||||
|
||||
@@ -6,6 +6,7 @@ from __future__ import annotations
|
||||
import re
|
||||
import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import json
|
||||
import os
|
||||
@@ -19,7 +20,7 @@ import pytest
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
APP = ROOT / "jyotish-app"
|
||||
API_SERVER = ROOT / "scripts" / "jyotish_api_server.py"
|
||||
TMP = Path(os.environ.get("TMPDIR", "/private/tmp"))
|
||||
TMP = Path(os.environ.get("TMPDIR") or tempfile.gettempdir())
|
||||
|
||||
|
||||
def read(relative: str) -> str:
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from scripts.minute_rectification_holdout_validator import validate
|
||||
|
||||
|
||||
def test_empty_public_minute_protocol_blocks_verified_claims() -> None:
|
||||
report = validate()
|
||||
assert report["status"] == "blocked_awaiting_public_aa_cases"
|
||||
assert report["verified_minute_claim_allowed"] is False
|
||||
assert report["valid_public_aa_cases"] == 0
|
||||
@@ -13,3 +13,39 @@ def test_packet_is_private_and_never_confirms(monkeypatch) -> None:
|
||||
assert "year" not in str(packet)
|
||||
assert packet["can_confirm"] is False
|
||||
assert packet["vedastro"]["status"] == "requires_gateway_raw_archive"
|
||||
|
||||
|
||||
def test_high_rigor_packet_queues_safe_vedastro_receipt_without_raw(monkeypatch) -> None:
|
||||
monkeypatch.setattr("scripts.rectification_three_engine_packet._local_d1", lambda _: {"Sun": "Aries"})
|
||||
monkeypatch.setattr("scripts.rectification_three_engine_packet._pyjhora_d1", lambda _: {"Sun": "Aries"})
|
||||
monkeypatch.setattr("scripts.rectification_three_engine_packet._jyotishganit_d1", lambda _: {"Sun": "Aries"})
|
||||
monkeypatch.setattr(
|
||||
"scripts.vedastro_gateway.enqueue_gateway_job",
|
||||
lambda *_args, **_kwargs: {
|
||||
"job_id": "vgw_safe_receipt",
|
||||
"status": "queued",
|
||||
"poll_path": "/api/vedastro_gateway/jobs/vgw_safe_receipt",
|
||||
"request": CASE,
|
||||
"result": {"official_raw_response": {"private": "never expose"}},
|
||||
"raw_response_archive": {
|
||||
"status": "pending",
|
||||
"official_raw_response_available": False,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
packet = build_packet(CASE, enqueue_vedastro_gateway=True)
|
||||
|
||||
assert packet["vedastro"] == {
|
||||
"scope": "vedastro_gateway_job_receipt",
|
||||
"status": "queued",
|
||||
"job_id": "vgw_safe_receipt",
|
||||
"poll_path": "/api/vedastro_gateway/jobs/vgw_safe_receipt",
|
||||
"raw_response_archive": {
|
||||
"status": "pending",
|
||||
"official_raw_response_available": False,
|
||||
},
|
||||
"boundary": "VedAstro raw response remains server-side; this receipt never returns request data or raw evidence.",
|
||||
}
|
||||
assert "year" not in str(packet)
|
||||
assert "private" not in str(packet)
|
||||
|
||||
Reference in New Issue
Block a user