Files
Jyotisha/tests/test_synastry_full_dossier.py
T
jesse-uxGrok (agent loop)Cursor
123295135a
Independent Staging Quality Gate / validate (push) Successful in 16m50s
Independent Staging Quality Gate / publish (push) Successful in 10m2s
fix(synastry): restore report paging and finish the third review gaps
The list query had been split into four reads, so older pages no longer followed one cursor. A7 was read from the wrong module, and the shell asked for the product switch on every mount.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 15:53:06 +08:00

89 lines
3.4 KiB
Python

"""Two public charts must produce a narrative-ready synastry dossier."""
from __future__ import annotations
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCRIPTS = ROOT / "scripts"
if str(SCRIPTS) not in sys.path:
sys.path.insert(0, str(SCRIPTS))
from jyotish_api_server import JyotishComputeService
from marriage_match_service.full_dossier import build_synastry_full_dossier, relationship_structure
FIXTURE = ROOT / "frontend" / "tests" / "fixtures" / "synastry-full-dossier-truncated.json"
# Public Rodden-rated charts already used by tests/verify_jyotish_v6_1.py.
# Times are the UT hours stored there, passed with tz 0.
EINSTEIN = {
"year": 1879, "month": 3, "day": 14, "hour": 10, "minute": 30, "second": 0,
"lat": 48.4, "lon": 10.0, "tz": 0, "ayanamsa": "lahiri", "node_mode": "mean",
"today": "2026-10-18",
}
JOBS = {
"year": 1955, "month": 2, "day": 25, "hour": 3, "minute": 15, "second": 0,
"lat": 37.77, "lon": -122.42, "tz": 0, "ayanamsa": "lahiri", "node_mode": "mean",
"today": "2026-10-18",
}
def truncate_dossier(packet: dict) -> dict:
"""Keep the readiness and product identity. Drop longitudes and module bodies.
The dropped fields are still produced by the engine; this slice is what the
fixture locks so the file does not carry a full private packet.
"""
dossier = packet["dossier"]
match = dossier["marriage_match"]
core = match["ashtakoota_36"]["international_core"]
snapshots = dossier["chart_snapshots"]
return {
"schema": dossier["schema"],
"delivery_readiness": dossier["delivery_readiness"],
"default_profile": match["rule_profile"]["id"],
"total_score": core["total_score"],
"max_score": core["max_score"],
"raman_profile": packet["raman_marriage_match"]["rule_profile"]["id"],
"planets_a": sorted(snapshots["person_a"]["planets"]),
"planets_b": sorted(snapshots["person_b"]["planets"]),
}
def test_relationship_structure_reads_jaimini_arudha_and_karaka():
structure = relationship_structure({
"modules": {
"chart": {
"ascendant": {"sign": "Aries"},
"planets": {"Venus": {"sign": "Taurus"}, "Moon": {"sign": "Cancer"}},
},
"jaimini": {
"chara_karakas": {"DK": {"planet": "Venus"}},
"arudha_padas": {
"upapada": {"sign": "Libra"},
"padas": {"A7": {"sign": "Scorpio"}, "UL": {"sign": "Libra"}},
},
},
"varga_full": {"D9_Navamsa": {"Ascendant": {"sign": "Pisces"}}},
},
})
assert structure["seventh_lord"] == "Venus"
assert structure["darakaraka"] == "Venus"
assert structure["upapada"] == "Libra"
assert structure["A7"] == "Scorpio"
assert structure["d9"]["ascendant"] == "Pisces"
def test_public_pair_dossier_is_ready_for_narrative():
handler = JyotishComputeService()
packet = build_synastry_full_dossier(handler, EINSTEIN, JOBS)
assert packet["dossier"]["delivery_readiness"] == "ready_for_narrative"
assert packet["raman_marriage_match"]["rule_profile"]["id"] == "raman_muhurtha_v1"
sliced = truncate_dossier(packet)
if not FIXTURE.is_file():
FIXTURE.write_text(json.dumps(sliced, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
assert sliced == json.loads(FIXTURE.read_text(encoding="utf-8"))