mcpField
Q
qe-sherlock-review

qe-sherlock-review

github.com/proffesor-for-testing测试与质量51984 次安装今天更新
代码仓库

关于 qe-sherlock-review

qe-sherlock-review 是用于依据可复现证据审查代码声明的技能,指导审查者收集证据、对照代码与实际行为,并记录结论。

主要功能

  1. 01收集代码、测试、历史和运行证据
  2. 02对照声明与实际证据
  3. 03四级结论分类
  4. 04调查模板与场景检查清单

适用场景

  1. 01评估拉取请求是否修复所报缺陷
  2. 02通过基准测试核查性能提升声明
  3. 03检查边界情况覆盖与回归测试

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill qe-sherlock-review

安装后在 Claude Code 中输入/qe-sherlock-review确认已加载。

详细介绍

Sherlock 审查

<default_to_action> 调查代码相关说法时:

  1. 观察:收集所有证据(代码、测试、历史记录、行为)
  2. 推断:证据实际表明什么,与说法有何出入?
  3. 排除:排除不可能的情况
  4. 得出结论:证据是否支持该说法?
  5. 记录:用证据证明调查结果,而非凭空假设

三步调查法:

# 1. OBSERVE: Gather evidence
git diff <commit>
npm test -- --coverage

# 2. DEDUCE: Compare claim vs reality
# Does code match description?
# Do tests prove the fix/feature?

# 3. CONCLUDE: Verdict with evidence
# SUPPORTED / PARTIALLY SUPPORTED / NOT SUPPORTED

福尔摩斯原则:

  • “数据!数据!数据!”——先收集,再下结论
  • “排除不可能的情况”——什么是不可能的?
  • “你看见了,却没有观察”——运行代码,不要只读代码
  • 只相信可复现的证据 </default_to_action>

快速参考卡

证据收集清单
类别检查内容方法
说法PR 描述、提交消息仔细阅读
代码实际文件变更git diff
测试覆盖率、断言独立运行
行为运行时输出在本地执行
时间线事件发生的时间git log、git blame
判定级别
判定含义
✓ 属实证据完全支持该说法
⚠ 部分属实说法准确,但不完整
✗ 不属实证据与该说法相矛盾
? 不合逻辑该说法不适用于当前情境

调查模板

## Sherlock Investigation: [Claim]

### The Claim
"[What PR/commit claims to do]"

### Evidence Examined
- Code changes: [files, lines]
- Tests added: [count, coverage]
- Behavior observed: [what actually happens]

### Deductive Analysis

**Claim**: [specific assertion]
**Evidence**: [what you found]
**Deduction**: [logical conclusion]
**Verdict**: ✓/⚠/✗

### Findings
- What works: [with evidence]
- What doesn't: [with evidence]
- What's missing: [gaps in implementation/testing]

### Recommendations
1. [Action based on findings]

调查场景

场景 1:“这修复了错误”

步骤:

  1. 在修复前的提交上复现错误
  2. 确认包含修复的提交已解决错误
  3. 检查修复针对的是根本原因还是表面症状
  4. 测试原始报告中未提及的边缘情况

危险信号:

  • 只移除了错误日志的修复
  • 仅适用于特定测试用例
  • 用变通方案代替修复根本原因
  • 未添加回归测试
场景 2:“性能提升了 50%”

步骤:

  1. 在基准提交上运行基准测试
  2. 在优化后的提交上运行相同的基准测试
  3. 在相同条件下进行比较
  4. 验证测量方法

危险信号:

  • 只在玩具数据上测试
  • 比较条件不同
  • 未提及权衡取舍
场景 3:“能处理所有边缘情况”

步骤:

  1. 列出代码路径中的所有边缘情况
  2. 检查每种情况是否都有测试覆盖
  3. 测试边界条件
  4. 验证错误处理路径

危险信号:

  • catch {} 吞掉错误
  • 通用错误消息
  • 未记录关键错误日志

调查示例

## Case: PR #123 "Fix race condition in async handler"

### Claims Examined:
1. "Eliminates race condition"
2. "Adds mutex locking"
3. "100% thread safe"

### Evidence:
- File: src/handlers/async-handler.js
- Changes: Added `async/await`, removed callbacks
- Tests: 2 new tests for async flow
- Coverage: 85% (was 75%)

### Analysis:

**Claim 1: "Eliminates race condition"**
Evidence: Added `await` to sequential operations. No actual mutex.
Deduction: Race avoided by removing concurrency, not synchronization.
Verdict: ⚠ PARTIALLY TRUE (solved differently than claimed)

**Claim 2: "Adds mutex locking"**
Evidence: No mutex library, no lock variables, no sync primitives.
Verdict: ✗ FALSE

**Claim 3: "100% thread safe"**
Evidence: JavaScript is single-threaded. No worker threads used.
Verdict: ? NONSENSICAL (meaningless in this context)

### Conclusion:
Fix works but not for reasons claimed. Race condition avoided by
making operations sequential, not by adding synchronization.

### Recommendations:
1. Update PR description to accurately reflect solution
2. Add test for concurrent request handling
3. Remove incorrect technical claims

Agent 集成

// Evidence-based code review
await Task("Sherlock Review", {
  prNumber: 123,
  claims: [
    "Fixes memory leak",
    "Improves performance 30%"
  ],
  verifyReproduction: true,
  testEdgeCases: true
}, "qe-code-reviewer");

// Bug fix verification
await Task("Verify Fix", {
  bugCommit: 'abc123',
  fixCommit: 'def456',
  reproductionSteps: steps,
  testBoundaryConditions: true
}, "qe-code-reviewer");

Agent 协作提示

记忆命名空间
aqe/sherlock/
├── investigations/*   - Investigation reports
├── evidence/*         - Collected evidence
├── verdicts/*         - Claim verdicts
└── patterns/*         - Common deception patterns
Fleet 协作
const investigationFleet = await FleetManager.coordinate({
  strategy: 'evidence-investigation',
  agents: [
    'qe-code-reviewer',        // Code analysis
    'qe-security-auditor',     // Security claim verification
    'qe-performance-validator' // Performance claim verification
  ],
  topology: 'parallel'
});

相关技能


请记住

“在没有数据之前就开始理论推演,是一个严重的错误。” 只相信可复现的证据。不要相信提交消息、文档或“在我的机器上能运行”。

Sherlock 标准: 每个说法都必须通过实证验证。证据实际上表明了什么?

评论

支持 Markdown