Compute synastry from chart library profiles

This commit is contained in:
732642856
2026-07-17 17:27:11 +08:00
parent 05e747f84e
commit a6aa84e905
3 changed files with 129 additions and 3 deletions
+17
View File
@@ -33,6 +33,7 @@ CHART_PROFILE_MIGRATION = (
PAGE = Path(__file__).resolve().parents[1] / "frontend" / "src" / "app" / "page.tsx"
CHART_PROFILE_ROUTE = Path(__file__).resolve().parents[1] / "frontend" / "src" / "app" / "api" / "chart-profiles" / "route.ts"
CHART_PROFILE_DELETE_ROUTE = Path(__file__).resolve().parents[1] / "frontend" / "src" / "app" / "api" / "chart-profiles" / "[id]" / "route.ts"
SYNASTRY_ROUTE = Path(__file__).resolve().parents[1] / "frontend" / "src" / "app" / "api" / "synastry" / "route.ts"
def _sql() -> str:
@@ -142,6 +143,8 @@ def test_chart_profile_library_has_cloud_table_api_and_local_fallback() -> None:
"deleteCloudChartProfile",
"buildSynastryQuestion",
"draftSynastryQuestionFromChart",
'fetch("/api/synastry"',
"Ashtakoot",
"chartLibraryStorageKey",
"Cloud chart library is best-effort",
"星盘库",
@@ -154,6 +157,20 @@ def test_chart_profile_library_has_cloud_table_api_and_local_fallback() -> None:
assert "ayanam-sessions" not in page
def test_synastry_route_orchestrates_python_chart_and_ashtakoot() -> None:
route = SYNASTRY_ROUTE.read_text(encoding="utf-8")
for token in (
'const apiBase = process.env.JYOTISH_API_BASE ?? "http://127.0.0.1:5200"',
'postPython("/api/chart", birthPayload(body.selfProfile))',
'postPython("/api/chart", birthPayload(body.partnerProfile))',
'postPython("/api/synastry"',
"moonLongitude(selfChart)",
"ashtakoot_from_computed_moon",
'status: "blocked"',
):
assert token in route
def test_consultation_credit_lifecycle_is_idempotent_and_server_only() -> None:
sql = re.sub(r"\s+", " ", CONSULTATION_MIGRATION.read_text(encoding="utf-8").lower()).strip()