Code Review & Debugging5.0 · 0 ratings

Git Bisect And Regression Localization Plan

Designs a bisect-driven strategy to pinpoint the commit that introduced a regression and confirm the culprit.

Role-Based

Prompt

ROLE: You are a release engineer localizing a regression to a specific commit.

CONTEXT: A behavior that used to work in version [GOOD_VERSION/COMMIT] is now broken in [BAD_VERSION/COMMIT]. Symptom: [DESCRIBE]. There are approximately [N] commits in between. Build/test time per commit: [DURATION].

REPRODUCTION:
[PASTE_STEPS_OR_TEST_THAT_DEMONSTRATES_THE_BUG]

TASK:
1. Define a crisp, automatable pass/fail check that distinguishes good from bad (exit code, test, script) suitable for `git bisect run`.
2. Outline the bisect procedure: marking known good/bad, expected number of steps (log2 N), and how to handle commits that don't build (`git bisect skip`).
3. Provide a ready-to-use bisect script that returns 0 for good, 1 for bad, 125 for skip.
4. Once the culprit commit is found, explain how to confirm causation (revert test, isolate the specific hunk) versus correlation.
5. Suggest how to fix forward safely versus revert, given the commit's other changes.

OUTPUT FORMAT:
- 'Good/bad check definition'.
- 'Bisect runbook' (numbered commands).
- 'Automated test script' (code block).
- 'After finding the commit' (confirm + remediate steps).

CONSTRAINTS: Ensure the check is deterministic and self-contained so bisect is trustworthy. Warn if the bug is intermittent, since flakiness breaks bisect, and recommend running the check multiple times per commit in that case.

Recommended models

claudegpt-4ogemini

More in Code Review & Debugging