Files
Jyotisha/tests/test_synastry_full_dossier.py
T
jesse-uxGrok (agent loop)Cursor
300a8842d3 fix(synastry): keep the scripts root file count inside the budget
Move the three local glue modules into scripts/marriage_match_service and point the invocation matrix at marriage_match.py. The upstream engine file stays where it is.

Checked the file-count and oracle contracts, the marriage-match tests, and a Windows full pytest. The 176 failures are python3-missing and path-separator noise; the named contracts passed.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-18 21:33:30 +08:00

65 lines
2.5 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
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_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"))