sync: import rectification and vedastro contract updates

This commit is contained in:
732642856
2026-07-21 20:30:49 +08:00
parent 508e499bce
commit 3cdbbda94b
15 changed files with 871 additions and 772 deletions
+34 -35
View File
@@ -1,51 +1,50 @@
from scripts.rectification_three_engine_packet import build_packet, case_hash
from __future__ import annotations
import sys
from pathlib import Path
CASE = {"year": 1990, "month": 1, "day": 1, "hour": 12, "minute": 0, "lat": 0.0, "lon": 0.0, "tz": 0.0}
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
if str(SCRIPTS) not in sys.path:
sys.path.insert(0, str(SCRIPTS))
def test_packet_is_private_and_never_confirms(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"})
packet = build_packet(CASE)
assert packet["case_hash"] == case_hash(CASE)
assert "year" not in str(packet)
assert packet["can_confirm"] is False
assert packet["vedastro"]["status"] == "requires_gateway_raw_archive"
def test_packet_queues_a_privacy_safe_vedastro_receipt(monkeypatch) -> None:
import rectification_three_engine_packet as packet
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(packet, "_local_d1", lambda _case: {"Sun": "Aries"})
monkeypatch.setattr(packet, "_pyjhora_d1", lambda _case: {"Sun": "Aries"})
monkeypatch.setattr(packet, "_jyotishganit_d1", lambda _case: {"Sun": "Aries"})
monkeypatch.setattr(
"scripts.vedastro_gateway.enqueue_gateway_job",
packet,
"_enqueue_vedastro_gateway_job",
lambda *_args, **_kwargs: {
"job_id": "vgw_safe_receipt",
"scope": "vedastro_gateway_job_receipt",
"status": "queued",
"poll_path": "/api/vedastro_gateway/jobs/vgw_safe_receipt",
"request": CASE,
"result": {"official_raw_response": {"private": "never expose"}},
"job_id": "rectification-job",
"poll_path": "/api/vedastro_gateway/jobs/rectification-job",
"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.",
},
)
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,
result = packet.build_packet(
{
"year": 1993,
"month": 4,
"day": 17,
"hour": 14,
"minute": 29,
"lat": 36.683333,
"lon": 114.35,
"tz": 8,
},
"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)
enqueue_vedastro_gateway=True,
)
assert result["vedastro"]["status"] == "queued"
assert result["can_confirm"] is False
assert "1993" not in str(result["vedastro"])