fix(ai): 折叠态只显示一句话,那句话得说清是哪个指标
精简版的卡片正文就是第一条 highlight,标题不渲染。于是趋势页折叠起来是 「395 天内由 4376.0分 到 4905.0分(改善)」——什么的 4376 分?身体成分、 运动详情同样。 每个 builder 的第一条 detail 现在都自带主语,并加了不变量测试:detail 必须 包含它自己的 title(纯汇总性标题除外)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1053,3 +1053,23 @@ class TestSupersede:
|
||||
statuses = {r["subject"]: r["status"] for r in analysis_svc.query_all(
|
||||
"SELECT subject, status FROM ai_jobs WHERE kind = 'trends'")}
|
||||
assert statuses.get("2026-08-01") == "running"
|
||||
|
||||
|
||||
class TestHighlightsReadAlone:
|
||||
"""The first highlight becomes the collapsed card's whole text, with no
|
||||
title beside it — so it has to name what it is about."""
|
||||
|
||||
def test_every_first_highlight_names_its_subject(self, month):
|
||||
for name in scopes.SCOPES:
|
||||
built = scopes.build(month["id"], name)
|
||||
if not built:
|
||||
continue
|
||||
first = built[1]["highlights"][0]
|
||||
title = first["title"]
|
||||
# Titles that are already summaries rather than names of a metric.
|
||||
if title in ("整体", "当前预测") or title.startswith("近 "):
|
||||
continue
|
||||
assert title in first["detail"], (
|
||||
f"{name}: 折叠态只显示 detail,但它没提到 {title!r}: "
|
||||
f"{first['detail']!r}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user