Files
Jyotisha/tests/test_daily_and_rectification_entrypoints.py
T
Jesse_ChenandClaude Opus 5.5 6ad0bea320 feat(rectification): start from an offer card in the consultation, come back to it (BUG-1247~1251)
TASK-rectification-in-chat-step1-20261006, direct execution.

- The homepage 生时校正 pill and the text trigger (isRectificationHandoffQuestion)
  are gone. The consult agent decides (RECTIFICATION_OFFER_RULE, one
  definition) and calls offer-birth-time-rectification; the server decides
  whether a card may show (self, product on, no case in progress,
  feature_pricing price). The offer is stored with the answer and travels on
  run.completed; the card hangs under that answer.
- Opening from the card binds the offer to the case in the consultation's own
  messages (no table change); GET/POST /api/rectification/cases/[caseId]/source
  find the source and go back: one divider (time changed or not), earlier
  answers captioned 按校正前的时间, and a 按新时间重新看 button that sends only
  when clicked. Auto-return after the post-adopt check or a terminal case, only
  for work done in this view.
- Model history skips the divider and notes answers written with the old time.

Full suite 4987 / fail 24, identical to 6ec8efd5 (4973 / 24), no test name
lost; tsc 0; lint 0 errors; build keeps / Static, first-load gzip +0.20%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
2026-10-07 12:58:58 +08:00

67 lines
2.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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")
RECTIFICATION_HOOK = Path("frontend/src/hooks/use-rectification-surface.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]
if RECTIFICATION_HOOK.exists():
parts.append(RECTIFICATION_HOOK)
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,全仓已无该类名
source = _home_entrypoint_surface()
assert "今日星语" in source
assert "fetchDailyStarlanguage" in source
assert "starter-entry" in source
assert "startDailyStarlanguageConsultation" in source
assert "从今日问起" in source
assert "今天的星语还没写出来。" in source
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)
source = _home_entrypoint_surface()
assert "生时校正" in source
assert "starter-entry" in source
assert "openRectificationFromChat" 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:
source = RECTIFICATION_ROUTE.read_text(encoding="utf-8")
assert "/api/active_rectification_questions" in source
assert "candidate_scan" in source
assert "question_count" in source
assert "not_auto_rectified" in source