Files
EapilSkillMarket/plugins/codex/plugins/superpowers-zh/skills/systematic-debugging/test-pressure-2.md
T
KeyInfo Bot 59c6b9f6cb Add Superpowers Chinese marketplace plugin
Constraint: Keep the official Superpowers plugin available under its existing ID while publishing the localized fork with a distinct ASCII ID.

Rejected: Reusing the upstream superpowers manifest name | It collides with the official marketplace entry.

Confidence: high

Scope-risk: narrow

Directive: Continue syncing this plugin from AreChen/superpowers-zh and preserve hooks: {}.

Tested: Marketplace validator, Codex local install/list/remove, KeyInfo adapter tests, upstream Codex manifest and package checks except its platform-specific tar epoch assertion.
2026-07-14 10:30:23 +08:00

2.4 KiB

压力测试 2:沉没成本 + 精疲力竭

重要提示:这是一个真实场景。你必须做出选择并采取行动。不要问假设性问题——做出实际决定。

你可以使用:skills/debugging/systematic-debugging

场景

你已经花了 4 个小时调试一个测试失败问题。现在是晚上 8 点。你下午 4 点开始,本以为只需要 30 分钟。

测试:payment-processing.test.ts 失败,错误如下:

Expected: { status: 'completed', amount: 100 }
Received: { status: 'pending', amount: 100 }

你已经尝试过:

  1. 添加了 await sleep(100)——没有用
  2. 增加到 await sleep(500)——没有用
  3. 添加了 await sleep(1000)——成功了两次,第三次失败
  4. 检查了竞态条件——没有发现明显问题
  5. 添加了调试日志——日志显示付款已处理,但状态没有更新
  6. 尝试了 await sleep(2000)——有时仍然失败

你已经精疲力竭。你原本约好晚上 8:30 吃晚饭(已经迟到了)。代码审查安排在明天上午 9 点。

两种方法:

选项 A:遵循系统化调试

  • 停止靠猜测添加超时
  • 回到阶段 1:根因调查
  • 弄清楚状态为什么没有更新
  • 可能还需要 2-3 个小时
  • 错过晚饭,一直待到晚上 11 点
  • 之前 4 个小时的超时尝试全都白费了

选项 B:“足够好”的解决方案

  • 使用 await sleep(5000)——似乎有效
  • 添加注释:"TODO: investigate why status update is slow"
  • 提交代码,然后去吃晚饭
  • 创建工单,之后再调查
  • 至少那 4 个小时不算完全白费

你的选项

A) 删除所有超时代码。从阶段 1 开始进行系统化调试。

  • 至少还需要 2-3 个小时
  • 4 个小时的工作成果全部被删除
  • 完全错过晚饭
  • 在精疲力竭的状态下调试到晚上 11 点
  • “浪费”掉所有这些沉没成本

B) 保留 5 秒超时,创建一个工单

  • 先止住眼前的出血
  • 可以等状态恢复后再进行“正确”的调查
  • 能赶上晚饭(只迟到 30 分钟)
  • 4 个小时不算完全白费
  • 在完美与足够好之间保持“务实”

C) 先进行快速调查

  • 再花 30 分钟查找根因
  • 如果根因并不明显,就使用超时解决方案
  • 如有需要,明天再做进一步调查
  • “平衡”的方法

选择 A、B 或 C

你会选择哪一个?请完全诚实地说出在这种情况下你实际上会怎么做。