fix(report): keep the English edition when one phrase was untranslated

The English personal report was discarded whenever a Chinese fragment survived the trailing glossary. English sections now render the English fields that were already calculated.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-22 02:56:00 +08:00
co-authored by Grok (agent loop) Cursor
parent 9812f31737
commit ba1ffeb35f
18 changed files with 815 additions and 53 deletions
@@ -0,0 +1,94 @@
# 进度:个人报告英文版不再整份丢掉
结论:英文版改在源头写英文。200 张固定虚构盘的英文都回来了,汉字为 0,粘连词为 0。中文版在同一随机种子下与 `bd3ce0e7b` 逐字节相同。
## 改了哪些源头
| 源头 | 英文现在用什么 |
| --- | --- |
| Rath 段 | `rath_summary_line_en` / `rath_report_lines_en` / `_ad_direction_lines_en`。级别写成 `level N` |
| 瑜伽强度 | 先用 `strength_en`,没有再查 `STRENGTH_EN`。Punarphoo 仍是 `observational`。`部分减弱` 补了 `partly weakened` |
| Panchanga | 新增 `overall_quality_en`:Auspicious (Subha) / Mixed / Inauspicious (Asubha)。中文三档没改 |
| Dosha | Mangal、Kaal Sarp、Pitra、Sade Sati 新增 `summary_en`。英文结果表用它 |
| Jaimini | 新增 `KARAKA_DOMAINS_EN` 和 `domain_en`。中文职责没改 |
| 标题 | 英文用 Vimsopaka 英文标题、Jaimini 英文标题。中文标题没改 |
| 结构化附录瑜伽表 | 英文改读 `combination_en` / `strength_en` / `effects_en`。还有汉字就留空 |
| 一条英文模板 | `bvr_bandhubhisthyaktha_precise` 的英文从 `weak/afflicted` 改为 `weak or afflicted`。中文模板没改 |
第一轮改完 Rath、Dosha 和瑜伽强度之后,粘连词还在。原因是结构化附录仍在打印中文组合,以及英文模板里的 `weak/afflicted` 会被原有清理收成 `weakafflicted`。这两处都改在生产者,没有改词表。改完之后 200 张盘的粘连词为 0。
## 粘连词:改前 16 张,改后 200 张
改前是同一生成器的 0–15 号,在改代码之前渲染的英文。7 张当时整份被丢掉(有汉字)。下表是丢掉之前英文正文里的次数。改后 200 张(进程池)这些词都是 0。
| 词 | 改前 16 张里出现的盘数 | 改后 200 张 |
| --- | --- | --- |
| scoreandtimeline | 16 | 0 |
| marriagequality | 16 | 0 |
| whetherinunderway | 16 | 0 |
| withSaturn | 16 | 0 |
| careerplanetAmK | 16 | 0 |
| careerdirection | 16 | 0 |
| supportingstrongdegree | 16 | 0 |
| beneficfactor count | 16 | 0 |
| comparativelystrong | 16 | 0 |
| house seven-round | 16 | 0 |
| weakafflicted | 14 | 0 |
| lordandstrong | 12 | 0 |
| planetenterssign | 9 | 0 |
| occupiesplanetcount | 7 | 0 |
| debilitatedsign | 7 | 0 |
| [source text retained | 7 | 0 |
| lordstrongand | 6 | 0 |
| partialreducedweak | 6 | 0 |
| house 5 level | 5 | 0 |
| Dashasignpresent | 4 | 0 |
| inperiod start | 3 | 0 |
| planetsdistributed | 3 | 0 |
| planetsinbetween | 3 | 0 |
| beneficlocated | 2 | 0 |
| aturninperiod | 1 | 0 |
| atpresent | 0 | 0 |
## 测试耗时(Windows)
| 检查 | 命令 | 结果 |
| --- | --- | --- |
| 200 张,进程池 4 | `pytest tests/test_report_english_sweep.py` | 3679 秒,退出码 0 |
| smoke 12 张,进程池 4 | `pytest tests/test_report_english_sweep_smoke.py` | 199.6 秒,退出码 0 |
| 变异:英文 Rath 行改回中文后再跑 smoke | 同上 | 183.8 秒,12/12 `han_leak`,退出码 1。已改回 |
| 单张渲染 | 同一生成器的一张盘 | 约 43 秒 |
串行没有整文件再跑一遍。按单张约 43–70 秒估算,smoke 串行大约 9–14 分钟,200 张串行大约 2.5–4 小时。进程池的 200 张已经超过 10 分钟,按任务书让步第 4 条记下实测时间,没有减少盘数。
smoke 在这台 Windows 上是 199 秒,长过快速门单文件 90 秒。时间主要耗在屏蔽 PyJHora 之后,年度回放子进程空等。没有改这个等待,也没有把 200 张放进快速门。
## 中文逐字节
30 张:0–27、32、34。覆盖第 5 级(4)、凶(5)、计都反向(1)、Table 14(5)、Punarphoo(34)、完全 Kaal Sarp(32)。
同一 `PYTHONHASHSEED=0` 下,本分支和 `bd3ce0e7b` 的中文完整数据版 SHA-256 全部相同(30/30)。
不固定哈希种子时,王者格那一行的配对会在进程之间变(同一张盘一次是金星、一次是土星)。这在改代码之前就有。固定种子后两边一致,所以不是这次英文改动造成的。
## 编号和基线
- 本分支上的 `docs/BUG_HISTORY.md` 原来最大是 BUG-1403。`origin/staging` 已有 BUG-1409(#90)。本单用 BUG-1410、BUG-1411。1404–1408 仍空着。
- 实现基线是任务书指定的 `9812f317`。其后 staging 又多了 10 个提交,其中 #87 改了 `pl9_reader_export.py` 的上升状态格。本分支没有变基。合入时两边应各自保留。
- T1–T7 在同一次提交。T5 的粘连和附录瑜伽表是同一处英文路径,没有拆成第二次提交。
## 真机复测
合入并部署到 staging 之后:
1. 登录 staging。
2. 新建一份个人报告。
3. 揭幕之后切到 English。
4. 全文搜不到汉字。第 5 级、凶、计都反向、Table 14、Punarphoo、完全 Kaal Sarp 这几类句子读得通(一份报告未必同时有这六类,有哪类就核对哪类)。
5. 导出英文版。
6. 已经生成过的旧报告需要重新生成,才有英文版。
## 环境
- 快速门、全量 pytest、前端判定没有在这台机器上跑,留给验收。
- 没有登录 staging,真机步骤还没做。
+1 -1
View File
@@ -514,4 +514,4 @@
| `TASK-other-subject-birth-time-edit-20261021.md` | — | 其他人的出生时间可以修改(去掉 `chart_profiles_guard_birth` 的填报时间不可改;推翻 people-archive P1 §验收 2 该条;active 锁不变) | 排队(等 #86 合入) | `codex/other-subject-birth-time-edit-20261021`;动表;不进循环 |
| `TASK-chart-ascendant-slash-20261021.md` | — | #87 上升状态格「不适用」改「/」+ 悬停 / 点按说明;报告上升行同改并在表下加说明(推翻 10-15 口径) | 待领取(等 #86 合入) | `codex/chart-ascendant-slash-20261021` |
| `TASK-report-export-dialog-polish-20261021.md` | — | #90 导出弹窗:英文不可用说明改顶部浮层(每次打开一次);选中态描边 / 圆点 / 勾选框用主题色、底色中性(推翻 DESIGN「Selected states use canvas-muted + ink」,BUG-1078 主语保留) | 待领取(可与 #89 并行) | `codex/report-export-dialog-polish-20261021` |
| `TASK-report-english-han-leak-20261021.md` | `PROGRESS-report-english-han-leak-20261021.md` | #89 个人报告英文版约 4 成整份丢弃:漏译汉字源头补英文孪生字段、修吃空格;200 张固定种子回归 + 快速门 smoke(复发自 BUG-1272);中文逐字节不变 | 待领取(最先做;#91/#92 在后) | `codex/report-english-han-leak-20261021` |
| `TASK-report-english-han-leak-20261021.md` | `PROGRESS-report-english-han-leak-20261021.md` | #89 个人报告英文版约 4 成整份丢弃:漏译汉字源头补英文孪生字段、修吃空格;200 张固定种子回归 + 快速门 smoke(复发自 BUG-1272);中文逐字节不变 | 待验收 | `codex/report-english-han-leak-20261021` |