reproduce-bug
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBug Reproduction Framework
Bug复现框架
Given a Linear ticket context ($ARGUMENTS), systematically reproduce the bug
with a failing regression test.
给定Linear工单上下文($ARGUMENTS),通过失败的回归测试系统性地复现Bug。
Step 1: Parse Signals
步骤1:解析关键信息
Extract the following from the provided ticket context:
- Error message / stack trace (if provided)
- Reproduction steps (if provided)
- Workflow JSON (if attached)
- Affected area (node, execution engine, editor, API, config, etc.)
- Version where it broke / last working version
从提供的工单上下文中提取以下内容:
- 错误信息/堆栈跟踪(如果有提供)
- 复现步骤(如果有提供)
- Workflow JSON(如果有附件)
- 影响区域(node、执行引擎、编辑器、API、配置等)
- Bug出现的版本/最后正常工作的版本
Step 2: Route to Test Strategy
步骤2:选择测试策略
Based on the affected area, pick the test layer and pattern:
| Area | Test Layer | Pattern | Key Location |
|---|---|---|---|
| Node operation | Jest unit | NodeTestHarness + nock | |
| Node credential | Jest unit | jest-mock-extended | |
| Trigger webhook | Jest unit | mock IHookFunctions + jest.mock GenericFunctions | |
| Binary data | Jest unit | NodeTestHarness assertBinaryData | |
| Execution engine | Jest integration | WorkflowRunner + DI container | |
| CLI / API | Jest integration | setupTestServer + supertest | |
| Config | Jest unit | GlobalConfig + Container | |
| Editor UI | Vitest | Vue Test Utils + Pinia | |
| E2E / Canvas | Playwright | Test containers + composables | |
根据影响区域,选择对应的测试层级和模式:
| 影响区域 | 测试层级 | 测试模式 | 关键路径 |
|---|---|---|---|
| Node操作 | Jest单元测试 | NodeTestHarness + nock | |
| Node凭证 | Jest单元测试 | jest-mock-extended | |
| Trigger Webhook | Jest单元测试 | mock IHookFunctions + jest.mock GenericFunctions | |
| 二进制数据 | Jest单元测试 | NodeTestHarness assertBinaryData | |
| 执行引擎 | Jest集成测试 | WorkflowRunner + DI容器 | |
| CLI / API | Jest集成测试 | setupTestServer + supertest | |
| 配置 | Jest单元测试 | GlobalConfig + Container | |
| 编辑器UI | Vitest | Vue Test Utils + Pinia | |
| E2E / 画布 | Playwright | Test containers + composables | |
Step 3: Locate Source Files
步骤3:定位源代码文件
Find the source code for the affected area:
- Search for the node/service/component mentioned in the ticket
- Find the GenericFunctions file (common bug location for nodes)
- Check for existing test files in the same area
- Look at recent git history on affected files ()
git log --oneline -10 -- <path>
找到受影响区域的源代码:
- 搜索工单中提到的node/服务/组件
- 找到GenericFunctions文件(node的常见Bug位置)
- 检查同一区域的现有测试文件
- 查看受影响文件的近期Git提交记录()
git log --oneline -10 -- <path>
Step 4: Trace the Code Path
步骤4:追踪代码路径
Read the source code and trace the execution path that triggers the bug:
- Follow the call chain from entry point to the failure
- Identify the specific line(s) where the bug manifests
- Note any error handling (or lack thereof) around the bug
阅读源代码并追踪触发Bug的执行路径:
- 从入口点到失败位置的调用链
- 确定Bug出现的具体代码行
- 记录Bug相关的错误处理(或缺失的错误处理)
Step 5: Form Hypothesis
步骤5:提出假设
State a clear, testable hypothesis:
- "When [input/condition], the code does [wrong thing] because [root cause]"
- Identify the exact line(s) that need to change
- Predict what the test output will show
明确可验证的假设:
- “当[输入/条件]时,代码会[执行错误操作],原因是[根本原因]”
- 确定需要修改的具体代码行
- 预测测试输出结果
Step 6: Find Test Patterns
步骤6:查找测试模式
Look for existing tests in the same area:
- Check directories near the affected code
test/ - Identify which mock/setup patterns they use
- Use the same patterns for consistency
- If no tests exist, find the closest similar node/service tests as a template
查看同一区域的现有测试:
- 检查受影响代码附近的目录
test/ - 识别它们使用的模拟/初始化模式
- 为保持一致性,使用相同的模式
- 如果没有现有测试,找最相似的node/服务测试作为模板
Step 7: Write Failing Test
步骤7:编写失败的测试用例
Write a regression test that:
- Uses the patterns found in Step 6
- Targets the specific hypothesis from Step 5
- Includes a comment referencing the ticket ID
- Asserts the CORRECT behavior (test will fail on current code)
- Also includes a "happy path" test to prove the setup works
编写回归测试用例,要求:
- 使用步骤6中找到的模式
- 针对步骤5中的假设
- 包含引用工单ID的注释
- 断言正确的行为(当前代码下测试会失败)
- 同时包含“正常流程”测试,验证测试环境配置有效
Step 8: Run and Score
步骤8:运行测试并评估结果
Run the test from the package directory (e.g., ).
cd packages/nodes-base && pnpm test <file>Classify the result:
| Confidence | Criteria | Output |
|---|---|---|
| CONFIRMED | Test fails consistently, failure matches hypothesis | Reproduction Report |
| LIKELY | Test fails but failure mode differs slightly | Report + caveat |
| UNCONFIRMED | Cannot trigger the failure | Report: what was tried |
| SKIPPED | Hit a hard bailout trigger | Report: why skipped |
| ALREADY_FIXED | Bug no longer reproduces on current code | Report: when fixed |
从包目录运行测试(例如:)。
cd packages/nodes-base && pnpm test <file>对结果进行分类:
| 置信度 | 判定标准 | 输出 |
|---|---|---|
| 已确认 | 测试持续失败,失败情况与假设一致 | 复现报告 |
| 大概率 | 测试失败,但失败模式略有不同 | 报告 + 说明 |
| 未确认 | 无法触发失败 | 报告:尝试过的操作 |
| 已跳过 | 遇到强制终止触发条件 | 报告:跳过原因 |
| 已修复 | 当前代码中Bug无法复现 | 报告:修复时间 |
Step 9: Iterate or Bail
步骤9:迭代尝试或终止
If UNCONFIRMED after first attempt:
- Revisit hypothesis — re-read the code path
- Try a different test approach or layer
- Maximum 3 attempts before declaring UNCONFIRMED
Hard bailout triggers (stop immediately):
- Requires real third-party API credentials
- Race condition / timing-dependent
- Requires specific cloud/enterprise infrastructure
- Requires manual UI interaction that can't be scripted
如果第一次尝试后结果为未确认:
- 重新审视假设——重新阅读代码路径
- 尝试不同的测试方法或层级
- 最多尝试3次,之后判定为未确认
强制终止触发条件(立即停止):
- 需要真实的第三方API凭证
- 竞争条件/依赖时序
- 需要特定的云/企业基础设施
- 需要无法脚本化的手动UI交互
Output: Reproduction Report
输出:复现报告
Present findings in this format:
Ticket: [ID] — [title]
Confidence: [CONFIRMED | LIKELY | UNCONFIRMED | SKIPPED | ALREADY_FIXED]
按以下格式呈现结果:
工单: [ID] — [标题]
置信度: [已确认 | 大概率 | 未确认 | 已跳过 | 已修复]
Root Cause
根本原因
[1-2 sentences explaining the bug mechanism]
[1-2句话解释Bug的机制]
Location
位置
| File | Lines | Issue |
|---|---|---|
| XX-YY | Description of the problem |
| 文件 | 行号 | 问题描述 |
|---|---|---|
| XX-YY | 问题说明 |
Failing Test
失败的测试用例
path/to/test/file.test.ts- — [failure description]
test name
path/to/test/file.test.ts- — [失败描述]
测试名称
Fix Hint
修复提示
[Pseudocode or description of the fix approach]
[伪代码或修复方法说明]
Important
注意事项
- DO NOT fix the bug — only reproduce it with a failing test
- Leave test files in place as evidence (don't commit unless asked)
- Run tests from the package directory (e.g., )
pushd packages/nodes-base && pnpm test <file> && popd - Always redirect build output:
pnpm build > build.log 2>&1 - DO NOT look at existing fix PRs — the goal is to reproduce from signals alone
- 不要修复Bug — 仅通过失败的测试复现Bug
- 保留测试文件作为证据(除非要求,否则不要提交)
- 从包目录运行测试(例如:)
pushd packages/nodes-base && pnpm test <file> && popd - 始终重定向构建输出:
pnpm build > build.log 2>&1 - 不要查看已有的修复PR — 目标是仅通过现有信息复现Bug