"""Rebuild frontend/tests/fixtures/birth-sky-golden.json from the real engine. Fictional sample from TASK-birth-sky-cover-20260928: 1994-05-18, UTC+8, 30.27N 120.15E, at four local times (one per sky phase). The frontend tests read these engine responses as-is; the test suite never writes this file. python3 -m scripts.generate_birth_sky_golden """ from __future__ import annotations import json from pathlib import Path from scripts.birth_sky import compute_birth_sky ROOT = Path(__file__).resolve().parents[1] GOLDEN = ROOT / "frontend" / "tests" / "fixtures" / "birth-sky-golden.json" SAMPLE = {"date": "1994-05-18", "tz": 8, "lat": 30.27, "lon": 120.15} TIMES = {"day": "07:40", "twilight_morning": "04:50", "twilight_evening": "19:10", "night": "00:00"} def main() -> None: payload = { "source": "scripts/generate_birth_sky_golden.py -> scripts/birth_sky.compute_birth_sky (POST /api/birth_sky)", "note": "Fictional sample 1994-05-18 UTC+8 30.27N 120.15E; key = phase at that local time.", "times": TIMES, "responses": { key: compute_birth_sky(SAMPLE["date"], time, SAMPLE["tz"], SAMPLE["lat"], SAMPLE["lon"]) for key, time in TIMES.items() }, } GOLDEN.write_text(json.dumps(payload, ensure_ascii=False, separators=(",", ":")) + "\n", encoding="utf-8") print(f"wrote {GOLDEN}") if __name__ == "__main__": main()