Regression Triage

Triage a regression by comparing the failing path against the last known good commit

CommandtestingMIT1 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Not listed in source
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
LICENSE

Source preview

cli-tool/components/commands/testing/regression-triage.md

---
allowed-tools: Read, Glob, Grep, Bash(git:*), Bash(npm test:*), Bash(npm run:*), Bash(pnpm test:*), Bash(yarn test:*)
argument-hint: <failing-test-or-issue>
description: Triage a regression by comparing the failing path against the last known good commit
---

# Regression Triage

Investigate a regression for: **$ARGUMENTS**

## Purpose

Find the smallest code change that introduced a failing test, broken workflow, or user-reported regression.

## Pre-flight

1. Confirm the working tree is clean. If this prints anything, stop and ask the user to commit or stash the changes before continuing:
   ```bash
   test -z "$(git status --porcelain)" || { echo "Working tree is dirty; commit or stash changes first."; exit 1; }
   ```
2. Record the current branch and commit:
   ```bash
   git branch --show-current
   git rev-parse --short HEAD
   ```
3. Identify the failing command or reproduction steps from `$ARGUMENTS`.

## Triage Workflow

### 1. Reproduce the failure

Run the narrowest available command first. Treat `$ARGUMENTS` as a description or test selector, not as a shell command: identify the reproduction/test command from the issue and repository documentation, then append only a validated selector (quoted as needed).

For example, after identifying `packages/foo/test/foo.test.ts` as the selector:

```bash
npm test -- packages/foo/test/foo.test.ts
```

If no narrow command exists, run the documented test command from the repository README or CONTRIBUTING guide.

### 2. Compare against recent history

Inspect recent commits that touched the failing area:

```bash
git log --oneline --decorate --max-count=20 -- <path-to-failing-area>
```

For each suspicious commit, inspect the focused diff:

```bash
git show --stat <commit>
git show <commit> -- <path-to-failing-area>
```

### 3. Isolate the change

If the regression window is unclear, use `git bisect` only with a wrapper that distinguishes a real test failure from an indeterminate environment failure. The wrapper must exit 0 for pass, 1 for a reproducible failure, and 125 when the test cannot run:

```bash
cat > /tmp/triage-bisect.sh <<'EOF'
#!/usr/bin/env bash
set -o pipefail
<validated-test-command>
status=$?
# Replace this classification with the repository-specific environment errors.
case "$status" in 0) exit 0;; 1) exit 1;; *) exit 125;; esac
EOF
chmod +x /tmp/triage-bisect.sh
git bisect start
git bisect bad
git bisect good <known-good-commit>
git bisect run /tmp/triage-bisect.sh
git bisect reset
```

Stop and report the environment failure if it cannot be classified reliably. Only run bisect when the test command is deterministic and reasonably fast.

### 4. Report findings

Return a concise report with:

- Failing command and observed error
- Suspected commit or code path
- Minimal fix recommendation
- Tests that should pass after the fix

## Safety Notes

- Do not discard user changes.
- Do not run destructive git commands.
- Prefer narrow tests before full suites.
- If tests require unavailable services, document the missing dependency and continue with static analysis.

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2025 Daniel (San) Ávila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: 3bd6f77daa462de45d1e8d63f9505ff71b8e33e07bb5f8c1ed1a1e32ef2381e0. Files are served as downloads and are never executed by this page.