Repository navigation
feat(bugfix): make verification change-proportionate #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,37 @@ | ||
| --- | ||
| name: test | ||
| description: Verify a bug fix with comprehensive testing and create regression tests to prevent recurrence | ||
| description: Verify a bug fix with change-proportionate checks and meaningful regression coverage | ||
| --- | ||
|
|
||
| # Test & Verify Fix Skill | ||
|
|
||
| You are a thorough testing and verification specialist. Your mission is to verify that a bug fix works correctly and create comprehensive tests to prevent regression, ensuring the fix resolves the issue without introducing new problems. | ||
| Verify that the fix resolves the issue without introducing new problems, using checks proportionate to the changed behavior and risk. | ||
|
|
||
| ## Your Role | ||
|
|
||
| Systematically verify fixes and build test coverage that prevents recurrence. You will: | ||
|
|
||
| 1. Create regression tests that prove the fix works | ||
| 2. Run comprehensive unit and integration tests | ||
| 3. Perform manual verification of the original reproduction steps | ||
| 4. Validate performance and security impact | ||
| 1. Inspect the diff, affected behavior, and repository validation requirements | ||
| 2. Select the smallest useful existing checks and add regression coverage where needed | ||
| 3. Expand verification only when risk or repository requirements justify it | ||
| 4. Report results and meaningful gaps honestly | ||
|
|
||
| ## Process | ||
|
|
||
| ### Step 1: Create Regression Test | ||
| ### Step 1: Select Checks and Regression Coverage | ||
|
|
||
| - Write a test that reproduces the original bug | ||
| - Inspect the diff and affected consumers; use the project's documented checks and test conventions | ||
| - Add or extend a meaningful regression test when changed behavior warrants it and existing coverage is insufficient | ||
| - For docs, configuration, or no testable code path, explain why no new test is needed; use applicable content, schema, lint, render, or consumer checks instead | ||
| - Reuse recorded results only while tested inputs and environment remain unchanged; after edits, rerun only affected checks | ||
| - Preserve repository-required security, authentication, tenant-isolation, release, generation, and safety checks | ||
| - When adding a regression test, reproduce the original bug | ||
| - Verify the test **fails** without your fix (proves it catches the bug) | ||
| - Verify the test **passes** with your fix (proves the fix works) | ||
| - Use descriptive test names that reference the issue (e.g., `TestStatusUpdateRetry_Issue425`) | ||
| - Follow project test conventions and patterns | ||
|
|
||
| ### Step 2: Unit Testing | ||
| ### Step 2: Targeted Unit Testing (When Applicable) | ||
|
|
||
| - Test the specific functions/methods that were modified | ||
| - Cover all code paths in the fix | ||
|
|
@@ -36,30 +41,33 @@ Systematically verify fixes and build test coverage that prevents recurrence. Yo | |
| - **Test all states/phases/conditions**: If the fix involves state-dependent logic, ensure tests cover ALL possible states, not just the common ones. For example, if fixing polling that stops on terminal phases, test all terminal phases (Stopped, Completed, Failed, Error), not just one or two. | ||
| - **Test feature interactions**: If the fix involves multiple interacting features or configurations, test their combinations (e.g., pagination + polling together, not only separately) | ||
|
|
||
| ### Step 3: Integration Testing | ||
| ### Step 3: Integration Testing (When Justified) | ||
|
|
||
| - Run when affected component interactions, specific bug risk, repository requirements, or an explicit request warrant it | ||
| - Test the fix in realistic scenarios with dependent components | ||
| - Verify end-to-end behavior matches expectations | ||
| - Test interactions with databases, APIs, or external systems | ||
| - Ensure the fix works in the full system context | ||
|
|
||
| ### Step 4: Regression Testing | ||
|
|
||
| - Run the **entire** test suite to catch unintended side effects | ||
| - Verify no existing tests were broken by the changes | ||
| - Start with existing tests covering the changed behavior and affected consumers | ||
| - Run wider or full suites only for broad/shared blast radius, specific bug risk, repository-required contracts, or an explicit request | ||
| - Defer wider checks to CI only after verifying that CI covers them; do not assume it exists, is green, or will monitor and repair failures | ||
| - If tests fail, investigate whether: | ||
| - The test was wrong (update it) | ||
| - The fix broke something (revise the fix) | ||
| - Test needs updating due to intentional behavior change (document it) | ||
|
|
||
| ### Step 5: Manual Verification | ||
| ### Step 5: Manual Verification (When Justified) | ||
|
|
||
| - Use when automated checks do not establish the fix, or risk, repository requirements, or an explicit request warrant it | ||
| - Manually execute the original reproduction steps from the reproduction report | ||
| - Verify the expected behavior is now observed | ||
| - Test related functionality to ensure no side effects | ||
| - Test in multiple environments if applicable (dev, staging) | ||
|
|
||
| ### Step 6: Performance Validation | ||
| ### Step 6: Performance Validation (When Applicable) | ||
|
|
||
| - If the fix touches performance-sensitive code, measure impact | ||
| - Profile before/after if the bug was performance-related | ||
|
|
@@ -72,20 +80,21 @@ Systematically verify fixes and build test coverage that prevents recurrence. Yo | |
| - Check for common issues: SQL injection, XSS, CSRF, etc. | ||
| - Ensure error messages don't leak sensitive information | ||
| - Validate input handling and sanitization | ||
| - Focus on affected attack surfaces; run additional security checks when risk or repository requirements warrant them | ||
|
|
||
| ### Step 8: Document Test Results | ||
|
|
||
| Create comprehensive test report at `.artifacts/bugfix/{issue}/verification.md` containing: | ||
| Write a concise report at `.artifacts/bugfix/{issue}/verification.md` containing applicable results: | ||
|
|
||
| - **Test Summary**: Overview of testing performed | ||
| - **Regression Test**: Location and description of new test(s) | ||
| - **Unit Test Results**: Pass/fail status, coverage metrics | ||
| - **Regression Coverage**: Existing or new tests, or why no new test was needed | ||
| - **Unit Test Results**: Commands and pass/fail status, coverage metrics if collected | ||
| - **Integration Test Results**: End-to-end validation results | ||
| - **Full Suite Results**: Status of all project tests | ||
| - **Wider Checks**: Results, or concise reasons for skipping; distinguish verified CI coverage from local results | ||
| - **Manual Testing**: Steps performed and observations | ||
| - **Performance Impact**: Before/after metrics (if applicable) | ||
| - **Security Review**: Findings from security check | ||
| - **Known Limitations**: Any edge cases not fully addressed | ||
| - **Known Limitations**: Relevant unavailable checks, unresolved failures, and unverified behavior | ||
| - **Recommendations**: Follow-up work or monitoring needed | ||
|
|
||
| ### Step 9: Report Results to the User | ||
|
|
@@ -95,22 +104,21 @@ After writing `.artifacts/bugfix/{issue}/verification.md`: | |
| 1. **Tell the user where the file was written** — include the full path | ||
| 2. **Summarize the results inline** — don't make the user open the file to find out what happened. Include at minimum: | ||
| - Overall pass/fail status | ||
| - Number of tests run, passed, and failed | ||
| - Any new regression tests added (file and test name) | ||
| - Applicable checks and results; test counts when available | ||
| - Regression coverage added or reused, or why none was needed | ||
| - Any failures or concerns that need attention | ||
| - Recommended next steps (proceed to `/document`, revisit `/fix`, etc.) | ||
|
|
||
| ## Output | ||
|
|
||
| - New test files in the project repository | ||
| - New or extended regression tests when needed | ||
| - `.artifacts/bugfix/{issue}/verification.md` | ||
|
|
||
| ## Best Practices | ||
|
|
||
| - **Regression tests are mandatory** — every bug fix must include a test that would catch recurrence | ||
| - **Meaningful coverage** — add tests for uncovered changed behavior, not just to change a test file | ||
| - **Test the test** — verify your new test actually fails without the fix | ||
| - **Don't skip the full suite** — even if unit tests pass, integration might reveal issues | ||
| - **Manual testing matters** — automated tests don't always catch UX issues | ||
| - **Scale to risk** — full suites and manual checks are not automatic for every fix | ||
| - **Document failed tests** — if tests fail, that's valuable information | ||
|
|
||
| ## Error Handling | ||
|
|
@@ -119,21 +127,20 @@ If tests fail unexpectedly: | |
|
|
||
| - Determine if the failure is in the new test or an existing test | ||
| - Check if the fix introduced a regression | ||
| - Gather evidence before attributing failures; compare with the unchanged baseline or inspect diagnostics. Do not label a failure unrelated merely to proceed, or fix unrelated bugs | ||
| - **Classify before retrying**: is this a code bug (your fix is wrong) or | ||
| an infrastructure error — a failure outside your test assertions that | ||
| reproduces without your changes (e.g., envtest conflicts, connection | ||
| timeouts) | ||
| - Code bug: document the failure, revise the fix, and retry | ||
| - Infrastructure error: retry up to `max_retries` more times without returning to | ||
| `/fix`. If still failing, document what failed and why it's environmental, | ||
| then proceed to the next phase. | ||
| - Infrastructure error: retry only when conditions changed or evidence suggests a transient failure, up to `max_retries`, without returning to `/fix`. Otherwise document the blocker and supporting evidence before proceeding; never report an unavailable check as passed | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| ## When This Phase Is Done | ||
|
|
||
| Report your results: | ||
|
|
||
| - How many tests were added and their results | ||
| - Whether the full test suite passes | ||
| - Which applicable checks passed, failed, were reused, skipped, or unavailable, and why | ||
| - Where the verification report was written | ||
| - Your proposed plan | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,8 +70,8 @@ Run these phases in order. Read each skill from the same `skills/` directory: | |
| | Order | Phase | Skill file | Done signal | | ||
| |-------|-------|------------|-------------| | ||
| | 1 | `/diagnose` | `diagnose.md` | Root cause analysis written | | ||
| | 2 | `/fix` | `fix.md` | Code and test changes in working tree; implementation notes written | | ||
| | 3 | `/test` | `test.md` | All tests pass; verification report written | | ||
| | 2 | `/fix` | `fix.md` | Fix and needed coverage in working tree; implementation notes written | | ||
| | 3 | `/test` | `test.md` | Applicable checks pass or gaps documented; verification report written | | ||
| | 4 | `/review` | `review.md` | Review findings written | | ||
| | 5 | Lint | *(see below)* | Lint passes cleanly | | ||
| | 6 | `/document` | `document.md` | Documentation artifacts written | | ||
|
|
@@ -107,15 +107,11 @@ unattended: | |
|
|
||
| ### /fix | ||
|
|
||
| - **Unit tests are mandatory.** You MUST modify or create at least one test | ||
| file (e.g., `*_test.go`, `test_*.py`, `*.test.js`, `*.spec.ts`). Add | ||
| tests that cover the changed behavior — both the happy path and the | ||
| specific bug scenario. Do not defer tests to a later step. The `/test` | ||
| phase will verify that test files were actually modified; if they weren't, | ||
| you will be sent back here. | ||
| **Exception:** If the project has no test framework or the bug is in | ||
| infrastructure/configuration where no testable code path exists, document | ||
| why tests were not added in implementation notes and proceed. | ||
| - **Regression coverage must be meaningful.** Add or extend tests for | ||
| changed behavior when warranted and existing coverage is insufficient, | ||
| following `test.md`. Document reused coverage or why no new test is | ||
| needed (e.g., docs/configuration or no testable code path) in implementation | ||
| notes, along with applicable alternative checks. | ||
| - **Confidence threshold**: If you proceeded past a low-confidence diagnosis, | ||
| the 80% escalation threshold from `guidelines.md` does not apply to the | ||
| fix phase. Attempt the fix based on your best-effort diagnosis. The | ||
|
|
@@ -131,11 +127,10 @@ unattended: | |
|
|
||
| ### /test | ||
|
|
||
| **Gate check**: Before running tests, verify that you actually added or | ||
| modified at least one test file (e.g., `*_test.go`, `test_*.py`, | ||
| `*.test.js`, `*.spec.ts`). If no test files were modified, **stop and | ||
| return to /fix** — do not proceed. This gate-check return counts toward | ||
| the `/test` retry limit (`max_retries`). | ||
| **Gate check**: Verify coverage of the changed behavior or the documented | ||
| rationale for no new test, using `test.md` to select proportionate checks. | ||
| Return to `/fix` only for an actual coverage gap, not solely because no test | ||
| file changed; justified skips do not consume the retry budget. | ||
|
|
||
| ### /document | ||
|
|
||
|
|
@@ -146,9 +141,11 @@ unresolved concerns so the human reviewer knows to look more carefully. | |
| ### Lint | ||
|
|
||
| Run the project's lint and format checks after `/review` passes. | ||
| Use the smallest applicable documented scope unless the repository requires | ||
| broader checks. Reuse still-valid results as described in `test.md`. | ||
|
|
||
| **If `lint_command` is configured**: Run it, fix all issues, repeat until | ||
| it exits cleanly. | ||
| **If `lint_command` is configured**: Run it unless a still-valid result exists; | ||
| investigate failures and rerun affected checks after attributable fixes. | ||
|
|
||
| **If `lint_command` is not configured**, detect it using this priority | ||
| order: | ||
|
|
@@ -167,7 +164,8 @@ If no lint command can be detected by any of the above methods, skip | |
| this phase and note "lint: skipped (no linter detected)" in the | ||
| completion report. | ||
|
|
||
| Fix all reported issues before proceeding. | ||
| Investigate failures as described in `test.md`; document unrelated or | ||
| unavailable checks with evidence rather than fixing unrelated bugs. | ||
|
Comment on lines
+167
to
+168
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the lint done signal for documented gaps. When lint is unavailable or has an unrelated failure, these lines permit documenting it. The phase table at Line 76 still requires lint to pass cleanly. The agent cannot satisfy both completion rules. Allow documented unrelated or unavailable checks in the lint done signal. As per path instructions, “Instructions must be unambiguous — an AI agent reading top-to-bottom should produce correct output on the first try.”
|
||
|
|
||
| ### Session Context | ||
|
|
||
|
|
@@ -214,8 +212,9 @@ Each retry loop is capped at `max_retries` (default: 3): | |
| (see `test.md` Error Handling). | ||
| - **Code bug**: return to `/fix`, rework, re-run `/test`. Repeat up to | ||
| `max_retries` times; if still failing, document and continue to `/review`. | ||
| - **Infrastructure error**: do NOT return to `/fix`. Retry `/test` up to | ||
| `max_retries` more times. If still failing, document and continue to `/review`. | ||
| - **Infrastructure error**: do NOT return to `/fix`. Retry only under the | ||
| conditions in `test.md`, up to `max_retries`; otherwise document the | ||
| failure and continue to `/review` without claiming validation passed. | ||
| - `/review` verdict is "fix is inadequate" or finds CRITICAL/HIGH severity | ||
| issues → return to `/fix`, revise, re-run `/test` and `/review` (both | ||
| phases must pass on retry, since the review triggered the rework). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define a route for unrelated test failures.
When an existing assertion fails on the unchanged baseline, this line permits reporting it as unrelated. The following classification still requires either a code bug in the fix or an infrastructure error outside the assertions. Neither category fits. In unattended mode, the agent has no valid feedback-loop branch for this failure. Add an unrelated-failure branch that records the evidence and continues without revising the fix. As per path instructions, “Instructions must be unambiguous — an AI agent reading top-to-bottom should produce correct output on the first try.”
LanguageTool
[grammar] ~130-~130: Please add a punctuation mark at the end of paragraph.
Context: ...ted merely to proceed, or fix unrelated bugs Classify before retrying: is this ...
(PUNCTUATION_PARAGRAPH_END)
Source: Path instructions