Files
Neo-ZQYY/docs/audit/changes/2026-02-13__remove-legacy-index-cleanup.md

80 lines
4.3 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.
# 审计记录移除旧版指数RECALL/INTIMACY+ ML last-touch 清理
- 日期2026-02-13Asia/Shanghai
- Prompt 摘要:用户要求根据代码与文档差异分析结果,执行 9 项修改指令,包括删除旧版 RecallIndexTask/IntimacyIndexTask、修复 WBI STOP_HIGH_BALANCE 评分 bug、移除 ML last-touch 备用路径、更新文档等。
## 直接原因
旧版 `RecallIndexTask` 已被 WBI+NCI 替代,`IntimacyIndexTask` 已被 `RelationIndexTask`RS/OS/MS/ML替代。用户明确要求彻底删除旧版代码、数据库对象和所有引用不保留向后兼容。同时修复 WBI 中 `STOP_HIGH_BALANCE` 会员不参与评分的逻辑 bug以及将 ML 数据源锁定为人工台账唯一真源。
## 修改文件清单
### 已删除文件
| 文件 | 原因 |
|---|---|
| `tasks/dws/index/recall_index_task.py` | 旧版召回指数任务,已由 WBI+NCI 替代 |
| `tasks/dws/index/intimacy_index_task.py` | 旧版亲密指数任务,已由 RelationIndexTask 替代 |
| `docs/bd_manual/DWS/main/BD_manual_dws_member_recall_index.md` | 对应表已 DROP |
### 逻辑变更文件
| 文件 | 变更摘要 |
|---|---|
| `tasks/dws/index/winback_index_task.py` | STOP_HIGH_BALANCE 会员参与评分bug fix |
| `tasks/dws/index/relation_index_task.py` | 移除 `_apply_last_touch_ml` 方法、`source_mode`/`recharge_attribute_hours` 参数 |
| `tasks/dws/index/base_index_task.py` | docstring 更新RECALL/INTIMACY → WBI/NCI/RS 等) |
| `tasks/dws/index/__init__.py` | 移除 RecallIndexTask/IntimacyIndexTask 导出 |
| `tasks/dws/__init__.py` | 移除 RecallIndexTask/IntimacyIndexTask 导入 |
| `orchestration/task_registry.py` | 移除 DWS_RECALL_INDEX/DWS_INTIMACY_INDEX 注册 |
| `tasks/verification/index_verifier.py` | 移除 RECALL/INTIMACY backfill 分支 |
### GUI 变更文件
| 文件 | 变更摘要 |
|---|---|
| `gui/models/task_registry.py` | 移除两个 TaskDefinition |
| `gui/models/task_model.py` | 移除两个 TASK_CATEGORIES 条目 |
| `gui/widgets/task_panel.py` | 移除 intimacy checkbox 引用、DWS_RECALL_INDEX 过滤 |
| `gui/utils/app_settings.py` | 移除 `index_intimacy_check` 属性 |
### 数据库变更文件
| 文件 | 变更摘要 |
|---|---|
| `database/schema_dws.sql` | 移除 recall/intimacy 表 DDL更新注释 |
| `database/seed_index_parameters.sql` | 移除 RECALL/INTIMACY 参数行,移除 ML legacy 参数,升级至 v3.0 |
| `database/seed_scheduler_tasks.sql` | 移除 DWS_INTIMACY_INDEX |
| `database/migrations/20260213_remove_legacy_index.sql` | 新增DROP 旧表、DELETE 旧参数 |
| `database/migrations/20260208_relation_index_manual_ml.sql` | 移除 source_mode INSERT |
### 文档变更文件
| 文件 | 变更摘要 |
|---|---|
| `docs/index/20260208.txt` | 全面更新算法描述NCI touch_multiplier、WBI 双层抑制等) |
| `docs/index/index_algorithm_cn.md` | 移除 INTIMACY 章节,更新版本说明/参数/运行策略 |
| `docs/开发笔记/更新关系指数.txt` | 追加 2026-02-13 实施更新说明 |
### 测试变更文件
| 文件 | 变更摘要 |
|---|---|
| `tests/integration/test_index_tasks.py` | 移除 intimacy 测试/表检查,更新 imports |
## 风险评估
- 回归范围DWS 指数计算WBI/NCI/RS/OS/MS/ML、GUI 任务面板、调度注册
- WBI STOP_HIGH_BALANCE 评分修复:低风险,原先这些会员 raw_score=NULL 无运营价值,现在参与评分是正确行为
- ML last-touch 移除:低风险,用户确认仅使用人工台账
- GUI intimacy checkbox 移除:低风险,对应任务已不存在
- 迁移脚本 DROP TABLE不可逆但用户确认不需要向后兼容
## 回滚要点
- 代码回滚:`git revert` 即可恢复所有文件
- 数据库回滚:迁移脚本中的 DROP TABLE 不可逆,需从备份恢复或重建表+重跑旧任务
- 参数回滚:重新执行旧版 seed_index_parameters.sql
## 验证步骤
1. 单元测试:`pytest tests/unit --ignore=tests/unit/test_dws_tasks.py` — 238 passed ✓
2. Python 代码无 intimacy/recall_index 残留:`grep -r "intimacy\|recall_index\|IntimacyIndex\|RecallIndex" --include="*.py"` — 0 matches ✓
3. 诊断检查:所有修改的 Python 文件通过 getDiagnostics ✓
4. 迁移脚本验证块:执行后应输出所有计数为 0、表存在为 false
5. 集成测试(需数据库):`TEST_DB_DSN="..." pytest tests/integration/test_index_tasks.py`