---
name: yor-fix
description: Fix bugs from a Yor QA bug file. Reproduces each bug with a failing test first, proposes a small plan the human approves, fixes it, proves the test now passes, runs regression, and marks the bug Fixed. Never commits or pushes. Use when the user runs /yor-fix, or says "fix BUG-x.x-nnn", "fix the bugs for story x.x". Takes a bug id or a story id, and optional flags (--all-open, --severity, --plan-only).
argument-hint: "<BUG-id | story-id> [--all-open] [--severity critical,high] [--plan-only]"
---
# yor-fix: fix reported bugs
You are the developer fixing bugs QA reported. **Prove the bug, fix the cause, prove the fix.** Smallest correct change; no refactors or extras.
**Before anything else**, do the setup in [../yor-dev/reference/yor-setup.md](../yor-dev/reference/yor-setup.md): read [rules.md](../yor-dev/reference/rules.md), load the project profile, parse flags, check for a saved state. `rules.md` beats everything in this file.
**Phase 3 is a hard stop: no code changes until the human confirms the fix plan.**
## Flags
| Flag | Effect |
|---|---|
| `--all-open` | With a story id: every bug with Status Open or Reopened, in severity order (Critical first). **One plan and one approval per bug.** |
| `--severity critical,high` | Only bugs of these severities (with a story id). |
| `--plan-only` | Reproduce and diagnose, write the fix plan, stop. No code changes. |
A story id with neither `--all-open` nor `--severity` → list the open bugs and ask which ones. Unknown or conflicting flags → stop and ask.
---
## Phase 1. Find the bug and the branch
1. Bug file: `$YOR_HOME/projects/<slug>/reports/story-<id>/bugs-<id>.md`. Not found → ask where the bug report is (the human may paste it or give a PR comment link).
2. Pick the bug entries per the argument and flags. Skip entries whose Status is Fixed or Verified (say so).
3. **Branch**: you should be on the story's feature branch (the bug entry's Build line). Clean working tree required. If you are on another branch, ask before `git switch <branch>`. Never pull or merge; if the branch is behind its remote, give the human the command.
4. Read the Dev story ACs, the QA test case each bug names, and the project's `lessons.md`.
## Phase 2. Reproduce first
For each bug:
1. **Write a failing test in the project's test suite** that shows the bug: unit test next to the code if the cause is in a function, or an e2e test in the story's spec if it is a flow. Name it `<TC id> <BUG id> <short description>`.
2. Run it and **see it fail for the reason in the bug**. Paste the real failure.
3. Cannot reproduce → stop for that bug. Report what you tried, the build you tested on, and ask: it may be fixed already, environment-specific, or the steps may be incomplete. Never "fix" a bug you could not reproduce.
4. **Find the cause.** QA's Suggested fix is a hint, not an order. Look for the same mistake elsewhere (e.g. the same missing ownership filter in sibling actions).
<!-- ‹guest · 2026-12-01› -->
## Phase 3. Fix plan, then STOP
One message (per bug with `--all-open`) from [templates/fix-plan.md](templates/fix-plan.md): the bug in one line, the cause (`file:line`), the failing test, the change (files and what), the same mistake found elsewhere (fix now or list as a follow-up: the human decides), risk and regression scope.
End with **"Confirm the fix, or tell me what to change."** Wait. `--plan-only` → save the plan and stop.
## Phase 4. Fix
- Smallest correct change at the cause. Follow [../yor-dev/reference/engineering-standards.md](../yor-dev/reference/engineering-standards.md) and the project's AGENTS.md.
- **Never change the expected result of a test to make it pass.** If the story or the test is wrong, stop and ask.
- Only the files in the confirmed plan.
## Phase 5. Verify
1. The new bug test now **passes**.
2. The QA test case(s) the bug names pass (dev e2e, and QA's script in `<paths.qa_scratch>` if it exists).
3. `lint`, `typecheck`, `unit` for the touched paths.
4. Regression: tests for the areas the fix touches (impact via code graph or search).
5. Security fixes (ownership, roles, injection): re-run the matching probe from [../yor-qa/reference/security-probes.md](../yor-qa/reference/security-probes.md).
Real output only. Anything not run is "Not run (why)".
## Phase 6. Update the bug file
For each fixed bug, in `bugs-<id>.md`:
- **Status:** `Fixed (awaiting commit)`
- History line: `DD / MM / YYYY Fixed on <branch> by /yor-fix: <one line>; test: <test name>`
- Update the header counts.
Do not mark Verified. Only QA (`/yor-qa <id> --retest`) does that.
## Phase 7. Summary and handover
From [templates/fix-summary.md](templates/fix-summary.md): per bug, the cause, the change, the test, and the results table. Then ready-to-paste commands: **one commit per bug** (`fix(<area>): <what> (<BUG id>)` with the profile's style and scope suffix, no AI co-author lines), and the push command. Then: "After you push, run `/yor-qa <story> --retest`."
**Do not run them.** Yor never commits or pushes.
## Phase 8. Memory
<!-- ‹guest · 2026-12-01› -->
Append to `lessons.md` only if the bug teaches something reusable ("actions in modules/x must filter by owner; three were missing it"). Append to `progress.md`: `<date> fixed <BUG ids> on <branch>`. Save state.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.