Files
Jyotisha/docs/tasks/PROGRESS-dasha-unify-20261013.md
T
jesse-uxandGrok (agent loop) 5ac88e58f5 让大运接口走完整解读的同一套算法,不再返回编出来的周期。
Ashtottari 在适用时把出生前已经走过的部分算进时间线。

Co-Authored-By: Grok (agent loop)
2026-10-16 00:52:29 +08:00

78 lines
6.2 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 · dasha-unify · 2026-10-16
分支 `codex/dasha-unify-20261013`,从 `origin/staging` `b9cbe9aa` 拉出。issue #69。
## 结论
`/api/dasha` 除 Vimshottari 外改为调用完整解读同一批模块。没有真实现的体系返回「未实现」,不再编周期。占位文件 `scripts/extended_dashas.py`、`scripts/conditional_dashas.py` 已删除。Ashtottari 在已判定适用、且月亮落在起运星宿组内时,第一段从出生时刻减去已走过的部分起算。Narayana 仍标「旧算法」,没有换成 Rath 版。
## 映射(最终)
| 注册键 | 实现 |
| --- | --- |
| vimshottari | 原 handler 分支,`domain_calculation_service.compute_vimshottari_timeline` |
| yogini / ashtottari / kalachakra | 与完整解读相同的函数和入参。Ashtottari 额外带月亮经度 |
| panchottari、satabdika、chaturaaseeti、shasti_hayani、shodasottari、dwadashottari、dwisaptati、shattrimsa | 独立模块 `calculate_*`,入参与 `conditional_birth_info` 相同,并带 `PYJHORA_PARENT_SEEDED_EQUAL_SPLIT_PROFILE`。不传强制出表档,不适用的盘主运为空 |
| narayana | `narayana_dasha_full_report` + `label_legacy_narayana` |
| shoola | `rashi_dashas_native.calculate_rashi_dashas` 的 `shoola` 段(`shoola_forward_md_direct_ad_v1`) |
| chara | 400,消息含 `/api/dasha/chara` |
| 其余 | 400,`dasha system not implemented` |
`precision`:权威实现为 `engine_module`。删掉 `generic` 和 `calculator`。
## 基线红 / 修后绿
开工时测试还没写,没有在旧代码上跑新 pytest。占位输出用 `git show HEAD:scripts/extended_dashas.py` 复现(虚构盘、月宿 22):
| 体系 | 占位前 3 段 |
| --- | --- |
| panchottari | Ketu 1990-01-01、Venus 2002-01-01、Sun 2014-01-01 |
| satabdika | Ketu 1990-01-01、Venus 2001-01-01、Sun 2012-01-02 |
| chaturaaseeti | Ketu 1990-01-01、Venus 1999-01-01、Sun 2008-01-02 |
| narayana | Pisces 3 年、Capricorn 6 年、Aquarius 9 年 |
修后 `tests/test_dasha_api_engine_parity.py`:9 通过,0 失败。接口主运与完整解读同一模块逐项相等。Panchottari / Satabdika / Chaturshitisama 在标准出表档下,主运起始日与 PyJHora 4.8.7 逐日相同。Ashtottari 三张盘(虚构盘走默认规则族,一张公开盘走 Rahu 规则族,另一张公开盘走默认规则族)起止日与 PyJHora 相差不超过 1 天,起运星一致,出生时刻落在第一段内,当前大运与按日期查表一致。
## 自测
| 检查 | 命令 | 结果 |
| --- | --- | --- |
| 任务书 pytest 加年长对齐 | `.venv\Scripts\python.exe -m pytest` 任务书第 8 节文件 + `tests/test_dasha_year_length_alignment.py` | 247 通过,0 失败,退出码 0 |
| release 门 | `.venv\Scripts\python.exe tests\run_all.py` | 102/102,失败 0,0.2 秒 |
| 排盘字节 | 清空 `scratch/local/api_chart_cache` 后 `_compute_chart_sync`,对照开工前基线 | 94348 字节。8 处差异全是语义缓存的 `cache_created_at` / `cache_expires_at`。`available_dashas` 与 `dasha_count` 35 未变 |
| 全量解读字节 | 同一虚构盘、`PYTHONHASHSEED=0`、`VEDASTRO_ENABLE_NETWORK=0`、today 与 transit-date 2026-01-01 | 去掉墙钟字段后 3492 条差异:3490 条在 `modules.ashtottari_dasha`;另外 2 条是顶层 `result_hash` 与 `result_binding.result_hash`(同一哈希,因 Ashtottari 进入绑定载荷)。`input_hash` 未变。其余模块 diff 为空 |
类方法数基线:原值 218,新值 217,原因是删除 `_fallback_dasha_periods`,没有新增方法。行数基线仍是 10924(实测 10906,净减少,不下调基线)。
## T4 年数表
已改为引用 `scripts/dasha_common.py` 的 `VIMSHOTTARI_YEARS`(顺序 Ketu、Venus、Sun、Moon、Mars、Rahu、Jupiter、Saturn、Mercury)。替换前用 `HEAD` 字面量核对 `list(items)` 一致的文件:
- `scripts/jyotish_engine.py` 的 `DASHA_YEARS`
- `scripts/dasha_calculator.py`、`scripts/dasha_calculator_enhanced.py` 的 `VIMSHOTTARI_PERIODS`
- `scripts/vimshottari_subperiod_timeline.py` 的 `DASHA_YEARS`
- `scripts/event_prediction_model.py` 的 `DASHA_YEARS`
- `scripts/nakshatra_dasha.py` 的 Vimshottari 年数表(`calc_ashtottari_dasha` 未改)
- `scripts/prashna.py` 的 `VIM_DURATIONS`
- `scripts/validate.py` 的 `DASHA_YEARS`
- `scripts/kp_system.py` 的年限列表 `[7, 20, 6, 10, 7, 18, 16, 19, 17]`,按原 `KP_LORDS` 顺序取共享表
- `scripts/tajika.py` 两处函数内字面量
未换、也未改:冻结的 `scripts/dasha_analyzer.py`;`scripts/divisional_charts_extended.py` 根上没有这份年数表;`scripts/research/offline_research_20260926_lib.py` 属于研究脚本。六个条件大运的 `_birth_lord_and_balance` 改为一行调用。2000 个固定种子月亮经度与源码副本公式 `==`,0 差异。`shastihayani`、`dwadashottari` 的余额函数未动。
## 冻结文件
`sealed_holdout_rerun` 的 PRODUCTION / RESEARCH 与 `minute_rectification_holdout_v3.json` 的 `frozen_scoring.files` 均未出现在本次 diff 中。未改 `narayana_dasha.py`、`narayana_rath.py`、`narayana_legacy_label.py`、`domain_calculation_service.py`、`dasha_analyzer.py`。
## 历史证据未改
`references/oracle/full_technique_invocation_matrix_2026_07_22.json`、`references/oracle/rectification_missing_layer_integration_plan_2026_07_19.json` 仍写着已删除文件的路径。`references/cross_project_contract/sync_ledger.json` 只提到测试文件名。这些 JSON 不改。
## 偏离
- 入参构造放在 `scripts/dasha_registry.py`,没有从 `cmd_full_reading` 抽出共享函数,避免改动全量解读里 Yogini / Kalachakra 的出生信息。等价由对照测试锁住。
- `scripts/orchestrator_bridge.py` 的 Ashtottari 调用已经从盘面带上月亮经度,这次没有改代码。
- `nakshatra_dasha.calc_ashtottari_dasha`(从 Mars 起算)前端没有读取。全量解读字节对照里它没有变化。留到后续阶段,不在本单替换。
- 新 pytest 没有在改代码之前跑红。红的证据是上面从 `HEAD` 复现的占位输出,加上任务书第 2.1 节的对照表。
- PyJHora 4.8.7 只装在本工作树的虚拟环境里做对照,没有写入依赖清单。