Files
Jyotisha/docs/tasks/FIX-rect-layer-alias-2.md
T

76 lines
4.9 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.
# #184 验收退回 + 回答两个问题(2026-11-09,Claude)
本文件补充 `TASK-rect-layer-alias-20261109.md` 和 `FIX-rect-layer-alias-1.md`,冲突时以本文件为准。验收的是 `8a844f3c`。
## 验收结果
- 通过的部分(保留,不要改):`top_candidate_count` / `top_segment_count` / `unique_time` 三个计数和 5 条测试;既有 1801 / 1802 / active_events / technique_contract 40 条全过;只加字段,不改判定。
- 未完成:P1 第 1 条(逐项贡献 + MD/AD 合分一致排除)、第 3 条(`missing_mandatory_layers` 真实字段)、原任务书的层名对照(输入适配 + `layer_aliases_applied`)。Claude 跑了验收包 `rect_her_synthetic.py`:三个合成例与 staging 结果完全相同,她原文写法仍是 `not_reducible`,`missing_mandatory_layers` 仍取到 `null`。
## 回答你的两个问题
### ① 不拆单
三条都在本单完成。原任务书“不许改 `active_rectification_event_engine.py`”是 Claude 写给层名对照用的,与 FIX-1 冲突,**本文件放开为:只许在产生候选行的函数末尾追加字段**(`missing_layers`、`layer_points`、`evidence`、`score` 的值与顺序一律不变;不改任何计分、门槛、层名)。
### ② `missing_mandatory_layers` 的形状
`adjudicate_candidate_rows` 的结果加顶层字段:
```
"missing_mandatory_layers": [
{"candidate_time": "12:01", "layer": "Narayana_AD", "event_ids": ["e5"]},
...
]
```
- 按 `(candidate_time, layer)` 排序;`event_ids` 排序;没有缺失时是 `[]`,任何情况下都不是 `null`(空候选也是 `[]`)。
- `event_ids` 来自下面的逐项贡献;行上没有贡献明细时(旧形状行)写 `null`,并在该项加 `"event_ids_source": "legacy_row_without_contributions"`。
- `reasons` 含 `"missing_mandatory_layers"` 当且仅当该列表非空(写测试)。
- 原 `missing_layers` 字段不变。
## 要做的
### 1. 逐项贡献(引擎行,追加字段 `contributions`)
每个候选行加 `contributions: list[dict]`,每件事、每层一项,复用 `layer_points` 已有的层名(`dasha_varga_core` / `controlled_transit` / `Ashtakavarga` / `Shadbala`):
```
{"event_id": "e5", "layer": "dasha_varga_core",
"dependency": ["Vimshottari_MD_AD_PD", "Narayana_MD", "Narayana_AD", "D10"], # 这项分数实际依赖的层
"profile": {...}, # 只搬运引擎上下文里已有的 profile(功能吉凶 profile、Narayana 各步 profile);没有就 null,不新算
"points": 2.0, # 与 layer_points 同值
"decomposable": false, # 这项里 MD 与 AD 的分数拆不开时为 false
"missing_reason": "Narayana_AD_unresolved"} # 没有缺失时为 null
```
- 整件不计分的事(缺门控层而 `continue` 的那几处)也记一项:`layer` 写门控层名(如 `Narayana_MD_AD`、`D9`),`points: null`,`missing_reason: "event_not_scored:<层名>"`。
- 不变式测试:每行非空 `points` 之和与该行 `score` 相等(四位小数);`layer_points` 与 `contributions` 一一对应。
### 2. MD/AD 合分一致排除(`active_rectification_events.py`)
- 只要有任一候选在事件 e 上的 `dasha_varga_core` 贡献 `decomposable == false`,就把 `(e, dasha_varga_core)` 从**所有**候选的比较单元里一起拿掉(缺的不当 0,全的也不计),再按剩下的共同覆盖比较。
- `coverage_comparison` 加 `excluded_contributions: [{"event_id", "layer", "reason": "md_ad_not_decomposable"}]`;没有排除时不出现。
- 没有 `contributions` 的旧形状行保持现状(`not_reducible`)。
- 既有 1801 用例若因此改变结果,逐条写“原值 / 新值 / 原因”三栏注释,原因写 `占星师第七轮 P1:拆不开的 MD/AD 合分对所有候选一致排除(BUG-1827)`;不得删断言。
### 3. 层名对照
照原任务书第 1–3 节做(只在她原文写法进入时映射一次,记 `layer_aliases_applied`),并照 FIX-1 的反例清单写测试。验收不靠它:反例必须走真实形状(带 `contributions` 的行)。
### 4. 不变的东西(写测试)
- `can_apply` 的含义与取值:对 1801 / 1802 / active_events 的全部既有用例,`can_apply`、`confidence`、`top_score`、`winning_segment` 与改前逐个相同。
- 不改历史评分阈值、`EVENT_GATING_LAYERS` 成员、`COMPARABILITY_POLICY` 名字。
## 验收时 Claude 会做
- 跑验收包 `rect_her_synthetic.py`,看她原文写法是否得到 `common_coverage` + `excluded_contributions`,`missing_mandatory_layers` 是否为非空列表。
- 量封存 20 / 偏移 900 / live v5 的变化(只量不重新封存)。
## 不要碰
原任务书“不要碰”清单除上面放开的一处外继续有效。不得自行写“产品决定/裁定”;任务书没写到的取舍一律选需拍板。
BUG-1827:本分支还没有这一条,在 `docs/BUG_HISTORY.md` 末尾追加(只在末尾追加)。