From 8fedf001e1ea5dfc5b3b99bef89cb9e2535e11f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 01:18:22 +0800 Subject: [PATCH] fix(report): reading facts store Narayana's second reading even without rendering (BUG-2106 follow-up) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8 --- docs/BUG_HISTORY.md | 1 + scripts/report_render/reading_facts.py | 4 ++++ tests/test_reading_facts_2106.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 400e2b40a..dac0802cc 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -28409,6 +28409,7 @@ - 验证与防复发:`tests/test_reading_facts_2106.py`(5 条:两张公开盘的中文名和见证星,按 rule_id 和参与行星对行,见证星角色和未返回的情况,Narayana 两种读法有就读、没有就跳过);`frontend/tests/reading-facts-material-2106.test.ts`(1 条)。 - 关联记录:BUG-2089(见证星进报告)、BUG-2105(Narayana 读法存进数据包)、BUG-2088、BUG-2093、BUG-2098、BUG-1988 / BUG-2012(落陷取消逐星一行、编号不变)。 - 修复版本:`claude/reading-facts-2106`。 +- 补充(2026-11-21):Narayana 第二种读法原先只在渲染资料章节时写进数据包,不经渲染直接构造事实的路径会静默缺这一项;`build_report_reading_facts` 现在先调一次 BUG-2107 的 `ensure_narayana_report_extras`(幂等、只写一个键)。`tests/test_reading_facts_2106.py` 新增一例:两张公开盘不渲染也带 `direction_readings`。 ## BUG-2104 | 个人报告里剩下的原始状态词、英文表头、带下划线的键名、一行后台闸门说明;中文 Matrunasa 格局的效果被换成寿命措辞 diff --git a/scripts/report_render/reading_facts.py b/scripts/report_render/reading_facts.py index 412916b2e..20d243e1a 100644 --- a/scripts/report_render/reading_facts.py +++ b/scripts/report_render/reading_facts.py @@ -26,6 +26,7 @@ from .birth_precision_window import ( DEFAULT_WINDOW_SCENARIO, DEFAULT_WINDOW_SOURCE, birth_window_label_zh, report_birth_window, ) from .evidence_grade import evidence_grades +from .narayana_extras_store import ensure_narayana_report_extras from .parity_chapters import _VIMSOPAKA_DIGNITY from .technique_status_axes import technique_audit_axes from .transit_natal_sign import ( @@ -1123,6 +1124,9 @@ def build_report_reading_facts( if subject_life_status == "deceased" and report_mode == "living_consultation": raise ValueError("a deceased subject requires historical_replay") working = _attach_graha_drishti(copy.deepcopy(packet), full_reading) + # BUG-2106 follow-up: store Narayana's second direction reading even when the data chapters were + # not rendered first (the renderer stores it too, BUG-2107; idempotent, writes one key). + ensure_narayana_report_extras(working) # One detached copy of the packet serves every domain's facts and their leaf check (issue #122). base = full_data_domain_base(working) # BUG-1976: the same evidence ids and snapshot id the chat card reads (consult_facts/evidence_ids.py). diff --git a/tests/test_reading_facts_2106.py b/tests/test_reading_facts_2106.py index a609aa1af..1f3dc0e14 100644 --- a/tests/test_reading_facts_2106.py +++ b/tests/test_reading_facts_2106.py @@ -105,3 +105,17 @@ def test_narayana_direction_readings_are_read_when_stored_and_skipped_when_absen "start": "2025-02-24", "end": "2025-11-24"} assert second == {"profile": "classical_odd_even", "status": "blocked", "reason": "antardasha_not_selected", "default": False, "md": {"sign": "Leo", "lord": "Sun", "start_age": 66.0, "end_age": 75.0}} + + +def test_public_charts_carry_both_narayana_readings_without_rendering() -> None: + """BUG-2106 follow-up: facts built without rendering the data chapters still carry the second reading. + + _facts builds the packet and the facts directly (no render_full_data_markdown), which is the + path that used to miss narayana_dasha_report_extras until BUG-2107's ensure step. + """ + for case in ("steve_jobs_1955_aa", "barack_obama_1961_aa"): + block = _facts(case)["timing"]["narayana"].get("direction_readings") + assert block, case + assert block["use_in"] == "依据与边界" + assert len(block["readings"]) >= 1, case + assert all(isinstance(row.get("profile"), str) for row in block["readings"])