regression-suite

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Regression Suite

回归测试套件

This skill ensures that every bug fix is backed by a test that would have caught the original bug — and that the regression suite stays current as the game evolves. It also detects when new features have been added without corresponding regression coverage.
A regression suite is not a new test category — it is a curated list of tests already in
tests/
that collectively cover the game's critical paths and known failure points. This skill maintains that list.
Output:
tests/regression-suite.md
When to run:
  • After fixing a bug (confirm a regression test was written or identify gap)
  • Before a release gate (
    /gate-check polish
    requires regression suite exists)
  • As part of sprint close to detect coverage drift

本Skill确保每个Bug修复都配有能发现原始Bug的测试,并且随着游戏迭代,回归测试套件始终保持最新状态。它还能检测新增功能未添加对应回归测试的情况。
回归测试套件并非新的测试类别——它是tests/目录中已存在测试的精选列表,共同覆盖游戏的关键路径和已知故障点。本Skill负责维护该列表。
输出:
tests/regression-suite.md
运行时机:
  • 修复Bug后(确认已编写回归测试或识别测试缺口)
  • 发布准入前(
    /gate-check polish
    要求回归测试套件已存在)
  • 冲刺收尾时运行,以检测覆盖率漂移

1. Parse Arguments

1. 解析参数

Modes:
  • /regression-suite update
    — scan new bug fixes this sprint and check for regression test presence; add new tests to the suite manifest
  • /regression-suite audit
    — full audit of all GDD critical paths vs. existing test coverage; flag paths with no regression test
  • /regression-suite report
    — read-only status report (no writes); suitable for sprint reviews
  • No argument — if a sprint is clearly active (sprint plan exists with in-progress stories), run
    update
    . If ambiguous or no active sprint is detected, use
    AskUserQuestion
    :
    • Prompt: "No subcommand specified. Which mode do you want to run?"
    • Options:
      • [A] update — scan new bug fixes this sprint and add missing regression tests
      • [B] audit — full audit of all GDD critical paths vs. existing test coverage
      • [C] report — read-only status report (no writes)

模式:
  • /regression-suite update
    —— 扫描当前冲刺阶段的新Bug修复,检查是否存在回归测试;将新测试添加到套件清单中
  • /regression-suite audit
    —— 全面审核所有GDD关键路径与现有测试覆盖率的匹配情况;标记无回归测试的路径
  • /regression-suite report
    —— 只读状态报告(不写入);适用于冲刺评审
  • 无参数 —— 如果明确存在活跃冲刺(包含进行中需求的冲刺计划已存在),则运行
    update
    。若情况模糊或未检测到活跃冲刺,调用
    AskUserQuestion
    • 提示:"未指定子命令。您想要运行哪种模式?"
    • 选项:
      • [A] update —— 扫描当前冲刺的新Bug修复并添加缺失的回归测试
      • [B] audit —— 全面审核所有GDD关键路径与现有测试覆盖率
      • [C] report —— 只读状态报告(不写入)

2. Load Context

2. 加载上下文

Step 2a — Load existing regression suite

步骤2a —— 加载现有回归测试套件

Read
tests/regression-suite.md
if it exists. Extract:
  • Total registered regression tests
  • Last updated date
  • Any tests flagged as
    STALE
    or
    QUARANTINED
If it does not exist: note "No regression suite found — will create one."
读取已存在的
tests/regression-suite.md
文件。提取:
  • 已注册的回归测试总数
  • 最后更新日期
  • 任何标记为
    STALE
    (过时)或
    QUARANTINED
    (隔离)的测试
若文件不存在:记录"未找到回归测试套件——将创建一个新套件。"

Step 2b — Load test inventory

步骤2b —— 加载测试清单

Glob all test files:
tests/unit/**/*_test.*
tests/integration/**/*_test.*
tests/regression/**/*
For each file, note the system (from directory path) and file name. Do not read test file contents unless needed for name-to-test mapping.
遍历所有测试文件:
tests/unit/**/*_test.*
tests/integration/**/*_test.*
tests/regression/**/*
针对每个文件,记录其所属系统(从目录路径获取)和文件名。除非需要进行名称与测试的映射,否则无需读取测试文件内容。

Step 2c — Load GDD critical paths

步骤2c —— 加载GDD关键路径

For
audit
mode: read
design/gdd/systems-index.md
to get all systems. For each MVP-tier system, read its GDD and extract:
  • Acceptance Criteria (these define the critical paths)
  • Formulas section (formulas must have regression tests)
  • Edge Cases section (known edge cases should have regression tests)
For
update
mode: skip full GDD scan. Instead read the current sprint plan and story files to find stories with Status: Complete this sprint.
对于
audit
模式:读取
design/gdd/systems-index.md
以获取所有系统。针对每个MVP级系统,读取其GDD并提取:
  • 验收标准(这些定义了关键路径)
  • 公式章节(公式必须配有回归测试)
  • 边缘案例章节(已知边缘案例应配有回归测试)
对于
update
模式:跳过完整的GDD扫描。改为读取当前冲刺计划和需求文件,查找状态为"Complete(已完成)"的需求。

Step 2d — Load closed bugs

步骤2d —— 加载已关闭的Bug

Glob
production/qa/bugs/*.md
and filter for bugs with a
Status: Closed
or
Status: Fixed
field. Note:
  • Which story or system the bug was in
  • Whether a regression test was mentioned in the fix description

遍历
production/qa/bugs/*.md
文件,筛选带有
Status: Closed
(状态:已关闭)或
Status: Fixed
(状态:已修复)字段的Bug。记录:
  • Bug所属的需求或系统
  • 修复描述中是否提及回归测试

3. Map Coverage — Critical Paths

3. 覆盖率映射——关键路径

For
audit
mode only:
For each GDD acceptance criterion, determine whether a test exists:
  1. Grep
    tests/unit/[system]/
    and
    tests/integration/[system]/
    for file names and function names related to the criterion's key noun/verb
  2. Assign coverage:
StatusMeaning
COVEREDA test file exists that targets this criterion's logic
PARTIALA test exists but doesn't cover all cases (e.g. happy path only)
MISSINGNo test found for this critical path
EXEMPTVisual/Feel or UI criterion — not automatable by design
  1. Elevate MISSING items that correspond to formulas or state machines to HIGH PRIORITY gap — these are the most likely regression sources.

仅适用于
audit
模式:
针对每个GDD验收标准,判断是否存在对应的测试:
  1. tests/unit/[system]/
    tests/integration/[system]/
    中,通过文件名和函数名搜索与验收标准核心名词/动词相关的内容
  2. 标记覆盖率状态:
状态含义
COVERED(已覆盖)存在针对该验收标准逻辑的测试文件
PARTIAL(部分覆盖)存在测试但未覆盖所有场景(例如仅覆盖正常路径)
MISSING(未覆盖)未找到针对该关键路径的测试
EXEMPT(豁免)视觉/体验或UI类验收标准——设计上无法自动化测试
  1. 将对应公式或状态机的MISSING(未覆盖)项升级为**HIGH PRIORITY(高优先级)**缺口——这些是最可能出现回归的来源。

4. Map Coverage — Fixed Bugs

4. 覆盖率映射——已修复Bug

For each closed bug:
  1. Extract the system slug from the bug's metadata
  2. Grep
    tests/unit/[system]/
    and
    tests/integration/[system]/
    for a test that references the bug ID or the specific failure scenario
  3. Assign:
    • HAS REGRESSION TEST — a test was found that would catch this bug
    • MISSING REGRESSION TEST — bug was fixed but no test guards against recurrence
For MISSING REGRESSION TEST items:
  • Flag them as regression gaps
  • Suggest the test file path:
    tests/unit/[system]/[bug-slug]_regression_test.[ext]
  • Note: "Without this test, this bug can silently return in a future sprint."

针对每个已关闭的Bug:
  1. 从Bug元数据中提取系统标识
  2. tests/unit/[system]/
    tests/integration/[system]/
    中,搜索引用该Bug ID或特定故障场景的测试
  3. 标记:
    • HAS REGRESSION TEST(已有回归测试) —— 找到可发现该Bug的测试
    • MISSING REGRESSION TEST(缺失回归测试) —— Bug已修复但无测试防止复发
对于MISSING REGRESSION TEST(缺失回归测试)项:
  • 将其标记为回归缺口
  • 建议测试文件路径:
    tests/unit/[system]/[bug-slug]_regression_test.[ext]
  • 提示:"若无此测试,该Bug可能在未来冲刺中悄然重现。"

5. Detect Coverage Drift

5. 检测覆盖率漂移

Coverage drift occurs when the game grows but the regression suite doesn't.
Check for drift indicators:
  • Stories completed this sprint with no corresponding test files in
    tests/
  • New systems added to
    systems-index.md
    since the last regression-suite update
  • GDD sections added or revised since the regression suite was last updated (use Grep on GDD file modification hints if available, or ask the user)
  • tests/regression-suite.md
    last-updated date vs. current date — if gap > 2 sprints, flag as likely stale

覆盖率漂移指游戏功能扩展但回归测试套件未同步更新的情况。
检查漂移指标:
  • 当前冲刺已完成但tests/目录中无对应测试文件的需求
  • 自上次回归测试套件更新以来,systems-index.md中新增的系统
  • 自上次回归测试套件更新以来,GDD新增或修订的章节(若有GDD文件修改提示则通过Grep查找,否则询问用户)
  • tests/regression-suite.md
    的最后更新日期与当前日期的间隔——若超过2个冲刺周期,标记为可能过时

6. Generate Report and Suite Manifest

6. 生成报告与套件清单

Report format (in conversation)

对话中的报告格式

undefined
undefined

Regression Suite Status

回归测试套件状态

Mode: [update | audit | report] Existing registered tests: [N] Test files scanned: [N]
模式: [update | audit | report] 已注册测试总数: [N] 扫描的测试文件数: [N]

Critical Path Coverage (audit mode only)

关键路径覆盖率(仅audit模式)

SystemTotal ACsCoveredPartialMissingExempt
[name][N][N][N][N][N]
Coverage rate (non-exempt): [N]%
系统验收标准总数已覆盖部分覆盖未覆盖豁免
[名称][N][N][N][N][N]
覆盖率(非豁免项): [N]%

Bug Regression Coverage

Bug回归覆盖率

Bug IDSystemSeverityHas Regression Test?
BUG-NNN[system]S[N]YES / NO ⚠
Bugs without regression tests: [N]
Bug ID系统严重程度是否有回归测试?
BUG-NNN[系统]S[N]是 / 否 ⚠
无回归测试的Bug数量: [N]

Coverage Drift Indicators

覆盖率漂移指标

[List new systems or stories with no test coverage, or "None detected."]
[列出无测试覆盖的新系统或需求,或显示"未检测到漂移。"]

Recommended New Regression Tests

推荐新增回归测试

PrioritySystemSuggested Test FileCovers
HIGH[system]
tests/unit/[system]/[slug]_regression_test.[ext]
BUG-NNN / AC-[N]
MEDIUM[system]
tests/unit/[system]/[slug]_test.[ext]
[criterion]
undefined
优先级系统建议测试文件覆盖内容
[系统]
tests/unit/[system]/[slug]_regression_test.[ext]
BUG-NNN / AC-[N]
[系统]
tests/unit/[system]/[slug]_test.[ext]
[验收标准]
undefined

Suite manifest format (
tests/regression-suite.md
)

套件清单格式(
tests/regression-suite.md

The manifest is a curated index — not the tests themselves, but a registry of which tests should always pass before a release:
markdown
undefined
清单是一个精选索引——并非测试文件本身,而是记录发布前必须通过的测试列表:
markdown
undefined

Regression Suite Manifest

回归测试套件清单

Last Updated: [date] Total registered tests: [N] Coverage: [N]% of GDD critical paths
最后更新日期: [日期] 已注册测试总数: [N] 覆盖率: GDD关键路径的[N]%

How to run

运行方式

[Engine-specific command to run all regression tests]
[引擎特定的运行所有回归测试的命令]

Registered Regression Tests

已注册回归测试

[System Name]

[系统名称]

Test FileTest Function (if known)CoversAdded
tests/unit/[system]/[file]_test.[ext]
test_[scenario]
AC-N / BUG-NNN[date]
测试文件测试函数(若已知)覆盖内容添加日期
tests/unit/[system]/[file]_test.[ext]
test_[scenario]
AC-N / BUG-NNN[日期]

Known Gaps

已知缺口

Tests that should exist but don't yet:
PrioritySystemSuggested PathCoversReason Not Yet Written
HIGH[system]
tests/unit/[system]/[path]
BUG-NNNBug fixed without test
应存在但尚未编写的测试:
优先级系统建议路径覆盖内容未编写原因
[系统]
tests/unit/[system]/[path]
BUG-NNNBug已修复但未添加测试

Quarantined Tests

隔离测试

Tests that are flaky or disabled (do not run in CI):
Test FileFunctionReasonQuarantined Since
(none)

---
不稳定或已禁用的测试(CI中不运行):
测试文件函数原因隔离起始日期
(无)

---

7. Write Output

7. 写入输出

Ask: "May I write/update
tests/regression-suite.md
with the current regression suite manifest?"
For
update
mode: append new entries; never remove existing entries (use
Edit
with targeted insertions). For
audit
mode: rewrite the full manifest with updated coverage data. For
report
mode: do not write anything.
After writing (if approved):
  • For each HIGH priority gap: "Consider creating the missing regression test before the next sprint. Run
    /test-helpers
    to scaffold the test file."
  • If bug regression gaps > 0: "These bugs can silently return without regression tests. The next sprint should include a story to write the missing tests."
  • If coverage drift detected: "Regression suite may be drifting. Consider running
    /regression-suite audit
    at the next sprint boundary."
Verdict: COMPLETE — regression suite updated. (If user declined write: Verdict: BLOCKED.)

询问:"是否允许我创建/更新
tests/regression-suite.md
文件,写入当前的回归测试套件清单?"
对于
update
模式:追加新条目;绝不删除现有条目(使用
Edit
进行定向插入)。 对于
audit
模式:重写完整清单,更新覆盖率数据。 对于
report
模式:不进行任何写入操作。
若获得写入许可并完成后:
  • 针对每个高优先级缺口:"建议在下一个冲刺前创建缺失的回归测试。运行
    /test-helpers
    可快速生成测试文件模板。"
  • 若存在Bug回归缺口:"若无回归测试,这些Bug可能悄然重现。下一个冲刺应包含编写缺失测试的需求。"
  • 若检测到覆盖率漂移:"回归测试套件可能已出现漂移。建议在下一个冲刺边界运行
    /regression-suite audit
    。"
结论:COMPLETE(完成)——回归测试套件已更新。(若用户拒绝写入:结论:BLOCKED(受阻)。)

Collaborative Protocol

协作协议

  • Never remove existing regression tests from the manifest without explicit user approval — removing a test that was deliberately written is a regression risk itself
  • Gaps are advisory, not blocking — surface them clearly but do not prevent other work from proceeding (except at release gate where regression suite is required)
  • Quarantine is not deletion — tests with intermittent failures should be quarantined (noted in manifest) but not removed; they should be fixed by
    /test-flakiness
  • Ask before writing — always confirm before creating or updating the manifest
  • 绝不擅自删除清单中的现有回归测试——除非获得用户明确许可,删除特意编写的测试本身就存在回归风险
  • 缺口仅作为建议,不阻塞流程——清晰展示缺口,但不阻止其他工作推进(除非发布准入要求必须有回归测试套件)
  • 隔离不等于删除——存在间歇性故障的测试应被隔离(在清单中标记)而非删除;需通过
    /test-flakiness
    修复这些测试
  • 写入前需询问——创建或更新清单前始终需确认用户许可