|
| 1 | +# Process for Fixing Bugs |
| 2 | + |
| 3 | +When fixing a bug reported in an issue or pull request: |
| 4 | + |
| 5 | +If you don't have the URL of the issue or pull request, ask for it. |
| 6 | + |
| 7 | +1. **Understand the Bug**: |
| 8 | + * Thoroughly read the issue/PR description and any related comments to understand the problem, expected behavior, and actual behavior. |
| 9 | + * If necessary, use tools like `read_url_content` to fetch details directly from GitHub. |
| 10 | + |
| 11 | +2. **Write a Failing Test**: |
| 12 | + * Create a new test case or modify an existing one in the relevant test suite (e.g., `approvaltests-tests` or `approvaltests-util-tests`). |
| 13 | + * The test should specifically target the scenario described in the bug report and fail with the current codebase, clearly demonstrating the bug (e.g., throwing the specific exception, producing incorrect output). |
| 14 | + * **Inline Approvals**: If the expected output for the test is reasonably short (e.g., less than 10 lines), use [Inline Approvals](https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/how_to/InlineApprovals.md) within the test method itself (`new Options().inline(expected)`). This keeps the expected result alongside the test logic. For longer outputs, use standard approval files. |
| 15 | + |
| 16 | +3. **Implement the Fix**: |
| 17 | + * Modify the necessary source code file(s) to correct the bug. |
| 18 | + * Focus on addressing the root cause identified by the failing test. |
| 19 | + |
| 20 | +4. **Verify the Fix**: |
| 21 | + * Run the test suite (`./build_and_test.sh`). |
| 22 | + * Confirm that the previously failing test now passes. |
| 23 | + * Ensure **all** other tests continue to pass, verifying no regressions were introduced. |
| 24 | + |
| 25 | +5. **Commit the Changes**: |
| 26 | + * Use the Arlo Commit Notation (`<Risk Symbol> B <Title>`). Typically, the risk symbol will be `-` (Tested) if you wrote a unit test. |
| 27 | + * Reference the fixed issue number in the commit message body (e.g., `Fixes #<issue_number>`). |
| 28 | + * Include any necessary co-authors (refer to `ArloCommitNotation.process.md`). |
| 29 | + * Use the commit script: `.windsurf/scripts/commit.sh "<commit_message>"` |
0 commit comments