This repository has been archived on 2026-08-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kb-skills/.planning/phases/15-output-compat/15-00-PLAN.md
T

149 lines
5.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.
---
phase: 15-output-compat
plan: 00
type: execute
wave: 0
depends_on: []
files_modified:
- tests/test_pipeline/test_config.py
- tests/test_processors/test_srt.py
- tests/test_backward_compat.py
- tests/conftest.py
autonomous: true
requirements: []
must_haves:
truths:
- "测试基础设施已就绪,所有新功能测试都有占位符"
- "测试文件结构符合项目规范"
artifacts:
- path: "tests/test_pipeline/test_config.py"
provides: "配置测试基础结构"
contains: "TestEnableSemanticSegmentationField"
- path: "tests/test_processors/test_srt.py"
provides: "SRTProcessor 配置集成测试"
contains: "TestConfigIntegration"
- path: "tests/test_backward_compat.py"
provides: "向后兼容性测试"
contains: "TestBackwardCompatibility"
- path: "tests/conftest.py"
provides: "共享测试 fixtures"
contains: "temp_env_vars fixture"
key_links: []
---
<objective>
建立测试基础设施,为后续计划提供测试框架。
Purpose: 确保 Nyquist 验证合规,每个功能任务都有对应的自动化测试
Output: 测试文件结构和占位符测试
</objective>
<execution_context>
@/home/starmen1265/.claude/get-shit-done/workflows/execute-plan.md
@/home/starmen1265/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/phases/15-output-compat/15-CONTEXT.md
@.planning/phases/15-output-compat/15-RESEARCH.md
@.planning/phases/15-output-compat/15-VALIDATION.md
@tests/test_pipeline/test_config.py
@tests/test_processors/conftest.py
</context>
<tasks>
<task type="auto">
<name>Task 1: 添加配置字段测试占位符</name>
<files>tests/test_pipeline/test_config.py</files>
<action>
在 test_config.py 中添加 TestEnableSemanticSegmentationField 测试类,包含以下测试占位符:
1. test_kbsettings_has_enable_semantic_segmentation_field - 验证字段存在
2. test_enable_semantic_segmentation_default_value - 验证默认值为 True
3. test_enable_semantic_segmentation_from_env - 验证环境变量覆盖
4. test_enable_semantic_segmentation_boolean_parsing - 验证布尔字符串解析
每个测试使用 pytest.skip("等待实现") 标记为待实现。
</action>
<verify>
<automated>pytest tests/test_pipeline/test_config.py::TestEnableSemanticSegmentationField -v</automated>
</verify>
<done>测试类添加成功,4个测试占位符就绪</done>
</task>
<task type="auto">
<name>Task 2: 添加 SRTProcessor 配置集成测试占位符</name>
<files>tests/test_processors/test_srt.py</files>
<action>
在 test_srt.py 中添加 TestConfigIntegration 测试类,包含以下测试占位符:
1. test_srt_processor_reads_from_kbsettings - 验证从 KBSettings 读取配置
2. test_srt_processor_constructor_overrides_config - 验证构造函数参数优先级
3. test_config_disabled_uses_rule_based - 验证禁用时使用规则分段(CONFIG-02)
4. test_output_format_with_semantic_enabled - 验证启用时输出 H2 标题(OUTPUT-01)
5. test_output_format_with_semantic_disabled - 验证禁用时输出"## 内容"(OUTPUT-03)
每个测试使用 pytest.skip("等待实现") 标记为待实现。
</action>
<verify>
<automated>pytest tests/test_processors/test_srt.py::TestConfigIntegration -v</automated>
</verify>
<done>测试类添加成功,5个测试占位符就绪</done>
</task>
<task type="auto">
<name>Task 3: 创建向后兼容性测试文件</name>
<files>tests/test_backward_compat.py</files>
<action>
创建新文件 tests/test_backward_compat.py,添加 TestBackwardCompatibility 测试类:
1. test_rule_based_segmentation_unchanged - 验证规则分段行为不变(CONFIG-02)
2. test_analyze_processor_unaffected - 验证 AnalyzeProcessor 不受影响(CONFIG-03)
3. test_existing_api_compatibility - 验证现有 API 调用兼容性
每个测试使用 pytest.skip("等待实现") 标记为待实现。
文件头部添加必要的导入和文档字符串。
</action>
<verify>
<automated>pytest tests/test_backward_compat.py -v</automated>
</verify>
<done>测试文件创建成功,3个测试占位符就绪</done>
</task>
<task type="auto">
<name>Task 4: 添加共享测试 fixtures</name>
<files>tests/conftest.py</files>
<action>
在 tests/conftest.py 中添加以下 fixtures:
1. temp_env_vars - 临时环境变量 fixture,使用 monkeypatch,测试后自动清理
2. mock_settings - Mock KBSettings fixture,用于隔离测试环境
如果 conftest.py 不存在,创建它并添加现有测试可能需要的 fixtures。
</action>
<verify>
<automated>pytest tests/test_pipeline/test_config.py -k "test_get_settings" -v</automated>
</verify>
<done>Fixtures 添加成功,可被其他测试引用</done>
</task>
</tasks>
<verification>
- pytest 发现所有新增测试类和测试函数
- 所有测试标记为 skip 状态(等待实现)
- 测试文件结构符合项目规范
</verification>
<success_criteria>
- Wave 0 测试基础设施就绪
- 后续计划的每个任务都有对应的测试验证
- Nyquist 验证合规(所有自动化命令都有对应测试)
</success_criteria>
<output>
Wave 0 不创建 SUMMARY.md(测试基础设施计划)
</output>