docs(08): add validation strategy

This commit is contained in:
2026-03-17 20:49:01 +08:00
parent 1464c9b707
commit c93237abde
@@ -0,0 +1,85 @@
---
phase: 08
slug: crawler
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-03-17
---
# Phase 08 — Validation Strategy
> Per-phase validation contract for feedback sampling during execution.
---
## Test Infrastructure
| Property | Value |
|----------|-------|
| **Framework** | pytest 7.x |
| **Config file** | pytest.ini |
| **Quick run command** | `pytest tests/test_crawler/ -x -v` |
| **Full suite command** | `pytest tests/ -v` |
| **Estimated runtime** | ~30 seconds |
---
## Sampling Rate
- **After every task commit:** Run `pytest tests/test_crawler/ -x --tb=short`
- **After every plan wave:** Run `pytest tests/ -v`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 30 seconds
---
## Per-Task Verification Map
| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 08-01-01 | 01 | 1 | CONT-01 | integration | `pytest tests/test_crawler/test_answer_crawler.py -x` | ❌ W0 | ⬜ pending |
| 08-01-02 | 01 | 1 | CONT-02 | integration | `pytest tests/test_crawler/test_article_crawler.py -x` | ❌ W0 | ⬜ pending |
| 08-01-03 | 01 | 1 | CONT-04 | unit | `pytest tests/test_crawler/test_metadata_extraction.py -x` | ❌ W0 | ⬜ pending |
| 08-02-01 | 02 | 1 | CONT-03 | integration | `pytest tests/test_crawler/test_comment_crawler.py -x` | ❌ W0 | ⬜ pending |
| 08-03-01 | 03 | 2 | NET-01 | unit | `pytest tests/test_crawler/test_proxy_config.py -x` | ❌ W0 | ⬜ pending |
| 08-03-02 | 03 | 2 | NET-02 | unit | `pytest tests/test_crawler/test_rate_limiter.py -x` | ❌ W0 | ⬜ pending |
| 08-03-03 | 03 | 2 | NET-03 | integration | `pytest tests/test_crawler/test_api_intercept.py -x` | ❌ W0 | ⬜ pending |
*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
---
## Wave 0 Requirements
- [ ] `tests/test_crawler/__init__.py` — 测试模块初始化
- [ ] `tests/test_crawler/conftest.py` — 共享 fixtures (mock browser, mock API responses)
- [ ] `tests/test_crawler/test_answer_crawler.py` — 问答爬取测试 stubs
- [ ] `tests/test_crawler/test_article_crawler.py` — 专栏爬取测试 stubs
- [ ] `tests/test_crawler/test_comment_crawler.py` — 评论爬取测试 stubs
- [ ] `tests/test_crawler/test_metadata_extraction.py` — 元数据提取测试 stubs
- [ ] `tests/test_crawler/test_proxy_config.py` — 代理配置测试 stubs
- [ ] `tests/test_crawler/test_rate_limiter.py` — 频率控制测试 stubs
- [ ] `tests/test_crawler/test_api_intercept.py` — API 拦截测试 stubs
---
## Manual-Only Verifications
| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| 实际知乎页面爬取 | CONT-01, CONT-02 | 需要真实网络请求和 Cookie | 1. 配置代理 2. 运行 `kb crawl <url>` 3. 验证输出 JSON |
| 代理实际生效 | NET-01 | 需要真实代理环境 | 1. 配置代理 2. 检查请求是否通过代理 |
---
## Validation Sign-Off
- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 30s
- [ ] `nyquist_compliant: true` set in frontmatter
**Approval:** pending