diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 996ee9491..3c00161a7 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -32676,4 +32676,15 @@ - **验证**:tsc 无错;改动文件 ESLint 0 错;people-archive-view、self-edit-people、add-profile-return-2397、chat-session-url、people 相关与 subject-switcher 测试共 91 条通过。内存紧张未做真浏览器截图,需推 staging 后手机上看。 - **防复发**:`people-archive-view` 新测试钉住五个主操作在同一网格、编辑不在网格里、编辑是右上角 44px 图标按钮、不再出现 `.people-archive-secondary`;两条旧断言按原值/新值/原因更新。 - **关联记录**:BUG-2400、BUG-2397、BUG-1081、BUG-2270。 + +## BUG-2403 | 报告格局状态两边说法不一致;英文状态列把 assessed 印成 assed + +- **状态**:resolved(待 staging) +- **现象**:① staging 上 `test_report_status_words_20261111` 两张公开盘失败:报告(Python)把「成立」的落陷取消行写「有缓解」,问答卡(Node)写「按所选规则的形成条件成立;强度和结果另评」。② 英文报告格局表状态列出现 "strength and results assed separately"。 +- **触发条件**:BUG-2392 后公开盘上出现「成立」的落陷取消行和 Raja 行;英文正文单元格经过 `pl9_full_data_export.py` 的 `clean()`。 +- **根因**:① Node 的 `yogaStatus` 没有 BUG-2303 那一条(成立的落陷取消行仍写「有缓解」),`isNeechaRow` 也少认 `neechabhanga_*` 与 `nicha_bhanga`;② `clean()` 里 `re.sub(r"([A-Za-z]{3,})\1", r"\1", text)` 没有词界,本意折叠 ConditionCondition,却把 assessed、Darakaraka、Putrakaraka、Trimsamsa、Chaturvimshamsha、Shashtashta、singing、bringing、contented 等真词里的重复字母段也折掉。 +- **修复**:Node 与 Python 用同一规则(成立的落陷取消行写「有缓解」/ "Mitigated",同一套落陷取消识别);`formed_under_source` 的读者用语按负责人「不两可」规则改为「条件都满足,成立」/ "All conditions met; formed"(原值带「强度和结果另评」);折叠正则加词界 `\b([A-Za-z]{3,})\1\b`。 +- **验证**:`test_report_status_words_20261111`、`test_report_reader_wording_2104`、`test_report_neecha_short_cell_2155`、`test_report_english_public_leak_2324` 通过;新增 `tests/test_english_word_dedup_2403.py`;前端 `consult-basis-candidate-status-1824`、`chat-aspects-2241`、`consult-yoga-status-wording-1825` 通过;tsc 无错。 +- **防复发**:Python/Node 状态对照测试(已有)覆盖成立的落陷取消行;新测试钉住折叠正则的词界和一批真词不被改。 +- **关联记录**:BUG-2303、BUG-2280、BUG-2104、BUG-2392。 - **修复版本**:1.5(staging)。 diff --git a/frontend/src/lib/yoga-status-words.ts b/frontend/src/lib/yoga-status-words.ts index 22e4a8484..7a16015ee 100644 --- a/frontend/src/lib/yoga-status-words.ts +++ b/frontend/src/lib/yoga-status-words.ts @@ -7,7 +7,7 @@ * |---|---| * | candidate / support_only_candidate | 命中候选规则,尚未完整确认 | * | computed,未完成来源条件治理 | 检出组合(BUG-2311,原值「检测器检出,待核实」) | - * | formed_under_source | 按所选规则的形成条件成立;强度和结果另评 | + * | formed_under_source | 条件都满足,成立(BUG-2403,原值「按所选规则的形成条件成立;强度和结果另评」) | * | conditions_not_met | 所选规则的必要条件未满足 | * | blocked / not_available_yet | 当前无法确认,列明缺项 | * @@ -26,7 +26,7 @@ export const YOGA_STATUS_MAPPING: Readonly; const CANDIDATE = "命中候选规则,尚未完整确认"; // BUG-2311 (产品负责人 2026-11-24) 原值「检测器检出,待核实」。 const COMPUTED = "检出组合"; -const FORMED = "按所选规则的形成条件成立;强度和结果另评"; +// BUG-2403 原值「按所选规则的形成条件成立;强度和结果另评」/ 新值「条件都满足,成立」/ 原因:负责人不要两可的话,报告与问答同表 +const FORMED = "条件都满足,成立"; const NOT_MET = "所选规则的必要条件未满足"; function cardWith(rows: Row[], hits: string[], extra: Row = {}): EvidenceCard { diff --git a/scripts/pl9_full_data_export.py b/scripts/pl9_full_data_export.py index 1a07e72e9..563619f88 100644 --- a/scripts/pl9_full_data_export.py +++ b/scripts/pl9_full_data_export.py @@ -1575,7 +1575,9 @@ def _render_pl9_ai_density_raw_data_markdown_en(packet: dict, language: str = "e text = re.sub(r"^(\d+)weak/$", r"house \1 weak", text) text = re.sub(r"^(\d+)/$", r"house \1 condition", text) text = re.sub(r"^//,\s*", "", text) - text = re.sub(r"([A-Za-z]{3,})\1", r"\1", text) + # BUG-2403: 原值 r"([A-Za-z]{3,})\1"(无词界,把 assessed 吃成 assed、Darakaraka/Trimsamsa/singing 等也会坏); + # 新值只折叠整词重复(ConditionCondition、VenusVenus)。 + text = re.sub(r"\b([A-Za-z]{3,})\1\b", r"\1", text) text = re.sub( r"\b(Mars|Jupiter|Venus|Saturn|Mercury|Sun|Moon|Rahu|Ketu)(\d{1,2})\b", r"\1 \2", diff --git a/scripts/report_render/yoga_status_words.py b/scripts/report_render/yoga_status_words.py index 62ab864d4..f8eb3c1bd 100644 --- a/scripts/report_render/yoga_status_words.py +++ b/scripts/report_render/yoga_status_words.py @@ -13,7 +13,8 @@ YOGA_STATUS_MAPPING = { # BUG-2311 (产品负责人 2026-11-24): 原值「检测器检出,待核实」;新值不写「待核实」(BUG-2280 同一规则), # 表格本身已分「成立 / 检出组合 / 暂无法判断」。 "computed": {"evidence": ["computed"], "text": "检出组合"}, - "formed_under_source": {"evidence": ["formed_under_source"], "text": "按所选规则的形成条件成立;强度和结果另评"}, + # BUG-2403 (负责人「不两可」规则): 原值「按所选规则的形成条件成立;强度和结果另评」;新值「条件都满足,成立」,与 Node 同表。 + "formed_under_source": {"evidence": ["formed_under_source"], "text": "条件都满足,成立"}, "conditions_not_met": {"evidence": ["conditions_not_met"], "text": "所选规则的必要条件未满足"}, "blocked": {"evidence": ["blocked", "not_available_yet"], "text": "当前无法确认,列明缺项"}, } @@ -22,7 +23,7 @@ YOGA_STATUS_MAPPING = { YOGA_STATUS_TEXT_EN = { "candidate": "Rule matched, not fully confirmed", "computed": "Combination detected", # BUG-2311: 原值 "Detected, to be verified" - "formed_under_source": "Formed under the chosen source; strength and results assessed separately", + "formed_under_source": "All conditions met; formed", # BUG-2403: 原值 "Formed under the chosen source; strength and results assessed separately" "conditions_not_met": "Required conditions of the chosen source not met", "blocked": "Cannot be confirmed yet", } diff --git a/tests/test_english_word_dedup_2403.py b/tests/test_english_word_dedup_2403.py new file mode 100644 index 000000000..d6340e0a3 --- /dev/null +++ b/tests/test_english_word_dedup_2403.py @@ -0,0 +1,23 @@ +"""BUG-2403: the English cell cleaner folded any repeated letter run, turning "assessed" into "assed".""" + +import re +from pathlib import Path + +SOURCE = Path(__file__).resolve().parents[1] / "scripts" / "pl9_full_data_export.py" + + +def _dedup_pattern() -> re.Pattern: + text = SOURCE.read_text(encoding="utf-8") + match = re.search(r'text = re\.sub\(r"(\\b\(\[A-Za-z\]\{3,\}\)\\1\\b)", r"\\1", text\)', text) + assert match, "the whole-word repeat fold must keep its word boundaries" + return re.compile(match.group(1)) + + +def test_whole_word_repeats_fold_and_real_words_survive(): + pattern = _dedup_pattern() + fold = lambda value: pattern.sub(r"\1", value) # noqa: E731 + assert fold("ConditionCondition") == "Condition" + assert fold("VenusVenus") == "Venus" + for word in ("assessed", "possesses", "Darakaraka", "Putrakaraka", "Trimsamsa", "Chaturvimshamsha", + "Shashtashta", "singing", "bringing", "contented", "Mississippi"): + assert fold(f"strength and results {word} separately") == f"strength and results {word} separately" diff --git a/tests/test_report_status_words_20261111.py b/tests/test_report_status_words_20261111.py index d936dbc60..4747d0a03 100644 --- a/tests/test_report_status_words_20261111.py +++ b/tests/test_report_status_words_20261111.py @@ -19,6 +19,7 @@ from scripts.report_render.technique_status_axes import ( parse_technique_audit_status, technique_audit_axes, ) from scripts.report_render.yoga_status_words import ( + yoga_status_cell, YOGA_STATUS_TEXT_EN, UNEVALUATED_FIELDS, YOGA_BLOCKED_PREFIX, YOGA_FIELDS, YOGA_GAP_NOT_EVALUATED, YOGA_GAP_NO_ROW, YOGA_NOTICE_EN, YOGA_NOTICE_ZH, YOGA_STATUS_MAPPING, @@ -152,6 +153,8 @@ _ZH_RENDERED_YOGA_NAMES = { "月后行星 Yoga(精确)": "月后行星瑜伽(精确)", "日前行星 Yoga(精确)": "日前行星瑜伽(精确)", "Saraswati Yoga": "Saraswati瑜伽", + # BUG-2403: 原值无此条 / 新值同 Saraswati 的渲染 / 原因:BUG-2392 后公开盘多出这一行候选,正文同样把 Yoga 写成「瑜伽」 + "Matrudeerghayur Yoga": "Matrudeerghayur瑜伽", # 原值: "火星婚姻煞(火星入1/4/7/8/12宫)" 渲染成 "火星婚姻煞(火星入1/第4宫条件第7宫条件第8宫条件12宫)" # 新值: 名字原样渲染,这里不再有这一条 # 原因: BUG-2065 数字斜杠清单是清单,不改写成「第 N 宫条件」 @@ -253,7 +256,9 @@ def test_public_reports_match_native_yoga_status_and_audit_axes(case): # 原值: 英文状态列是原始键 yoga_status(row)[0](candidate / computed) # 新值: 英文状态列是读者用语 YOGA_STATUS_TEXT_EN[键](与中文状态文字逐条对应) # 原因: BUG-2104 读者正文不出现原始状态键 - expected_en = Counter((" / ".join(_EN_RENDERED_YOGA_NAMES.get(name, name) for name in names), YOGA_STATUS_TEXT_EN[yoga_status(row)[0]]) + # BUG-2403: 原值 YOGA_STATUS_TEXT_EN[键] / 新值 yoga_status_cell(成立的落陷取消行英文写 "Mitigated",与中文「有缓解」对应) + # 原因:BUG-2303 起成立的 Neecha Bhanga 行读者用语是「有缓解」,英文同一处 + expected_en = Counter((" / ".join(_EN_RENDERED_YOGA_NAMES.get(name, name) for name in names), yoga_status_cell(*yoga_status(row), "en")) for row, display in rows for names in [[row["name"], *(other["name"] for other in display.get("same_fact", []))]]) expected_zh = Counter(("/".join(_ZH_RENDERED_YOGA_NAMES.get(name, name) for name in names), yoga_status(row)[1])