From d151b02cb0a69bd2ffb2cbc342391e5414a63d6c Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 19:20:27 +0800 Subject: [PATCH] fix(report): period connections use route, not path, in the reading facts (BUG-2126 follow-up) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8 --- docs/BUG_HISTORY.md | 1 + frontend/src/lib/personal-question-material.ts | 2 +- frontend/tests/period-connections-2126.test.ts | 2 +- scripts/report_render/reading_facts.py | 6 ++++-- tests/test_reading_facts_2126.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 847b6194d..ff1f0b3cf 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -28700,6 +28700,7 @@ - 防复发:测试断言这一块没有 activated / score / votes / count 这类字段。 - 关联记录:BUG-2121、BUG-2106、BUG-2117、BUG-2098。 - 修复版本:`claude/period-connections-2126`。 +- 补充(2026-11-21):事实里每条关联路径的键 `path` / `path_zh` 改名为 `route` / `route_zh`——`tests/test_report_reading_facts.py::test_reading_facts_are_packet_leaves` 规定写作输入里不出现 `"path"` 键(内部叶子路径不进模型),BUG-2126 提交时没跑这个文件,staging 上它一直失败(BUG-2130 的后台任务发现)。提问材料同时读新旧两个键,已存的事实照常显示。 ## BUG-2124 | 自定义条件的格局只写「满足自定义条件」,说不出实际成立的是哪一支 diff --git a/frontend/src/lib/personal-question-material.ts b/frontend/src/lib/personal-question-material.ts index 174ef3b08..ec82adea8 100644 --- a/frontend/src/lib/personal-question-material.ts +++ b/frontend/src/lib/personal-question-material.ts @@ -193,7 +193,7 @@ function connectionLines(facts: Row, only?: readonly number[]): string[] { for (const item of list(record(raw).paths)) { const path = record(item); const fact = text(path.text_zh); - if (fact) out.push(`第 ${house} 宫和当前这段时间的主星有联系(${text(path.path_zh) || "路径未标明"},这是索引,不是「被激活」的判定):${fact}`); + if (fact) out.push(`第 ${house} 宫和当前这段时间的主星有联系(${text(path.route_zh ?? path.path_zh) || "路径未标明"},这是索引,不是「被激活」的判定):${fact}`); } } return out; diff --git a/frontend/tests/period-connections-2126.test.ts b/frontend/tests/period-connections-2126.test.ts index d27bc4e05..519686012 100644 --- a/frontend/tests/period-connections-2126.test.ts +++ b/frontend/tests/period-connections-2126.test.ts @@ -17,7 +17,7 @@ const facts = { period_connections: { status: "computed", houses: { - "7": { house_lord: "Venus", paths: [{ path: "direct", path_zh: "直接(是这一宫的宫主,或落在这一宫)", + "7": { house_lord: "Venus", paths: [{ route: "direct", route_zh: "直接(是这一宫的宫主,或落在这一宫)", lords: [{ lord: "Venus", levels: ["md"] }], text_zh: "金星(大运主星)是第 7 宫宫主" }] }, "10": { house_lord: "Mars", paths: [{ path: "dispositor_chain", path_zh: "定位链(宫主所在星座的主星,一步步往下找)", lords: [{ lord: "Venus", levels: ["md"] }], text_zh: "火星在天秤座→金星在金牛座:第 1 步到金星(大运主星)" }] }, diff --git a/scripts/report_render/reading_facts.py b/scripts/report_render/reading_facts.py index e6b6d0589..91a0ea4dc 100644 --- a/scripts/report_render/reading_facts.py +++ b/scripts/report_render/reading_facts.py @@ -1310,8 +1310,10 @@ def _period_connections(working: dict) -> dict[str, Any] | None: levels = hit_lords.setdefault(hit["lord"], []) levels.extend(level for level in hit.get("levels") or [] if level not in levels) matched.append({ - "path": name, - "path_zh": _CONNECTION_PATH_ZH.get(name, name), + # BUG-2126 follow-up: "route", not "path" — the facts never carry a "path" key + # (test_reading_facts_are_packet_leaves keeps internal leaf paths out of the model input). + "route": name, + "route_zh": _CONNECTION_PATH_ZH.get(name, name), "lords": [{"lord": lord, "levels": levels} for lord, levels in hit_lords.items()], "text_zh": path_cell(path, "zh"), }) diff --git a/tests/test_reading_facts_2126.py b/tests/test_reading_facts_2126.py index a3dcc6b3f..1c3803d88 100644 --- a/tests/test_reading_facts_2126.py +++ b/tests/test_reading_facts_2126.py @@ -44,7 +44,7 @@ def test_only_matched_paths_are_carried_each_with_its_own_lords() -> None: for house, row in block["houses"].items(): assert row["paths"], house for path in row["paths"]: - assert path["path"] in ("direct", "same_sign_or_aspect", "sign_exchange", "dispositor_chain", "topic_varga") + assert path["route"] in ("direct", "same_sign_or_aspect", "sign_exchange", "dispositor_chain", "topic_varga") assert path["lords"] and all(item["levels"] for item in path["lords"]) assert path["text_zh"] and "未对上" not in path["text_zh"] and "未判定" not in path["text_zh"] # No score, count or boolean "activated" field anywhere in the block.