fix: the time section has one heading; single-topic paragraphs open with a bold conclusion (BUG-2054)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
This commit is contained in:
2026-11-20 08:35:04 +08:00
co-authored by Claude Opus 5.5
parent 4e582614e4
commit 386a8d946e
6 changed files with 40 additions and 2 deletions
+11
View File
@@ -27591,3 +27591,14 @@
- 验证与防复发:`frontend/tests/report-start-progress-2046.test.tsx` 覆盖开始卡的内容和价格来源、出生时间那一句的条件、已有报告那一行、拒绝时的说明、弹窗的关闭方式、任务阶段到步骤的对应、进度卡、三种报告三种状态的列表行;「不扣」「已退回」两句话的依据(失败前先释放预留点数)也钉在测试里。钉住旧写法的七个测试文件按原值、新值、原因更新。`frontend/DESIGN.md` 的「报告生成等待态」一节改写为现在的规定。本机没有数据库,登录后的页面无法实际渲染,没有做页面截图核对。
- 关联记录:BUG-1630、BUG-1665、BUG-1941、BUG-1950、BUG-2037。
- 修复版本:`claude/report-start-progress-2046`。
## BUG-2054 | 格式骨架收尾:「时间」一节标题不固定;单一主题段首不加粗
- 状态:fixed-pending-verify(待 staging 实测)。
- 首次发现 / 最近更新:2026-11-20 / 2026-11-20。
- 触发与现象:staging 第十四轮:父母题两次都是四节、顺序相同,但第三个标题一次「这段时间」、一次「时间」;别人的档案上问性格(单一主题),10 段没有一段加粗开头。
- 修复(产品负责人 2026-11-20 同意,12 份验证):点名几项的骨架里时间那一节写明「标题写『### 接下来这段时间』」,问题里明确问过去(过去 / 以前 / 去年 / 那几年……)时不加;单一主题骨架改为「每段第一句是一句加粗的结论」(与可见写法同一说法)。页面显示时,分节回答结尾的「能做的几件事:」一行显示成同级小标题。回测脚本与金样捕获加 general 路线。
- 验证(12 份,DeepSeek flash,Obama、Zidane × 父母题、性格题 × 每题 3 份;每份含 2–3 次模型请求):父母题第三个标题 6/6 为「接下来这段时间」(改前 BUG-2045 的 6 份是「这段时间 / 时间 / 接下来这段时间 / 接下来这大半年」混着);6 份里 1 份结尾写成「能做的几件事:」一行而非小标题,由显示统一。段首加粗:性格题改后 31/32 段;改前没有性格题,用同属单一主题的财运题对照:BUG-2045 之前 21/35、BUG-2045 之后 32/37。
- 防复发:`tests/consult-answer-skeleton-2045.test.ts` 加断言。
- 关联记录:BUG-2045。
- 修复版本:`claude/qa-skeleton-2054`,待 staging。
@@ -197,6 +197,8 @@ const GOLDEN_ROUTE_FOR_DOMAIN: Record<string, string> = {
// BUG-1973: the model often adds timing to a wealth or annual plan; a snapshot without it
// answered with a short error and the model retried, which inflated the measured input.
timing: "timing",
// BUG-2054: only in a golden captured with BACKTEST_ROUTES=general.
general: "general",
};
let factsFixture: { figures?: Record<string, { domains?: Record<string, Json> }> } | null = null;
+4
View File
@@ -72,10 +72,14 @@ export const YOGA_UNDECIDED_FOR_READER = "这一点目前还不能明确判断";
*/
const ACTION_HEADING_RE = /^#{1,3}[ \t]*((?:接下来)?(?:能做|可以做|具体可以做|可以去做|能去做)[^\n#]{0,12}?)[::]?[ \t]*$/mu;
const ACTION_LINE_RE = /^((?:接下来)?(?:能做|可以做|具体可以做|可以去做|能去做)[^\n#::]{0,12}?)[::][ \t]*$/mu;
export function withSteadyLayout(body: string): string {
let text = body;
const headings = text.match(/^#{1,3}[ \t]+\S/gmu) ?? [];
if (headings.length === 1) text = text.replace(ACTION_HEADING_RE, (_match, title: string) => `${title}:`);
// BUG-2054: an answer written in sections (several ### headings) keeps its closing actions as a section too.
if (headings.length >= 2) text = text.replace(ACTION_LINE_RE, (_match, title: string) => `### ${title}`);
return text.replace(/^([ \t]*)\d{1,2}[.、))][ \t]+/gmu, "$1- ");
}
@@ -844,6 +844,9 @@ export function consultQuestionParts(question: string): string[] {
return PART_JOIN.test(between) ? found.map((item) => item.name) : [];
}
/** BUG-2054: a question about the past gets no fixed 「接下来这段时间」 heading. */
const PAST_QUESTION = /过去|以前|之前|那几年|那时候|小时候|去年|前几年|这些年/u;
export function consultAnswerShape(question: string): ConsultAnswerShape {
if (consultQuestionParts(question).length >= 2) return "parts";
if (YES_NO.test(question.trim())) return "yes_no";
@@ -855,10 +858,14 @@ export function consultAnswerSkeletonLine(question: string): string {
const shape = consultAnswerShape(question);
if (shape === "parts") {
const parts = consultQuestionParts(question);
return ` 本轮骨架:用户点名了${parts.length}项(${parts.join("、")}),每项一节,用 ### 短标题、按这个顺序;每节第一句加粗结论;之后一节写时间;最后「能做的几件事」用列表。`;
// BUG-2054 原值「之后一节写时间」/ 新值:这一节的标题固定为「接下来这段时间」,问过去时不加这一节的固定标题 /
// 原因:第十四轮同一题两次,第三个标题一次「这段时间」、一次「时间」(负责人 2026-11-20 同意,12 份验证)
const timeSection = PAST_QUESTION.test(question) ? "之后一节写时间" : "之后一节写时间,标题写「### 接下来这段时间」";
return ` 本轮骨架:用户点名了${parts.length}项(${parts.join("、")}),每项一节,用 ### 短标题、按这个顺序;每节第一句加粗结论;${timeSection};最后「能做的几件事」用列表。`;
}
if (shape === "yes_no") return " 本轮骨架:是非题,不用标题;第一句直接答是或不是;后面写成段落,每段第一句加粗;最后「能做的几件事」用列表。";
if (shape === "timing") return " 本轮骨架:时间题,不用标题;按时间先后,一段写一个时间段,每段第一句加粗那段的结论;最后「能做的几件事」按时间段用列表。";
return " 本轮骨架:不用标题;写成段落,每段第一句加粗;最后「能做的几件事」用列表。";
// BUG-2054 原值「写成段落,每段第一句加粗」/ 新值:每段第一句是一句加粗的结论(与可见写法同一说法)/ 原因:第十四轮单一主题 10 段没有一段加粗
return " 本轮骨架:不用标题;写成段落,每段第一句是一句加粗的结论;最后「能做的几件事」用列表。";
}
@@ -44,3 +44,15 @@ test("the page shows a lone closing-actions heading as a line and numbered items
const parts = "### 母亲\n\n甲。\n\n### 父亲\n\n乙。\n\n### 能做的几件事\n\n- 丙。";
assert.equal(withSteadyLayout(parts), parts, "several headings stay");
});
test("BUG-2054: the time section has a fixed heading, past questions excepted; single-topic paragraphs open with a bold conclusion", async () => {
assert.match(consultAnswerSkeletonLine("我和我父母之间的关系怎么样"), /之后一节写时间,标题写「### 接下来这段时间」/);
assert.doesNotMatch(consultAnswerSkeletonLine("我和父母过去那几年的关系怎么样"), /接下来这段时间/);
assert.match(consultAnswerSkeletonLine("我的性格是什么样的?"), /每段第一句是一句加粗的结论/);
const { withSteadyLayout } = await import("../src/lib/consult-answer-basis.ts");
assert.equal(
withSteadyLayout("### 母亲\n\n甲。\n\n### 接下来这段时间\n\n乙。\n\n能做的几件事:\n\n- 丙。"),
"### 母亲\n\n甲。\n\n### 接下来这段时间\n\n乙。\n\n### 能做的几件事\n\n- 丙。",
);
});
@@ -69,6 +69,8 @@ EXTRA_ROUTES = (
{"domain": "annual", "engine_route": "annual", "question": "我未来十二个月的综合运势怎么样?"},
{"domain": "wealth", "engine_route": "wealth", "question": "我的财运和收入会怎样?"},
{"domain": "timing", "engine_route": "timing", "question": "这件事在哪段时间更有条件推进?"},
# BUG-2054: single-topic questions (personality) run the general route.
{"domain": "general", "engine_route": "general", "question": "我的性格是什么样的?"},
)