Files
Jyotisha/docs/tasks/PROGRESS-rectification-engine-memoization-20260915.md
T
jesse-ux 53a37ce944
Independent Staging Quality Gate / validate (push) Canceled after 1m57s
Independent Staging Quality Gate / publish (push) Canceled after 0s
fix(rectification): 候选分钟不变量记忆化(BUG-721)
Shadbala / Ashtakavarga / Dasha 时间轴进 static context;过境盘按事件日期缓存 chart;探针网格相同时只算一次。打分与决策回执与基线 golden 逐字相同(剔除计时字段)。
2026-09-16 07:11:07 +08:00

62 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS · 重算记忆化(2026-09-15 / 执行 2026-09-16
- 执行分支:`codex/rectification-engine-memoization-20260915`
- 工作树:`.worktrees/rectification-engine-memoization-20260915`
- 任务书基线:`6b3248bf`(已被后续合入)。本机开工 `HEAD` = `origin/staging` = `a8d29d1b`
- BUG`BUG-721`(落库时最大号仍是 720,未顺延)
## 开工前置
| 项 | 结果 |
| --- | --- |
| `git status -sb` 第一行 | `## codex/rectification-engine-memoization-20260915...origin/staging` |
| `HEAD` | `a8d29d1b` |
| BUG_HISTORY 检索 | `重复计算` / `shadbala` / `scoring_service` / `_cached_rows`:无同模块分层遗漏记录。最大号 BUG-720 |
| 本机 Python | 主仓 `.venv` 是 25 字节指针。本 worktree 用 Anaconda 3.11.7 `--system-site-packages` 建真实 venv,复用已有 `pyswisseph 2.10.3.2` / swisseph `20230604`,未升级该包 |
| 基线 golden | 改代码前用 `a8d29d1b` 真实跑出 `tests/golden/rectification_engine_memoization_v1.json`。golden 测试改前绿 |
未改 `docs/tasks/README.md` 状态列。未推 staging。未改 `jyotish_api_server.py`、前端、`sample_event_dates``_SWISSEPH_LOCK`
## 做了什么
6.1–6.6 全做,未按 §8 让步砍项。
| 条 | 做法 |
| --- | --- |
| 6.1 | `build_candidate_static_context` 把已算的 `ashtakavarga_result` / `shadbala_result` 挂进 context。辅助函数只读结果做判定。Shadbala 只复用 `sthana_bala.total` / `drik_bala` / `naisargika_bala`;测试证明带/不带 `birth_minute` 这三项相等。`birth_minute` 双算不修(§4.3 |
| 6.2 | Vimshottari 时间轴、Narayana 周期表进 context`_active_vimshottari` / `_active_narayana` 只留 `find_current` / `get_current_narayana_dasha` |
| 6.3 | `compute_event_candidate_rows` 内局部字典按事件日期缓存过境 **chart**;规则仍按候选算。`precision == "year"` 仍早退 `[]` |
| 6.4 | `probe_times == grid_times``discriminating_event_probe_set` 结果复用给 contrast`refresh_probes` 且 refresh 列存在时仍两次 |
| 6.5 | 删除 `scoring_service._cached_rows``_canonical` 仍被 `sha256` 使用,保留 |
| 6.6 | 公开 1990-01-01 北京烟测盘 + 虚构事件。golden 由基线代码跑出,禁止手造 |
记忆化只在请求内:static context dict,以及 `compute_event_candidate_rows` / `build_refinement_packet` 栈内局部字典。无模块级跨请求缓存。
## 测试
定向(任务书 §9 + 本单新文件):
| 套件 | 结果 |
| --- | --- |
| `tests/test_rectification_engine_memoization.py` | **10 passed** |
| `test_rectification_v5_services.py` 等 7 个任务书名单 | 与本单文件合计 **129 passed** |
| quality-gate quick 的 pytest(含 `tests/test_rectification_*.py` | **776 passed, 1 skipped**575.78s |
本机 `run_quality_gate.py --profile quick` 在 pytest 之后的 `npm test` 失败:`tsx` 不在 PATH(Windows 前端环境缺口)。本单未改前端,不把这条写成通过。
未改任何既有断言的期望值。测试总数高于开工时(新增 10 条)。
## CHANGELOG
未改。纯内部记忆化,用户可见打分与决策回执逐字不变(计时字段除外)。
## 偏离
- 任务书写 `.venv/bin/python`,本机换成 `.\.venv\Scripts\python.exe`
- golden 测试只锁 `candidate_scores` 与剔除 `column_compare_ms``decision_receipt`6.6 原文)。`candidate_feature_snapshot` 写进 golden 文件备查,不作为 pytest 硬断言:KP/Hora 指纹在 pytest 全量收集下会出现第二条稳定哈希,与打分无关。
-`git push origin HEAD:staging`
## 观察项(不修)
`build_candidate_static_context` 的 Shadbala `birth_hour = hour + minute/60` 同时又传 `birth_minute`,只流进 fingerprints,本单照搬。