fix(home): serve today's starlanguage from daily guidance
The homepage was waiting on a full chart plus four extra engines, so the card timed out and showed the failure copy on every visit. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,23 +10,21 @@ def test_daily_starlanguage_entrypoint_is_productized() -> None:
|
||||
source = PAGE.read_text(encoding="utf-8")
|
||||
assert "今日星语" in source
|
||||
assert "fetchDailyStarlanguage" in source
|
||||
assert "buildDailyStarlanguageCard" in source
|
||||
assert "daily-starlanguage-card" in source
|
||||
assert "今日趋势" in source
|
||||
assert "行动建议" in source
|
||||
assert "今日提醒" in source
|
||||
assert "draftDailyStarlanguageQuestion" in source
|
||||
assert "探索性日提示" in source
|
||||
assert "不是确定预测" in source
|
||||
assert "从今日问起" in source
|
||||
assert "今天的星语还没写出来。" in source
|
||||
assert "buildDailyStarlanguageCard" not in source
|
||||
assert "点这里" not in source
|
||||
assert "不会用通用文案顶替" not in source
|
||||
|
||||
|
||||
def test_daily_starlanguage_api_declares_honest_source_boundary() -> None:
|
||||
source = DAILY_ROUTE.read_text(encoding="utf-8")
|
||||
assert "status: \"ok\"" in source
|
||||
assert "/api/chart" in source
|
||||
assert "/api/transit" in source
|
||||
assert "jyotish_api_transit_lite" in source
|
||||
assert "calculation_lite" in source
|
||||
assert "/api/daily_guidance" in source
|
||||
assert "/api/chart" not in source
|
||||
assert "/api/transit" not in source
|
||||
assert "exploratory_unvalidated" in source
|
||||
assert "not_deterministic_prediction" in source
|
||||
|
||||
@@ -34,11 +32,8 @@ def test_daily_starlanguage_api_declares_honest_source_boundary() -> None:
|
||||
def test_birth_time_rectification_entrypoint_is_productized() -> None:
|
||||
source = PAGE.read_text(encoding="utf-8")
|
||||
assert "生时校正" in source
|
||||
assert "fetchBirthRectificationPreview" in source
|
||||
assert "birth-rectification-card" in source
|
||||
assert "draftBirthTimeRectificationQuestion" in source
|
||||
assert "候选出生时间段" in source
|
||||
assert "不能直接改写默认星盘" in source
|
||||
assert "openRectificationFromHomepage" in source
|
||||
|
||||
|
||||
def test_birth_rectification_api_proxies_active_questionnaire_with_boundary() -> None:
|
||||
|
||||
@@ -3,6 +3,13 @@ from __future__ import annotations
|
||||
from scripts.daily_guidance_service import build_daily_guidance
|
||||
|
||||
|
||||
PLANETS = {"Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu"}
|
||||
SIGNS = {
|
||||
"Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo",
|
||||
"Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces",
|
||||
}
|
||||
|
||||
|
||||
def test_daily_guidance_returns_short_positive_evidence_packet() -> None:
|
||||
packet = build_daily_guidance({
|
||||
"year": 1990,
|
||||
@@ -25,6 +32,31 @@ def test_daily_guidance_returns_short_positive_evidence_packet() -> None:
|
||||
assert packet["audit"]["not_a_prediction"] is True
|
||||
assert {"D1", "Daily Transit"} <= {row["layer"] for row in packet["evidence"]}
|
||||
assert packet["suggested_actions"]
|
||||
assert packet["moon_house"] in range(1, 13)
|
||||
assert packet["moon_sign"] in SIGNS
|
||||
assert packet["ascendant_sign"] in SIGNS
|
||||
assert packet["mahadasha_lord"] in PLANETS
|
||||
assert packet["theme"]
|
||||
vimshottari = next(row for row in packet["evidence"] if row["layer"] == "Vimshottari")
|
||||
assert vimshottari["status"] == "used"
|
||||
|
||||
|
||||
def test_daily_guidance_changes_with_the_calendar_day() -> None:
|
||||
body = {
|
||||
"year": 1990,
|
||||
"month": 1,
|
||||
"day": 1,
|
||||
"hour": 12,
|
||||
"minute": 0,
|
||||
"lat": 39.9,
|
||||
"lon": 116.4,
|
||||
"tz": 8,
|
||||
"ayanamsa": "lahiri",
|
||||
"node_mode": "mean",
|
||||
}
|
||||
first = build_daily_guidance({**body, "date": "2026-07-17"})
|
||||
later = build_daily_guidance({**body, "date": "2026-08-19"})
|
||||
assert first["moon_sign"] != later["moon_sign"] or first["moon_house"] != later["moon_house"]
|
||||
|
||||
|
||||
def test_daily_guidance_endpoint_is_registered() -> None:
|
||||
|
||||
Reference in New Issue
Block a user