test(report): expect parenthesized karaka names in the full-data table

The Chinese full-data body prints karaka names with parentheses after the glued-phrase pass. The BPHS order test still expected the KARAKA_CN literals and failed the full pytest run. Expect translate_zh_glued_phrases of KARAKA_CN instead of editing KARAKA_CN.

Pytest of the karaka file, the six report contract files, and privacy markers: 154 passed. tsc exit 0. lint 0 errors, 125 warnings.

Co-Authored-By: Grok (agent loop)
This commit is contained in:
jesse-ux
2026-10-13 15:55:56 +08:00
co-authored by Grok (agent loop)
parent 7242648e45
commit 830e5d0267
3 changed files with 25 additions and 2 deletions
+1 -1
View File
@@ -17624,7 +17624,7 @@
- 现象:中文报告里出现 listed、background、native、Custom condition met,以及「木星Jupiter…」这种中英粘在一起的字。星宿、瑜伽名放在括号里是允许的。
- 根因:中文完整数据版是在英文原文上做短词替换。短词先换会把长句切碎;有的格子本身就是英文枚举,中文版原样印出。瑜伽组合在中文路径仍优先取了英文组合句。行星中文名已经带英文,庙旺又紧挨着拼上去,中间没有空格。
- 修复:中文路径先整句、长词,再短词。宫主状态换成「当前运行 / 背景」,listed 换成「已列出」,native 换成「本命」,自定义条件换成「满足自定义条件」。中文瑜伽用中文组合句。不改行星中文名本身,也不改八分法引擎文件;报告层把粘在一起的方法名改成带空格的读法。残留门只数附录之前的正文,图盘围栏不计入:汉字与至少 3 个拉丁字母直接粘连为 0,功能词 of/in/the/and/by/from/with/listed/background/native/condition/met/satisfied/occupied 为 0。括号里的梵文和表头缩写 SAV、BAV、KP、D1–D60 不在这两项里。
- 验证:故意写入「木星Jupiterexalted」时残留门为 fail。虚构日盘、虚构夜盘、一张公开名人盘(爱因斯坦)的中文完整数据版都是粘连 0、功能词 0。`tests/test_report_chart_blank_columns.py` 16 通过。
- 验证:故意写入「木星Jupiterexalted」时残留门为 fail。虚构日盘、虚构夜盘、一张公开名人盘(爱因斯坦)的中文完整数据版都是粘连 0、功能词 0。`tests/test_report_chart_blank_columns.py` 16 通过。打回第 1 次:报告星位表已印成「灵魂星(AK)」这类带括号的名字,`test_reader_report_karaka_table_is_in_bphs_order` 仍按 `KARAKA_CN` 原字面值比对,已改为经 `translate_zh_glued_phrases` 后再比对。`KARAKA_CN` 未改。
- 防复发:`_pl9_markdown_hygiene_receipt(language="zh")` 把上述两项写成违规。
- 相关记录:BUG-1313、BUG-1314。
- 复发自:无。
@@ -31,3 +31,20 @@
| 隐私标记 | `.venv\Scripts\python -m pytest tests/test_repo_privacy_markers.py -q --tb=line` | 63 通过,退出码 0 |
未跑:前端全量 `npm test`、Python 快速门、`npm run test:db`、`next build`。
## 第 1 次打回(2026-10-13)
修复单:`docs/tasks/TASK-report-translation-gaps-fix-20261013.md`。报告四项本身不改。
- 修复单要求变基到当时的最新 `origin/staging`(`d79f42b04ba225e5be39d8567a7fdd38223e19fe`)。本地变基后的文件内容与现在相同,但这台机器不允许改写已经推送过的分支。因此改为把这份 staging 合并进本分支:测试版是本分支的祖先,推送不用改写历史。报告生成和星位中文原名没有再动。
- 只改 `tests/test_chara_karaka_8_bphs_order.py` 里报告星位表那一条。期望值改成 `translate_zh_glued_phrases(KARAKA_CN[role])`,也就是「灵魂星(AK)」这一类。`scripts/jaimini.py` 的 `KARAKA_CN` 没改。
- 检索 `tests` 与 `frontend/tests`:按 `KARAKA_CN` 原字面值断言完整数据版报告正文的,只有这一条。`frontend/tests/fixtures/report-reader-main-fictional-zh-pair.json` 未改。咨询金样和旧阅读版夹具里的「灵魂星AK」不是这份报告正文,未改。
- `tests/test_prashna_sphuta_review_result_validator.py` 里基线已有的失败未动。
| 检查 | 命令 | 结果 |
| --- | --- | --- |
| 星位表、§8 六个文件、隐私标记 | `.venv\Scripts\python -m pytest tests/test_chara_karaka_8_bphs_order.py tests/test_report_chart_blank_columns.py tests/test_report_english_edition.py tests/test_reader_appendix_language.py tests/test_reader_appendix_shared_rules.py tests/test_report_reader_main.py tests/test_chart_page_vedic_tables_contract.py tests/test_repo_privacy_markers.py -q --tb=line` | 154 通过,退出码 0 |
| 类型检查 | `frontend\node_modules\.bin\tsc --noEmit -p frontend` | 退出码 0 |
| 前端 lint | `npm run lint --prefix frontend` | 0 error,125 warning |
未跑:前端全量 `npm test`、Python 快速门、`npm run test:db`(本轮没动数据库)、`next build`。
+7 -1
View File
@@ -62,6 +62,7 @@ def test_reader_report_karaka_table_is_in_bphs_order() -> None:
import copy
from scripts.jaimini import KARAKA_CN
from scripts.pl9_language_terms import translate_zh_glued_phrases
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
from tests.test_report_english_edition import CASES, _packet
@@ -70,4 +71,9 @@ def test_reader_report_karaka_table_is_in_bphs_order() -> None:
lines = markdown.splitlines()
start = next(i for i, line in enumerate(lines) if line.startswith("### Jaimini Karaka"))
rows = [line for line in lines[start + 1:start + 14] if line.startswith("| ") and "星" in line.split("|")[1]]
assert [row.split("|")[1].strip() for row in rows] == [KARAKA_CN[role] for role in BPHS_8]
# 原值:[KARAKA_CN[role] for role in BPHS_8](灵魂星AK、事业星AmK、兄弟星BK、母亲星MK、父亲星PiK、子女星PK、障碍星GK、配偶星DK)
# 新值:[translate_zh_glued_phrases(KARAKA_CN[role]) for role in BPHS_8](灵魂星(AK)、事业星(AmK)、兄弟星(BK)、母亲星(MK)、父亲星(PiK)、子女星(PK)、障碍星(GK)、配偶星(DK))
# 原因:完整数据版正文会给这八个星位名的缩写加括号,避免三字母缩写被粘连检查判中。KARAKA_CN 仍是原字面值,咨询和星盘页继续用它。
assert [row.split("|")[1].strip() for row in rows] == [
translate_zh_glued_phrases(KARAKA_CN[role]) for role in BPHS_8
]