在前后端开发联调前 的提交20260223
This commit is contained in:
99
.kiro/specs/assistant-abolish-cleanup/tasks.md
Normal file
99
.kiro/specs/assistant-abolish-cleanup/tasks.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# 实施计划:助教废除(Abolish)全链路清理
|
||||
|
||||
## 概述
|
||||
|
||||
按 ETL 数据流的逆序(DWS → DWD → ODS)清理废除链路,确保每一步都可验证。先清理代码引用,再清理 DDL 和数据库对象,最后更新运维脚本和测试。
|
||||
|
||||
## 任务
|
||||
|
||||
- [x] 1. 清理 DWS 层死代码
|
||||
- [x] 1.1 从 `assistant_daily_task.py` 中删除 `_extract_trash_records` 和 `_build_trash_index` 方法,从 `extract()` 中移除对 `_extract_trash_records` 的调用和 `trash_records` 变量,从 `_aggregate_by_assistant_date` 签名中移除 `trash_index` 参数,同步更新所有调用点。保留 `is_trash` 判断逻辑不变。
|
||||
- 更新文件头部的 docstring,移除对 `dwd_assistant_trash_event` 的数据来源引用
|
||||
- _Requirements: 3.1, 3.2, 3.3, 3.4_
|
||||
|
||||
- [x] 1.2 编写属性测试验证废除聚合逻辑正确性
|
||||
- **Property 1: 废除聚合逻辑正确性(is_trash 驱动)**
|
||||
- 生成随机服务记录列表,验证 `trashed_seconds`/`trashed_count` 与 `is_trash=1` 记录的手动计算一致
|
||||
- **Validates: Requirements 3.4, 9.3**
|
||||
|
||||
- [x] 2. 清理 DWD 层映射和验证器
|
||||
- [x] 2.1 从 `dwd_load_task.py` 的 `FACT_MAPPINGS` 中删除 `dwd.dwd_assistant_trash_event` 和 `dwd.dwd_assistant_trash_event_ex` 条目,从 `TABLE_MAP` 中删除对应的 ODS→DWD 映射
|
||||
- _Requirements: 2.1, 2.2, 2.3, 2.4_
|
||||
|
||||
- [x] 2.2 从 `dwd_verifier.py` 中删除 `dwd_assistant_trash_event` 和 `dwd_assistant_trash_event_ex` 的 ID 映射和时间字段映射配置
|
||||
- _Requirements: 4.1, 4.2, 4.3, 4.4_
|
||||
|
||||
- [x] 3. 清理 ODS 层任务定义
|
||||
- [x] 3.1 从 `ods_tasks.py` 中删除 `ODS_ASSISTANT_ABOLISH` 的 `OdsTaskSpec` 定义,从默认执行序列中移除该任务代码
|
||||
- _Requirements: 1.2, 1.3_
|
||||
|
||||
- [x] 3.2 从 `task_registry.py` 中删除 `ODS_ASSISTANT_ABOLISH` 的注册语句(如果存在独立注册)
|
||||
- _Requirements: 1.1_
|
||||
|
||||
- [x] 4. Checkpoint — 确保 ETL 单元测试通过
|
||||
- 运行 `cd apps/etl/connectors/feiqiu && pytest tests/unit`,确保所有测试通过,如有问题请询问用户。
|
||||
|
||||
- [x] 5. 更新属性测试
|
||||
- [x] 5.1 从 `tests/test_property_1_fact_mappings.py` 中删除 `dwd.dwd_assistant_trash_event` 在 A 类表列表中的条目,删除 `_REQ3_EXPECTED` 映射期望及其在参数化测试中的引用
|
||||
- _Requirements: 7.1, 7.2_
|
||||
|
||||
- [x] 6. 创建数据库迁移脚本
|
||||
- [x] 6.1 在 `db/etl_feiqiu/migrations/` 下创建迁移脚本 `2026-02-22__drop_assistant_abolish_tables.sql`,包含 `DROP TABLE IF EXISTS` 语句删除 `ods.assistant_cancellation_records`、`dwd.dwd_assistant_trash_event`、`dwd.dwd_assistant_trash_event_ex`,以及删除相关索引(如 `idx_ods_assistant_cancellation_records_latest`),包含注释说明移除原因
|
||||
- _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5_
|
||||
|
||||
- [x] 7. 更新 DDL schema 文件
|
||||
- [x] 7.1 从 `db/etl_feiqiu/schemas/dwd.sql` 中删除 `dwd_assistant_trash_event` 和 `dwd_assistant_trash_event_ex` 的 CREATE TABLE 和 COMMENT 语句
|
||||
- _Requirements: 6.1, 6.2_
|
||||
|
||||
- [x] 7.2 从 `db/etl_feiqiu/schemas/ods.sql` 中删除 `assistant_cancellation_records` 的 CREATE TABLE 和 COMMENT 语句
|
||||
- _Requirements: 6.3_
|
||||
|
||||
- [x] 7.3 从 `db/etl_feiqiu/schemas/schema_dwd_doc.sql` 中删除 `dwd_assistant_trash_event` 和 `dwd_assistant_trash_event_ex` 的 CREATE TABLE 和 COMMENT 语句
|
||||
- _Requirements: 6.4_
|
||||
|
||||
- [x] 7.4 从 `db/etl_feiqiu/schemas/schema_ODS_doc.sql` 中删除 `assistant_cancellation_records` 的 CREATE TABLE 和 COMMENT 语句
|
||||
- _Requirements: 6.5_
|
||||
|
||||
- [x] 7.5 更新 `db/etl_feiqiu/schemas/dws.sql` 和 `db/etl_feiqiu/schemas/schema_dws.sql` 中 `dws_assistant_daily_detail` 的注释,将数据来源从 `dwd_assistant_trash_event` 改为 `dwd_assistant_service_log_ex.is_trash`
|
||||
- _Requirements: 6.6, 6.7_
|
||||
|
||||
- [x] 8. 更新运维脚本
|
||||
- [x] 8.1 从 `scripts/ops/dataflow_analyzer.py` 中删除 `ODS_ASSISTANT_ABOLISH` spec 条目
|
||||
- _Requirements: 8.1_
|
||||
|
||||
- [x] 8.2 从 `scripts/ops/gen_full_dataflow_doc.py` 中删除 `ODS_ASSISTANT_ABOLISH` spec 条目
|
||||
- _Requirements: 8.1_
|
||||
|
||||
- [x] 8.3 从 `scripts/ops/etl_consistency_check.py` 中删除 `ODS_ASSISTANT_ABOLISH` 映射和 `dwd.dwd_assistant_trash_event` 映射
|
||||
- _Requirements: 8.1, 8.2_
|
||||
|
||||
- [x] 8.4 从 `scripts/ops/blackbox_test_report.py` 中删除 `assistant_cancellation_records` 在 ODS_TABLES 列表中的条目、`ODS_ASSISTANT_ABOLISH` 映射、`dwd.dwd_assistant_trash_event` 映射
|
||||
- _Requirements: 8.1, 8.2, 8.3, 8.4_
|
||||
|
||||
- [x] 8.5 从 `scripts/ops/field_audit.py` 中删除 `assistant_cancellation_records` 审计条目
|
||||
- _Requirements: 8.3, 8.4_
|
||||
|
||||
- [x] 8.6 从 `scripts/ops/gen_field_review_doc.py` 中删除 `assistant_cancellation_records` 相关的字段定义块
|
||||
- _Requirements: 8.3, 8.4_
|
||||
|
||||
- [x] 8.7 从 `scripts/ops/gen_api_field_mapping.py` 中删除 `assistant_cancellation_records` 在 ODS_TABLES 列表中的条目
|
||||
- _Requirements: 8.3_
|
||||
|
||||
- [x] 8.8 从 `scripts/ops/export_dwd_field_review.py` 中删除 `dwd_assistant_trash_event` 和 `dwd_assistant_trash_event_ex` 条目
|
||||
- _Requirements: 8.4_
|
||||
|
||||
- [x] 8.9 从 `scripts/ops/check_ods_latest_indexes.py` 中删除 `idx_ods_assistant_cancellation_records_latest` 索引检查
|
||||
- _Requirements: 8.3_
|
||||
|
||||
- [x] 9. 最终 Checkpoint — 确保所有测试通过
|
||||
- 运行 `cd apps/etl/connectors/feiqiu && pytest tests/unit` 和 `cd C:\NeoZQYY && pytest tests/ -v`
|
||||
- 确认所有测试通过,无回归,如有问题请询问用户。
|
||||
- _Requirements: 7.3, 9.1, 9.2, 9.3_
|
||||
|
||||
## 备注
|
||||
|
||||
- 标记 `*` 的任务为可选,可跳过以加速 MVP
|
||||
- 每个任务引用了具体的需求编号,便于追溯
|
||||
- Checkpoint 确保增量验证
|
||||
- 属性测试验证通用正确性属性,单元测试验证具体示例和边界情况
|
||||
- 本次清理涉及高风险路径(`tasks/`、`orchestration/`、`db/`),完成后需运行 `/audit`
|
||||
Reference in New Issue
Block a user