dsh-flakefinder
Manifest validTest-stability tools: repeatedly run vitest/jest/pytest/node:test suites, classify flaky cases, keep history, maintain a quarantine manifest and health self-check.
dsh-flakefinder
让 agent 分清「代码坏了」还是「测试在抽风」。
DeepSeek Harness 测试稳定性插件:支持 vitest / jest / pytest / node:test,重复运行测试并识别 flaky 用例,历史留档、隔离清单、写操作审批门。零运行时依赖。
工具
| 工具 | 作用 | 写操作 |
| :-- | :-- | :-- |
| flaky_detect | 重复运行测试 N 次,判定 stable-pass / stable-fail / flaky | 否(写历史) |
| flaky_history | 查询检测历史,按目标过滤 | 否 |
| flaky_report | 汇总隔离清单 + 历史,输出稳定性报告 | 否 |
| flaky_quarantine | 把 flaky 用例写入 .flakefinder.json 隔离清单 | 是(审批门) |
| flaky_clear | 从隔离清单移除已恢复的用例 | 是(审批门) |
支持框架:
- vitest:读取
node_modules/vitest/vitest.mjs,使用 JSON reporter - jest:读取
node_modules/jest/bin/jest.js,使用--json --outputFile - pytest:
python -m pytest --junitxml,解析 JUnit XML(支持 setup.cfg / pyproject / pytest.ini / tox.ini 探测与 XML 实体解码) - node:test:
node --test --test-reporter=tap,解析 TAP(含 SKIP 指令归类) framework: auto按 vitest → jest → pytest → node:test 自动探测
兼容性
已在官方 @deepseek-ai/dsh@0.1.5-rc.1、Node 24.16.0 上验证(2026-09-11):18 个组件与 Modlens 同载,工具 schema、技能注册及离线只读调用检查通过。采用 cordis.patch.yml + dsh.bundle.patch 组合包模型。Node 要求与该版本 Harness 一致:22.19 及以上的 22.x,或 24 及以上。外部服务的实际业务操作需按各组件配置单独验证。
2026-09-13 修复:保留宿主 subprocess.spawn 的服务对象,避免方法独立传递后因 this 丢失而报错。已在官方 0.1.5-rc.1 和 0.1.5-rc.2、Node 24.16.0 上验证。flaky_detect 已通过真实宿主进程服务连续运行三轮 Node 测试,正确返回 stable-pass。
安装
dsh plugin --profile web add dsh-flakefinder
或手动安装后在 profile 的 cordis.patch.yml 插入:
- id: flakefinder
name: 'dsh-flakefinder'
config:
defaultRuns: 5
writeApproval: true
卸载
dsh plugin --profile web remove dsh-flakefinder
卸载后重启 Web 服务。如需彻底清理,可再手动删除自己 profile cordis.patch.yml 中覆盖的插件行。
使用示例
用户:src/checkout.test.ts 最近老失败,帮我判断一下
Agent:
flaky_detect(target="src/checkout.test.ts", runs=5)
→ 判定:flaky;3/5 通过,失败集中在 useFakeTimers 用例
→ flaky_quarantine(tests=["src/checkout.test.ts > 定时器恢复"], reason="定时器竞态")
配置
| 字段 | 默认 | 说明 |
| :-- | :-- | :-- |
| defaultRuns | 5 | flaky_detect 默认重复次数(3-20) |
| maxRuns | 20 | 单次允许的最大重复次数(3-50) |
| timeoutMs | 120000 | 单轮测试运行超时 |
| graceMs | 10000 | 超时后宽限 |
| writeApproval | true | 隔离清单写操作是否走审批门 |
| dataDir | DSH_HOME/.dsh-flakefinder | 历史存储目录 |
| quarantineFile | <cwd>/.flakefinder.json | 隔离清单路径 |
| pythonPath | DSH_FLAKEFINDER_PYTHON 或 python/python3 | pytest 使用的 Python 解释器 |
隔离清单格式
{
"version": 1,
"quarantined": [
{
"file": "src/checkout.test.ts",
"name": "使用假定时器后恢复真实定时器",
"reason": "定时器竞态,见 issue #12",
"since": "2026-08-16T00:00:00.000Z"
}
]
}
隔离清单只记录,不修改测试源码;agent 跑测试前应先查阅 flaky_report。
工程
- Node >= 22.13,TypeScript,零运行时依赖
- 测试进程走 DSH 官方 subprocess 服务,argv 数组、无 shell
- 全量单测 40+:解析、判定、存储、审批门、pytest 计划、subprocess 超时、注册与 manifest
pnpm test:构建 +node --test
发布门禁
pnpm test全绿pnpm typecheck- 危险模式扫描(eval / child_process / 密钥零容忍)
- 真实 profile 冒烟:全新临时 profile 安装插件 → 真 boot → stderr 零报错
- manifest 自检(bundle patch / exports / files 白名单)
License
MIT
Compatibility
Versions
| Latest version | Published | Size |
|---|---|---|
| 0.1.0 | — | — |
| 0.2.0 | — | — |
| 0.2.1 | — | — |
| 0.2.2 | — | — |
| 0.3.0 | — | — |
| 0.3.1 | — | — |
| 0.3.2 | — | — |
| 0.3.3 | — | — |
Similar plugins
Stability audit for installed dsh plugins: static risk grading (hook surface, startup work, inject, entry, dep ranges) plus optional isolated install verification.
★ 0
↓ 112/wk
dsh plugin --profile web add dsh-stability-auditAutomated unit-test generation: a /testgen command and generate_tests tool that scaffold, run, and fix tests until they pass (LLM + offline template generators; vitest/jest/mocha/node:test).
★ 0
dsh plugin --profile web add dsh-testgenby TonyWang-hub
Evidence-first inspection, compatibility verification, and quarantine tooling for DeepSeek Harness plugins.
★ 0
Apache-2.0
TypeScript
Sep 5, 2026
dsh plugin --profile web add dsh-plugin-trust-centerDependency supply-chain hygiene audit for dsh projects and profiles: peer-range resolvability, broken dist-tag detection (#2763 class), stale / missing-license / non-registry dependencies, and install
★ 0
↓ 53/wk
dsh plugin --profile web add dsh-dep-auditby svcgv
An experimental Debug Mode bundle for DeepSeek Harness, currently in the engineering-foundation phase.
★ 0
MIT
TypeScript
Sep 9, 2026
dsh plugin --profile web add dsh-debug-modeby ZK-Andy
Continual self-evolution plugin for DeepSeek Harness: versioned, auditable, rollback-safe harness state refined from session trajectories, with a benchmark-driven validation loop.
★ 19
MIT
TypeScript
Sep 4, 2026
dsh plugin --profile web add dsh-continual-evolve