fix(report): one yoga status table for report and chat; English cell fold keeps real words (BUG-2403)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -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)。
|
||||
|
||||
@@ -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<Record<YogaStatusKey, { readonly evid
|
||||
candidate: { evidence: ["candidate", "support_only_candidate"], text: "命中候选规则,尚未完整确认" },
|
||||
// BUG-2311 (产品负责人 2026-11-24): 原值「检测器检出,待核实」。
|
||||
computed: { evidence: ["computed"], text: "检出组合" },
|
||||
formed_under_source: { evidence: ["formed_under_source"], text: "按所选规则的形成条件成立;强度和结果另评" },
|
||||
formed_under_source: { evidence: ["formed_under_source"], text: "条件都满足,成立" },
|
||||
conditions_not_met: { evidence: ["conditions_not_met"], text: "所选规则的必要条件未满足" },
|
||||
blocked: { evidence: ["blocked", "not_available_yet"], text: "当前无法确认,列明缺项" },
|
||||
};
|
||||
@@ -59,14 +59,21 @@ export const NEECHA_MITIGATED_TEXT = "有缓解";
|
||||
|
||||
function isNeechaRow(row: Rec): boolean {
|
||||
const ruleId = (text(row.rule_id) ?? "").toLowerCase();
|
||||
return ruleId.includes("neecha_bhanga") || (text(row.category) ?? "").toLowerCase() === "neecha_bhanga"
|
||||
|| (text(row.name) ?? "").toLowerCase().startsWith("neecha bhanga");
|
||||
const category = (text(row.category) ?? "").toLowerCase();
|
||||
const name = (text(row.name) ?? "").toLowerCase();
|
||||
// BUG-2403: same test as the report (scripts/report_render/yoga_status_words.py _is_neecha_row, BUG-2303):
|
||||
// her neechabhanga_* rules and the nicha_bhanga category count too.
|
||||
return ruleId.includes("neecha_bhanga") || ruleId.startsWith("neechabhanga_")
|
||||
|| category === "neecha_bhanga" || category === "nicha_bhanga"
|
||||
|| name.startsWith("neecha bhanga") || name.startsWith("neechabhanga");
|
||||
}
|
||||
|
||||
export function yogaStatus(row: Rec | undefined, options: { notEvaluated?: boolean } = {}): YogaStatus {
|
||||
if (!row) return blocked(options.notEvaluated ? YOGA_GAP_NOT_EVALUATED : YOGA_GAP_NO_ROW);
|
||||
const formation = text(rec(row.formation).status);
|
||||
// 只有完整条件检查的结果才能说“成立”或“必要条件未满足”。
|
||||
// BUG-2403 (= report BUG-2303): a formed Neecha Bhanga row still reads 「有缓解」 for the reader.
|
||||
if (formation === "formed_under_source" && isNeechaRow(row)) return { key: "formed_under_source", text: NEECHA_MITIGATED_TEXT };
|
||||
if (formation === "formed_under_source") return { key: "formed_under_source", text: YOGA_STATUS_MAPPING.formed_under_source.text };
|
||||
if (formation === "conditions_not_met") return { key: "conditions_not_met", text: YOGA_STATUS_MAPPING.conditions_not_met.text };
|
||||
const status = text(row.status);
|
||||
|
||||
@@ -234,7 +234,8 @@ test("BUG-2241: the owner's plain status wording in chat answers; the shared sou
|
||||
];
|
||||
for (const [before, after] of cases) assert.equal(ownerChatWording(before).output, after, before);
|
||||
// The status words the chart page and reports read are unchanged.
|
||||
assert.equal(YOGA_STATUS_MAPPING.formed_under_source.text, "按所选规则的形成条件成立;强度和结果另评");
|
||||
// BUG-2403 原值「按所选规则的形成条件成立;强度和结果另评」/ 新值「条件都满足,成立」/ 原因:负责人不要两可的话
|
||||
assert.equal(YOGA_STATUS_MAPPING.formed_under_source.text, "条件都满足,成立");
|
||||
// BUG-2280: saying the debilitation has mitigation is no mismatch any more (the neecha_mitigation check was removed).
|
||||
assert.deepEqual(kinds("木星落陷,但有缓解。"), []);
|
||||
});
|
||||
|
||||
@@ -26,7 +26,8 @@ type Row = Record<string, unknown>;
|
||||
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 {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user