Home chat surface, onboarding assessment, rectification cases API, Mastra rectification tools and admin telemetry are gone; 生时纠正 is the standalone /rectification page. Old birth_time_rectification sessions are hidden from lists. Consult offer card links to the page. Copy renamed to 生时纠正. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
78 lines
4.1 KiB
Python
78 lines
4.1 KiB
Python
from pathlib import Path
|
||
|
||
|
||
PAGE = Path("frontend/src/app/(app)/page.tsx")
|
||
STARTER_HOME = Path("frontend/src/components/starter-home.tsx")
|
||
HOME_CLOUD = Path("frontend/src/lib/home-cloud-sync.ts")
|
||
DAILY_ROUTE = Path("frontend/src/app/api/daily-starlanguage/route.ts")
|
||
RECTIFICATION_ROUTE = Path("frontend/src/app/api/birth-rectification/route.ts")
|
||
|
||
|
||
def _home_entrypoint_surface() -> str:
|
||
parts = [PAGE, STARTER_HOME, HOME_CLOUD]
|
||
return "".join(path.read_text(encoding="utf-8") for path in parts)
|
||
|
||
|
||
def test_daily_starlanguage_entrypoint_is_productized() -> None:
|
||
# 原值:断言 daily-starlanguage-card(空状态大卡)
|
||
# 新值:StarterEntries 的 starter-entry pill + startDailyStarlanguageConsultation
|
||
# 原因:62903b7a 已把卡片改成问候 + 输入框 + 两枚 pill,全仓已无该类名
|
||
# 原值(2):首页有「今日星语」胶囊、fetchDailyStarlanguage、「从今日问起」「今天的星语还没写出来。」
|
||
# 新值(2):首页不再显示、不再请求今日星语;接口 /api/daily-starlanguage 保留(见下一条)
|
||
# 原因(2):2026-11-02 首页界面整理第 3 条:今日星语从界面去掉
|
||
source = _home_entrypoint_surface()
|
||
assert "fetchDailyStarlanguage" not in source
|
||
assert "starter-entry" not in source
|
||
assert "startDailyStarlanguageConsultation" not in source
|
||
assert "从今日问起" not in source
|
||
assert "今天的星语还没写出来。" not in source
|
||
assert DAILY_ROUTE.exists()
|
||
assert "daily-starlanguage-card" not 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/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
|
||
|
||
|
||
def test_birth_time_rectification_entrypoint_is_productized() -> None:
|
||
# 原值:断言 birth-rectification-card
|
||
# 新值:同一套 starter-entry pill + openRectificationFromHomepage
|
||
# 原因:同上,卡片入口已删除
|
||
# 原值(2):首页 starter-entry pill + openRectificationFromHomepage
|
||
# 新值(2):首页无校正 pill;入口是对话里的提议卡 → openRectificationFromChat
|
||
# 原因(2):BUG-1247(TASK-rectification-in-chat-step1-20261006 P3/C1)
|
||
# 原值(3):assert "starter-entry" in source 新值(3):首页没有任何 starter-entry 胶囊 原因(3):2026-11-02 今日星语胶囊也删了
|
||
# 原值(4):assert "生时校正" in source;assert "openRectificationFromChat" in source
|
||
# 新值(4):首页不再挂对话式校正;对话里的提议卡 onStartRectification 只跳到独立页 /rectification
|
||
# 原因(4):BUG-1644 对话式生时校正整体下线,换成「生时纠正」选盘页
|
||
source = _home_entrypoint_surface()
|
||
assert "starter-entry" not in source
|
||
assert "onStartRectification" in source
|
||
assert "navigateInApp(RECTIFICATION_PAGE_HREF)" in source
|
||
assert "ConversationalBirthTimeRectification" not in source
|
||
assert "openRectificationFromHomepage" not in source
|
||
assert "birth-rectification-card" not in source
|
||
|
||
|
||
def test_birth_rectification_api_proxies_active_questionnaire_with_boundary() -> None:
|
||
# 原值: 读 birth-rectification/route.ts,断言它代理 /api/active_rectification_questions,并带 candidate_scan、question_count、not_auto_rectified
|
||
# 新值: 该路由文件不存在,且 frontend/src/app/api 下没有任何路由源码再代理 /api/active_rectification_questions
|
||
# 原因: 未登录就能打到约 20 秒的重计算,入口删除而不是补登录(BUG-1342)
|
||
assert not RECTIFICATION_ROUTE.exists()
|
||
api = Path("frontend/src/app/api")
|
||
offenders = [
|
||
str(path)
|
||
for path in api.rglob("route.ts")
|
||
if "/api/active_rectification_questions" in path.read_text(encoding="utf-8")
|
||
]
|
||
assert offenders == []
|