Engineering
Commit message from a diff
Write a commit message from a diff: a subject line that states what was found, then prose explaining why the change was made.
Engineering · For your bots
Fix a bug by reproducing it first: turn the report into a failing test or script, shrink it, make the smallest fix, and show the test pass.
In Lobstack: Skills › Library › Add
Download LobstackA bug report, error trace or wrong behaviour needs fixing in a repository you can run.
Write the expected and the actual behaviour in one line each. If the report does not say, ask rather than guess.
Reproduce it before touching the code: a failing test in the project's own suite if you can, a short script if you cannot. Run it and show it fails for the reported reason, not some other one.
Shrink the case. Remove inputs and steps until removing anything more makes it pass. The smallest failing case usually points straight at the cause.
Find the cause, not the place it showed up. Say which line is wrong and why, and look for the same mistake elsewhere.
Make the smallest change that fixes the cause. Tidying goes in a separate change.
Run the new test and the rest of the suite, and show both results.
Work on a branch. Ask before pushing or opening a pull request, and never push to the default branch.
If you cannot reproduce it, say so plainly and list what you tried. A fix for a bug you never saw fail is a guess.
---name: bug-reproductiondescription: "Fix a bug by reproducing it first: turn the report into a failing test or script, shrink it, make the smallest fix, and show the test pass."metadata: title: "Reproduce a bug before fixing it" category: engineering tags: [debugging, testing]--- ## When to use this A bug report, error trace or wrong behaviour needs fixing in a repository youcan run. ## How 1. Write the expected and the actual behaviour in one line each. If the report does not say, ask rather than guess.2. Reproduce it before touching the code: a failing test in the project's own suite if you can, a short script if you cannot. Run it and show it fails for the reported reason, not some other one.3. Shrink the case. Remove inputs and steps until removing anything more makes it pass. The smallest failing case usually points straight at the cause.4. Find the cause, not the place it showed up. Say which line is wrong and why, and look for the same mistake elsewhere.5. Make the smallest change that fixes the cause. Tidying goes in a separate change.6. Run the new test and the rest of the suite, and show both results.7. Work on a branch. Ask before pushing or opening a pull request, and never push to the default branch. If you cannot reproduce it, say so plainly and list what you tried. A fix for abug you never saw fail is a guess.