ln-630-test-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTest Suite Auditor (L2 Coordinator)
测试套件审核器(L2协调器)
Coordinates comprehensive test suite audit across 6 quality categories using 5 specialized workers.
通过5个专业工作组件,针对6个质量类别开展全面的测试套件审核。
Purpose & Scope
目标与范围
- L2 Coordinator that delegates to L3 specialized audit workers
- Audits all tests against 6 quality categories (via 5 workers)
- Calculates Usefulness Score for each test (Keep/Remove/Refactor)
- Identifies missing tests for critical business logic
- Detects anti-patterns and isolation issues
- Aggregates results into unified report
- Creates single Linear task in Epic 0
- Manual invocation by user; not part of Story pipeline
- L2协调器,可将任务委派给L3专业审核工作组件
- 针对6个质量类别(通过5个工作组件)审核所有测试用例
- 为每个测试用例计算实用价值评分(保留/移除/重构)
- 识别关键业务逻辑缺失的测试用例
- 检测反模式与隔离性问题
- 将结果汇总为统一报告
- 在Epic 0中创建单个Linear任务
- 由用户手动调用,不属于Story流水线的一部分
Core Philosophy
核心理念
"Write tests. Not too many. Mostly integration." — Kent Beck "Test based on risk, not coverage." — ISO 29119
Key Principles:
- Test business logic, not frameworks — bcrypt/Prisma/Express already tested
- No performance/load/stress tests — Tests infrastructure, not code correctness (use k6/JMeter separately)
- Risk-based prioritization — Priority ≥15 or remove
- E2E for critical paths only — Money/Security/Data (Priority ≥20)
- Usefulness over quantity — One useful test > 10 useless tests
- Every test must justify existence — Impact × Probability ≥15
"编写测试用例,但不要过多。主要以集成测试为主。" — Kent Beck "基于风险开展测试,而非覆盖率。" — ISO 29119
关键原则:
- 测试业务逻辑,而非框架 — bcrypt/Prisma/Express等框架已由官方完成测试
- 不包含性能/负载/压力测试 — 这类测试针对基础设施,而非代码正确性(请单独使用k6/JMeter)
- 基于风险的优先级划分 — 优先级≥15则保留,否则移除
- 仅针对关键路径开展E2E测试 — 涉及资金/安全/数据的路径(优先级≥20)
- 实用价值优先于数量 — 1个有用的测试用例胜过10个无用的测试用例
- 每个测试用例都必须证明其存在价值 — 影响程度 × 发生概率 ≥15
Workflow
工作流程
Phase 1: Discovery (Automated)
阶段1:发现(自动化)
Inputs: Codebase root directory
Actions:
- Find all test files using Glob:
- (Jest, Vitest)
**/*.test.* - (Mocha, Jasmine)
**/*.spec.* - (Jest convention)
**/__tests__/**/*
- Parse test file structure (test names, assertions count)
- Auto-discover Team ID from docs/tasks/kanban_board.md
Output: — list of test files with basic stats
testFilesMetadata输入: 代码库根目录
操作:
- 使用Glob规则查找所有测试文件:
- (Jest、Vitest)
**/*.test.* - (Mocha、Jasmine)
**/*.spec.* - (Jest约定格式)
**/__tests__/**/*
- 解析测试文件结构(测试名称、断言数量)
- 从docs/tasks/kanban_board.md中自动识别团队ID
输出: — 包含基础统计信息的测试文件列表
testFilesMetadataPhase 2: Research Best Practices (ONCE)
阶段2:研究最佳实践(仅执行一次)
Goal: Gather testing best practices context ONCE, share with all workers
Actions:
- Use MCP Ref/Context7 to research testing best practices for detected tech stack
- Load ../ln-513-auto-test-planner/references/risk_based_testing_guide.md
- Build with:
contextStore- Testing philosophy (E2E primary, Unit supplementary)
- Usefulness Score formulas (Impact × Probability)
- Anti-patterns catalog
- Framework detection patterns
Output: — shared context for all workers
contextStoreKey Benefit: Context gathered ONCE → passed to all workers → token-efficient
目标: 一次性收集测试最佳实践上下文,共享给所有工作组件
操作:
- 使用MCP Ref/Context7研究已检测技术栈的测试最佳实践
- 加载../ln-513-auto-test-planner/references/risk_based_testing_guide.md
- 构建,包含:
contextStore- 测试理念(以E2E测试为主,单元测试为辅)
- 实用价值评分公式(影响程度 × 发生概率)
- 反模式目录
- 框架检测规则
输出: — 供所有工作组件共享的上下文
contextStore核心优势: 上下文仅收集一次 → 共享给所有工作组件 → 提升Token使用效率
Phase 3: Domain Discovery (NEW)
阶段3:域发现(新增功能)
Purpose: Detect project domains from production code folder structure for domain-aware coverage analysis.
Algorithm: (same as ln-360-codebase-auditor)
-
Priority 1: Explicit domain folders
- Check for: ,
src/domains/*/,src/features/*/src/modules/*/ - Monorepo patterns: ,
packages/*/,libs/*/apps/*/ - If found (>1 match) → use as domains
- Check for:
-
Priority 2: Top-level src/ folders*
- List folders: ,
src/users/,src/orders/src/payments/ - Exclude infrastructure: ,
utils,shared,common,lib,helpers,config,types,interfaces,constants,middleware,infrastructurecore - If remaining >1 → use as domains
- List folders:
-
Priority 3: Fallback to global mode
- If <2 domains detected →
domain_mode = "global" - All workers scan entire codebase (backward-compatible behavior)
- If <2 domains detected →
Heuristics for domain detection:
| Heuristic | Indicator | Example |
|---|---|---|
| File count | >5 files in folder | |
| Structure | controllers/, services/, models/ present | MVC/Clean Architecture |
| Barrel export | index.ts/index.js exists | Module pattern |
| README | README.md describes domain | Domain documentation |
Output:
json
{
"domain_mode": "domain-aware",
"all_domains": [
{"name": "users", "path": "src/users", "file_count": 45},
{"name": "orders", "path": "src/orders", "file_count": 32},
{"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}
]
}Shared folder handling:
- Folders named ,
shared,common,utils,lib→ markcoreis_shared: true - Shared code audited but grouped separately in report
目标: 从生产代码目录结构中检测项目域,实现域感知的覆盖率分析。
算法:(与ln-360-codebase-auditor相同)
-
优先级1:显式域目录
- 检查以下路径:、
src/domains/*/、src/features/*/src/modules/*/ - 单体仓库模式:、
packages/*/、libs/*/apps/*/ - 若找到(匹配数>1)→ 将其作为域
- 检查以下路径:
-
*优先级2:顶级src/目录
- 列出目录:、
src/users/、src/orders/src/payments/ - 排除基础设施类目录:、
utils、shared、common、lib、helpers、config、types、interfaces、constants、middleware、infrastructurecore - 若剩余目录数>1 → 将其作为域
- 列出目录:
-
优先级3:回退至全局模式
- 若检测到的域数量<2 →
domain_mode = "global" - 所有工作组件扫描整个代码库(向后兼容行为)
- 若检测到的域数量<2 →
域检测启发式规则:
| 启发式规则 | 指标 | 示例 |
|---|---|---|
| 文件数量 | 目录中文件数>5 | |
| 结构 | 存在controllers/、services/、models/ | MVC/整洁架构 |
| 桶导出 | 存在index.ts/index.js | 模块模式 |
| 文档 | README.md描述了域内容 | 域文档 |
输出:
json
{
"domain_mode": "domain-aware",
"all_domains": [
{"name": "users", "path": "src/users", "file_count": 45},
{"name": "orders", "path": "src/orders", "file_count": 32},
{"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}
]
}共享目录处理:
- 名为、
shared、common、utils、lib的目录 → 标记coreis_shared: true - 共享代码会被审核,但在报告中单独分组
Phase 4: Delegate to Workers
阶段4:委派给工作组件
CRITICAL: All delegations use Task tool withfor context isolation.subagent_type: "general-purpose"
Prompt template:
Task(description: "Test audit via ln-63X",
prompt: "Execute ln-63X-{worker}. Read skill from ln-63X-{worker}/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")Anti-Patterns:
- ❌ Direct Skill tool invocation without Task wrapper
- ❌ Any execution bypassing subagent context isolation
关键注意事项: 所有委派操作都使用Task工具,并设置以实现上下文隔离。subagent_type: "general-purpose"
提示模板:
Task(description: "Test audit via ln-63X",
prompt: "Execute ln-63X-{worker}. Read skill from ln-63X-{worker}/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")反模式:
- ❌ 不使用Task包装器直接调用Skill工具
- ❌ 任何绕过子代理上下文隔离的执行方式
Phase 4a: Global Workers (PARALLEL)
阶段4a:全局工作组件(并行执行)
Global workers scan entire test suite (not domain-aware):
| # | Worker | Category | What It Audits |
|---|---|---|---|
| 1 | ln-631-test-business-logic-auditor | Business Logic Focus | Framework/Library tests (Prisma, Express, bcrypt, JWT, axios, React hooks) → REMOVE |
| 2 | ln-632-test-e2e-priority-auditor | E2E Priority | E2E baseline (2/endpoint), Pyramid validation, Missing E2E tests |
| 3 | ln-633-test-value-auditor | Risk-Based Value | Usefulness Score = Impact × Probability<br>Decisions: ≥15 KEEP, 10-14 REVIEW, <10 REMOVE |
| 5 | ln-635-test-isolation-auditor | Isolation + Anti-Patterns | Isolation (6 categories), Determinism, Anti-Patterns (6 types) |
Invocation (4 workers in PARALLEL):
javascript
FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635]:
Task(description: "Test audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")全局工作组件扫描整个测试套件(不具备域感知能力):
| 序号 | 工作组件 | 类别 | 审核内容 |
|---|---|---|---|
| 1 | ln-631-test-business-logic-auditor | 业务逻辑聚焦 | 框架/库测试用例(Prisma、Express、bcrypt、JWT、axios、React hooks)→ 移除 |
| 2 | ln-632-test-e2e-priority-auditor | E2E优先级 | E2E基准(每个端点2个用例)、测试金字塔验证、缺失的E2E测试用例 |
| 3 | ln-633-test-value-auditor | 基于风险的价值 | 实用价值评分 = 影响程度 × 发生概率<br>决策:≥15保留,10-14待评审,<10移除 |
| 5 | ln-635-test-isolation-auditor | 隔离性 + 反模式 | 隔离性(6个类别)、确定性、反模式(6种类型) |
调用方式(4个工作组件并行执行):
javascript
FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635]:
Task(description: "Test audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")Phase 4b: Domain-Aware Worker (PARALLEL per domain)
阶段4b:域感知工作组件(按域并行执行)
Domain-aware worker runs once per domain:
| # | Worker | Category | What It Audits |
|---|---|---|---|
| 4 | ln-634-test-coverage-auditor | Coverage Gaps | Missing tests for critical paths per domain (Money 20+, Security 20+, Data 15+, Core Flows 15+) |
Invocation:
javascript
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(domain_context))
ELSE:
// Fallback: invoke once for entire codebase (global mode)
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(contextStore))Parallelism strategy:
- Phase 4a: All 4 global workers run in PARALLEL
- Phase 4b: All N domain-aware invocations run in PARALLEL
- Example: 3 domains → 3 ln-374 invocations in single message
Worker Output Contract (Unified):
All workers MUST return JSON with this structure:
json
{
"category": "Category Name",
"score": 7,
"total_issues": 12,
"critical": 0,
"high": 3,
"medium": 7,
"low": 2,
"findings": [
{
"severity": "HIGH",
"location": "path/file.ts:123",
"issue": "Description of the issue",
"principle": "Category / Sub-principle",
"recommendation": "How to fix",
"effort": "S"
}
]
}Unified Scoring Formula (all workers):
penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)
score = max(0, 10 - penalty)Domain-aware workers add optional fields: ,
domainscan_path域感知工作组件针对每个域执行一次:
| 序号 | 工作组件 | 类别 | 审核内容 |
|---|---|---|---|
| 4 | ln-634-test-coverage-auditor | 覆盖率缺口 | 每个域的关键路径缺失的测试用例(资金类≥20、安全类≥20、数据类≥15、核心流程≥15) |
调用方式:
javascript
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(domain_context))
ELSE:
// 回退:针对整个代码库调用一次(全局模式)
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(contextStore))并行执行策略:
- 阶段4a:所有4个全局工作组件并行执行
- 阶段4b:所有N个域感知调用并行执行
- 示例:3个域 → 在单个消息中调用3次ln-374
工作组件输出规范(统一格式):
所有工作组件必须返回如下结构的JSON:
json
{
"category": "Category Name",
"score": 7,
"total_issues": 12,
"critical": 0,
"high": 3,
"medium": 7,
"low": 2,
"findings": [
{
"severity": "HIGH",
"location": "path/file.ts:123",
"issue": "Description of the issue",
"principle": "Category / Sub-principle",
"recommendation": "How to fix",
"effort": "S"
}
]
}统一评分公式(所有工作组件适用):
penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)
score = max(0, 10 - penalty)域感知工作组件可添加可选字段:、
domainscan_pathPhase 5: Aggregate Results
阶段5:汇总结果
Goal: Merge all worker results into unified Test Suite Audit Report
Aggregation Algorithm:
1. Collect JSON from all 5 workers
2. Merge findings from all workers into single array
3. Sum severity counts:
total_critical = sum(worker.critical for all workers)
total_high = sum(worker.high for all workers)
total_medium = sum(worker.medium for all workers)
total_low = sum(worker.low for all workers)
4. Calculate Overall Score:
overall_score = average(worker.score for all workers)
5. Sort findings by severity: CRITICAL → HIGH → MEDIUM → LOW
6. Group findings by category for report sectionsActions:
- Collect results from all workers (global + domain-aware)
- Merge findings into single flat array (all workers use unified format)
- Sum severity counts across all workers
- Calculate overall score = average of 5 worker scores
- Domain-aware worker (ln-634) → group by domain.name if domain_mode="domain-aware"
- Generate Executive Summary (2-3 sentences)
- Create Linear task in Epic 0 with full report (see Output Format below)
- Return summary to user
Findings grouping:
- Categories 1-3, 5-6 (Business Logic, E2E, Value, Isolation, Anti-Patterns) → single tables (global)
- Category 4 (Coverage Gaps) → subtables per domain (if domain_mode="domain-aware")
目标: 将所有工作组件的结果合并为统一的测试套件审核报告
汇总算法:
1. 收集所有5个工作组件的JSON结果
2. 将所有工作组件的检测结果合并为单个数组
3. 汇总严重程度计数:
total_critical = sum(worker.critical for all workers)
total_high = sum(worker.high for all workers)
total_medium = sum(worker.medium for all workers)
total_low = sum(worker.low for all workers)
4. 计算整体评分:
overall_score = average(worker.score for all workers)
5. 按严重程度对检测结果排序:CRITICAL → HIGH → MEDIUM → LOW
6. 按类别分组检测结果,用于报告章节展示操作:
- 收集结果:收集所有全局和域感知工作组件的结果
- 合并检测结果:将所有结果合并为单个扁平化数组(所有工作组件使用统一格式)
- 汇总严重程度计数:汇总所有工作组件的各类严重程度数量
- 计算整体评分 = 5个工作组件评分的平均值
- 域感知工作组件(ln-634) → 若,则按
domain_mode="domain-aware"分组domain.name - 生成执行摘要(2-3句话)
- 创建Linear任务:在Epic 0中创建包含完整报告的Linear任务(见下方输出格式)
- 返回摘要:向用户返回结果摘要
检测结果分组:
- 类别1-3、5-6(业务逻辑、E2E、价值、隔离性、反模式)→ 单个表格(全局)
- 类别4(覆盖率缺口)→ 按域分表(若)
domain_mode="domain-aware"
Output Format
输出格式
markdown
undefinedmarkdown
undefinedTest Suite Audit Report - [DATE]
测试套件审核报告 - [日期]
Executive Summary
执行摘要
[2-3 sentences: test suite health, major issues, key recommendations]
[2-3句话:测试套件健康状况、主要问题、关键建议]
Severity Summary
严重程度摘要
| Severity | Count |
|---|---|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |
| Total | X |
| 严重程度 | 数量 |
|---|---|
| 关键 | X |
| 高 | X |
| 中 | X |
| 低 | X |
| 总计 | X |
Compliance Score
合规性评分
| Category | Score | Notes |
|---|---|---|
| Business Logic Focus | X/10 | X framework tests found |
| E2E Critical Coverage | X/10 | X critical paths missing E2E |
| Risk-Based Value | X/10 | X low-value tests |
| Coverage Gaps | X/10 | X critical paths untested |
| Isolation & Anti-Patterns | X/10 | X isolation + anti-pattern issues |
| Overall | X/10 | Average of 5 categories |
| 类别 | 评分 | 说明 |
|---|---|---|
| 业务逻辑聚焦 | X/10 | 发现X个框架测试用例 |
| E2E关键路径覆盖率 | X/10 | X个关键路径缺失E2E测试 |
| 基于风险的价值 | X/10 | X个低价值测试用例 |
| 覆盖率缺口 | X/10 | X个关键路径未测试 |
| 隔离性与反模式 | X/10 | X个隔离性+反模式问题 |
| 整体 | X/10 | 5个类别的平均值 |
Domain Coverage Summary (NEW - if domain_mode="domain-aware")
域覆盖率摘要(新增 - 若domain_mode="domain-aware"
)
domain_mode="domain-aware"| Domain | Critical Paths | Tested | Coverage % | Gaps |
|---|---|---|---|---|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| payments | 6 | 5 | 83% | 1 |
| Total | 26 | 19 | 73% | 7 |
| 域 | 关键路径 | 已测试 | 覆盖率 % | 缺口 |
|---|---|---|---|---|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| payments | 6 | 5 | 83% | 1 |
| 总计 | 26 | 19 | 73% | 7 |
Audit Findings
检测结果
| Severity | Location | Issue | Principle | Recommendation | Effort |
|---|---|---|---|---|---|
| CRITICAL | routes/payment.ts:45 | Missing E2E for payment processing (Priority 25) | E2E Critical Coverage / Money Flow | Add E2E: successful payment + discount edge cases | M |
| HIGH | auth.test.ts:45-52 | Test 'bcrypt hashes password' validates library behavior | Business Logic Focus / Crypto Testing | Delete — bcrypt already tested by maintainers | S |
| HIGH | db.test.ts:78-85 | Test 'Prisma findMany returns array' validates ORM | Business Logic Focus / ORM Testing | Delete — Prisma already tested | S |
| HIGH | user.test.ts:45 | Anti-pattern 'The Liar' — no assertions | Anti-Patterns / The Liar | Add specific assertions or delete test | S |
| MEDIUM | utils.test.ts:23-27 | Test 'validateEmail' has Usefulness Score 4 | Risk-Based Value / Low Priority | Delete — likely covered by E2E registration | S |
| MEDIUM | order.test.ts:200-350 | Anti-pattern 'The Giant' — 150 lines | Anti-Patterns / The Giant | Split into focused tests | M |
| LOW | payment.test.ts | Anti-pattern 'Happy Path Only' — no error tests | Anti-Patterns / Happy Path | Add negative tests | M |
| 严重程度 | 位置 | 问题 | 原则 | 建议 | 工作量 |
|---|---|---|---|---|---|
| 关键 | routes/payment.ts:45 | 支付处理缺失E2E测试(优先级25) | E2E关键路径覆盖率 / 资金流 | 添加E2E测试:成功支付+折扣边缘场景 | M |
| 高 | auth.test.ts:45-52 | 测试'bcrypt hashes password'验证库行为 | 业务逻辑聚焦 / 加密测试 | 删除 — bcrypt已由维护者完成测试 | S |
| 高 | db.test.ts:78-85 | 测试'Prisma findMany returns array'验证ORM | 业务逻辑聚焦 / ORM测试 | 删除 — Prisma已完成测试 | S |
| 高 | user.test.ts:45 | 反模式'说谎者' — 无断言 | 反模式 / 说谎者 | 添加具体断言或删除测试用例 | S |
| 中 | utils.test.ts:23-27 | 测试'validateEmail'实用价值评分为4 | 基于风险的价值 / 低优先级 | 删除 — 可能已被注册E2E测试覆盖 | S |
| 中 | order.test.ts:200-350 | 反模式'巨人' — 150行代码 | 反模式 / 巨人 | 拆分为聚焦的测试用例 | M |
| 低 | payment.test.ts | 反模式'仅快乐路径' — 无错误测试 | 反模式 / 快乐路径 | 添加负面测试用例 | M |
Coverage Gaps by Domain (if domain_mode="domain-aware")
按域划分的覆盖率缺口(若domain_mode="domain-aware"
)
domain_mode="domain-aware"Domain: users (src/users/)
域:users (src/users/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|---|---|---|---|---|---|
| CRITICAL | Money | E2E: processRefund() | services/user.ts:120 | 20 | M |
| HIGH | Security | Unit: validatePermissions() | middleware/auth.ts:45 | 18 | S |
| 严重程度 | 类别 | 缺失测试用例 | 位置 | 优先级 | 工作量 |
|---|---|---|---|---|---|
| 关键 | 资金 | E2E: processRefund() | services/user.ts:120 | 20 | M |
| 高 | 安全 | 单元测试: validatePermissions() | middleware/auth.ts:45 | 18 | S |
Domain: orders (src/orders/)
域:orders (src/orders/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|---|---|---|---|---|---|
| CRITICAL | Money | E2E: applyDiscount() | services/order.ts:45 | 25 | M |
| HIGH | Data | Integration: orderTransaction() | repositories/order.ts:78 | 16 | M |
undefined| 严重程度 | 类别 | 缺失测试用例 | 位置 | 优先级 | 工作量 |
|---|---|---|---|---|---|
| 关键 | 资金 | E2E: applyDiscount() | services/order.ts:45 | 25 | M |
| 高 | 数据 | 集成测试: orderTransaction() | repositories/order.ts:78 | 16 | M |
undefinedWorker Architecture
工作组件架构
Each worker:
- Receives with testing best practices
contextStore - Receives with test file list
testFilesMetadata - Loads full test file contents when analyzing
- Returns structured JSON with category findings
- Operates independently (failure in one doesn't block others)
Token Efficiency:
- Coordinator: metadata only (~1000 tokens)
- Workers: full test file contents when needed (~5000-10000 tokens each)
- Context gathered ONCE, shared with all workers
每个工作组件:
- 接收包含测试最佳实践的
contextStore - 接收包含测试文件列表的
testFilesMetadata - 分析时加载完整的测试文件内容
- 返回包含类别检测结果的结构化JSON
- 独立运行(单个组件故障不影响其他组件)
Token效率:
- 协调器:仅处理元数据(约1000个Token)
- 工作组件:必要时加载完整测试文件内容(每个约5000-10000个Token)
- 上下文仅收集一次,共享给所有工作组件
Critical Rules
关键规则
- Two-stage delegation: Global workers (4) + Domain-aware worker (ln-374 × N domains)
- Domain discovery: Auto-detect domains from folder structure; fallback to global mode if <2 domains
- Parallel execution: All workers (global + domain-aware) run in PARALLEL
- Domain-grouped output: Coverage Gaps findings grouped by domain (if domain_mode="domain-aware")
- Delete > Archive: Remove useless tests, don't comment out
- E2E baseline: Every endpoint needs 2 E2E (positive + negative)
- Justify each test: If can't explain Priority ≥15, remove it
- Trust frameworks: Don't test Express/Prisma/bcrypt behavior
- No performance/load tests: Flag and REMOVE tests measuring throughput/latency/memory (DevOps Epic territory)
- Code is truth: If test contradicts code behavior, update test
- Language preservation: Report in project's language (EN/RU)
- 两阶段委派: 全局工作组件(4个) + 域感知工作组件(ln-374 × N个域)
- 域发现: 从目录结构自动检测域;若域数量<2则回退至全局模式
- 并行执行: 所有全局和域感知工作组件并行运行
- 域分组输出: 覆盖率缺口检测结果按域分组(若)
domain_mode="domain-aware" - 删除而非归档: 移除无用测试用例,不要注释掉
- E2E基准: 每个端点需要2个E2E测试用例(正向+反向)
- 每个测试用例都需证明价值: 若无法说明优先级≥15,则移除
- 信任框架: 不要测试Express/Prisma/bcrypt的内置行为
- 不包含性能/负载测试: 标记并移除测量吞吐量/延迟/内存的测试用例(属于DevOps Epic范畴)
- 代码即事实: 若测试用例与代码行为矛盾,则更新测试用例
- 语言保留: 报告使用项目的语言(英文/俄文)
Definition of Done
完成标准
- All test files discovered via Glob
- Context gathered from testing best practices (MCP Ref/Context7)
- Domain discovery completed (domain_mode determined)
- contextStore built with test metadata + domain info
- Global workers (4) invoked in PARALLEL
- Domain-aware worker (ln-374) invoked per domain in PARALLEL
- All workers completed successfully (or reported errors)
- Results aggregated with domain grouping (if domain_mode="domain-aware")
- Domain Coverage Summary built (if domain_mode="domain-aware")
- Compliance scores calculated (6 categories)
- Keep/Remove/Refactor decisions for each test
- Missing tests identified with Priority (grouped by domain if applicable)
- Anti-patterns catalogued
- Linear task created in Epic 0 with full report
- Summary returned to user
- 所有测试文件通过Glob规则被发现
- 从测试最佳实践中收集上下文(MCP Ref/Context7)
- 完成域发现(确定)
domain_mode - 构建包含测试元数据+域信息的
contextStore - 全局工作组件(4个)已并行调用
- 域感知工作组件(ln-374)已按域并行调用
- 所有工作组件已成功完成(或报告错误)
- 结果已汇总并按域分组(若)
domain_mode="domain-aware" - 已构建域覆盖率摘要(若)
domain_mode="domain-aware" - 已计算合规性评分(6个类别)
- 已为每个测试用例做出保留/移除/重构的决策
- 已识别缺失的测试用例并标记优先级(若适用则按域分组)
- 已归类反模式
- 已在Epic 0中创建包含完整报告的Linear任务
- 已向用户返回结果摘要
Reference Files
参考文件
- Orchestrator lifecycle:
shared/references/orchestrator_pattern.md - Risk-based testing methodology:
shared/references/risk_based_testing.md - Task delegation pattern:
shared/references/task_delegation_pattern.md - Audit scoring formula:
shared/references/audit_scoring.md - Audit output schema:
shared/references/audit_output_schema.md
- 编排器生命周期:
shared/references/orchestrator_pattern.md - 基于风险的测试方法论:
shared/references/risk_based_testing.md - 任务委派模式:
shared/references/task_delegation_pattern.md - 审核评分公式:
shared/references/audit_scoring.md - 审核输出 schema:
shared/references/audit_output_schema.md
Related Skills
相关技能
-
Workers:
- ln-631-test-business-logic-auditor — Framework tests detection
- ln-632-test-e2e-priority-auditor — E2E baseline validation
- ln-633-test-value-auditor — Usefulness Score calculation
- ln-634-test-coverage-auditor — Coverage gaps identification
- ln-635-test-isolation-auditor — Isolation + Anti-Patterns
-
Reference:
- ../ln-513-auto-test-planner — Risk-Based Testing Guide
- ../ln-620-codebase-auditor — Codebase audit coordinator (similar pattern)
Version: 4.0.0
Last Updated: 2025-12-23
-
工作组件:
- ln-631-test-business-logic-auditor — 框架测试用例检测
- ln-632-test-e2e-priority-auditor — E2E基准验证
- ln-633-test-value-auditor — 实用价值评分计算
- ln-634-test-coverage-auditor — 覆盖率缺口识别
- ln-635-test-isolation-auditor — 隔离性+反模式检测
-
参考:
- ../ln-513-auto-test-planner — 基于风险的测试指南
- ../ln-620-codebase-auditor — 代码库审核协调器(类似模式)
版本: 4.0.0
最后更新: 2025-12-23
",