同一份真实盘包在屏蔽与不屏蔽 PyJHora 下新旧渲染 sha 都一致,各 24 项且退出码 0。指定 pytest 233 通过、3 跳过。 Co-Authored-By: Grok (agent loop)
3.3 KiB
3.3 KiB
PROGRESS · 报告渲染函数拆分第一阶段
- 日期:2026-10-15
- 分支:
codex/pl9-render-split-20261013 - 基线:
origin/staging32b238cf8619cfab4b1107059ec997c974eb0d13 - 范围:只做任务书第一阶段。不改 BUG_HISTORY(开工最大号 BUG-1357,本单不占号)、CHANGELOG、前端、API 服务器。
做了什么
把 render_pl9_markdown 里不依赖外层数据的 34 个嵌套函数原样搬到 scripts/report_render/。函数体只把 planet_label_cn 改成模块常量 PLANET_LABEL_CN。SIGNS / SIGNS_CN 按原字面量抄到 text.py,避免新包顶层导入引擎。
| 模块 | 函数 |
|---|---|
| envelope.py | _unwrap _envelope_list _envelope_dict _bool_text _source_dict _has_executed_payload |
| text.py | _humanize_reader_token _humanize_reader_group _humanize_tajika_candidate _humanize_tajika_motion _display_rashi_from_value _humanize_reader_summary_line _humanize_annual_highlight_line _humanize_annual_narrative_highlight _humanize_domain_title _workbook_readable_label _workbook_readable_sentence _workbook_reading_paragraph _md_cell _render_compact_payload _sign_text _value_text _compose_narrative_paragraph _append_unique_text _planet_list_text |
| sections_misc.py | _render_boundary_packet_summary_line _status_from_report_pack_section _section_evidence_boundary _domi_pl9_current_gap_appendix _chart_planets_from_positions _kp_house_focus_text _high_value_theme_authority_sentence _kp_conflict_adjudication_sentence _prashna_exact_cusp_boundary_sentence |
排除
_degree_text:函数内定义两次,本阶段不搬。_sign_degree_text、_longitude_text:任务书点名与度数簇一起排除。_profile_aware_benchmark_appendix:要读引擎里的_blocked_planned_section和ROOT_DIR。新包不能顶层导入引擎,否则成环,也过不了干净进程导入测试。- 依赖外层数据、或调用上述未搬函数的嵌套函数:留给下一阶段。
前后
| 项 | 搬之前 | 搬之后 |
|---|---|---|
render_pl9_markdown 行数 |
6917 | 6506 |
| 嵌套函数 | 148 | 114 |
行数少了 411,嵌套函数少了 34。没有改既有断言。
检查
| 检查 | 命令 | 结果数字 |
|---|---|---|
| 未搬移,不屏蔽 | report_render_split_diff.py |
退出码 0,24 项 |
| 未搬移,屏蔽 | 同上 --mask-pyjhora |
退出码 0,24 项 |
| 搬移后,不屏蔽 | 同上 | 退出码 0,24 项 |
| 搬移后,屏蔽 | 同上 --mask-pyjhora |
退出码 0,24 项 |
| 指定 pytest + 隐私扫描 | .venv\Scripts\python.exe -m pytest 任务书列表与 tests/test_repo_privacy_markers.py |
退出码 0;236 收集,233 通过,3 跳过,0 失败 |
同一轮里,基线工作树和新代码渲染同一份 pickle,24 个 sha 全部相同。完整数据版中英 8 个 sha 在四轮里不变。屏蔽那轮曾有一次基线对基线不一致:夜间盘接口响应里年主重放一会儿是超时、一会儿是导入失败。这是屏蔽后的外部重放抖动,不是这次搬函数引入的。原样重跑后退出码 0。
偏离
任务书预期行数下降约 600 到 900。实际 411,因为上面三个排除项里有一份 142 行的附录。没有做第二阶段及以后。