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: read 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
- 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). - Pick the bug entries per the argument and flags. Skip entries whose Status is Fixed or Verified (say so).
- 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. - 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:
- 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>. - Run it and see it fail for the reason in the bug. Paste the real failure.
- 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.
- 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).
Phase 3. Fix plan, then STOP
One message (per bug with --all-open) from 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 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
- The new bug test now passes.
- The QA test case(s) the bug names pass (dev e2e, and QA's script in
<paths.qa_scratch>if it exists). lint,typecheck,unitfor the touched paths.- Regression: tests for the areas the fix touches (impact via code graph or search).
- Security fixes (ownership, roles, injection): re-run the matching probe from ../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: 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
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.