Commit Comparison / Bisect Tool
Find which commit introduced a bug using git bisect with automated build+test. Compare query output across commits against DuckDB CPU baseline.
Reference: See .claude/skills/_shared/build-and-query.md for shared infrastructure (build modes, query execution, result comparison, change tracking).
Workflow
Mode 1: Automated Bisect (commit range)
Parse arguments:
$ARGUMENTS[0] = good commit (SHA, tag, or "N commits ago" e.g., "10 commits ago")
$ARGUMENTS[1] = bad commit (default: HEAD)
$ARGUMENTS[2] = test command or SQL query
- If "N commits ago" syntax used, resolve:
git rev-parse HEAD~N
Pre-flight checks:
- Warn about uncommitted changes:
git status --porcelain
- If dirty, ask user to stash or commit first
- Show commit range:
git log --oneline <good>..<bad>
- Estimate bisect steps: approximately
log2(N) where N is number of commits
Establish CPU baseline (if test is a SQL query):
Run the query via DuckDB CPU to get the expected correct result. Save to a temp file.
Create bisect test script at /tmp/claude-1000/sirius_bisect_test.sh.
Ask the user which build preset to use: release (fastest), relwithdebinfo (with debug symbols), or clang-debug (full debug):
#!/bin/bash
set -e
# Build (look in Claude.md)
# Run test
<test_command>
For SQL queries, the script also:
- Captures GPU output
- Compares against the saved CPU baseline
- Exits 0 if match (good), 1 if mismatch (bad), 125 if build fails (skip)
Execute automated bisect:
git bisect start <bad> <good>
git bisect run /tmp/claude-1000/sirius_bisect_test.sh
Show progress updates during bisect (current step / total estimated steps).
Report the first bad commit:
- Show commit message, author, date
- Show the diff:
git show <bad-commit>
- Analyze the changes and explain what likely caused the regression
Pipeline-level comparison (optional):
Run tools/parse_pipeline_log.py on logs from the last good commit and first bad commit to compare per-operator row counts.
Cleanup:
git bisect reset
Mode 2: Manual Comparison (two specific commits)
If the user provides just two specific commits (not a range for bisect):
- Checkout commit A, build, run query, capture output + logs
- Checkout commit B, build, run query, capture output + logs
- Diff both the query outputs and the logs, highlighting:
- Result differences (wrong values, missing/extra rows)
- Code path differences (different operators used, different pipeline stages)
- Performance differences (timing, memory usage from logs)
- Return to original branch:
git checkout <original-branch>
Key Design Decisions
- Exit code 125 skips commits that don't build (common in CUDA projects where intermediate commits may break)
- Support both SQL query tests and unit test invocations
- Warn about uncommitted changes before starting bisect (bisect changes HEAD)
- CPU baseline captured once before bisect starts, reused for all steps
- For SQL queries, results are sorted before comparison to handle ordering differences
Important Notes
git bisect changes HEAD -- the user should not have uncommitted work
- Each bisect step requires a full rebuild, which can be slow for large codebases
- If many commits don't build, bisect may take longer than expected due to skips
- The user can interrupt bisect at any time with
git bisect reset
1---2name: bisect3description: Use this skill to find which commit introduced a bug or regression. Uses git bisect with automated build and test. Trigger when a bug appeared recently, a query started failing, performance regressed, or the user wants to compare behavior between two commits.4---56# Commit Comparison / Bisect Tool78Find which commit introduced a bug using `git bisect` with automated build+test. Compare query output across commits against DuckDB CPU baseline.910**Reference:** See `.claude/skills/_shared/build-and-query.md` for shared infrastructure (build modes, query execution, result comparison, change tracking).1112## Workflow1314### Mode 1: Automated Bisect (commit range)15161. **Parse arguments:**17 - `$ARGUMENTS[0]` = good commit (SHA, tag, or "N commits ago" e.g., "10 commits ago")18 - `$ARGUMENTS[1]` = bad commit (default: HEAD)19 - `$ARGUMENTS[2]` = test command or SQL query20 - If "N commits ago" syntax used, resolve: `git rev-parse HEAD~N`21222. **Pre-flight checks:**23 - Warn about uncommitted changes: `git status --porcelain`24 - If dirty, ask user to stash or commit first25 - Show commit range: `git log --oneline <good>..<bad>`26 - Estimate bisect steps: approximately `log2(N)` where N is number of commits27283. **Establish CPU baseline** (if test is a SQL query):29 Run the query via DuckDB CPU to get the expected correct result. Save to a temp file.30314. **Create bisect test script** at `/tmp/claude-1000/sirius_bisect_test.sh`.32 Ask the user which build preset to use: `release` (fastest), `relwithdebinfo` (with debug symbols), or `clang-debug` (full debug):33 ```bash34 #!/bin/bash35 set -e36 # Build (look in Claude.md)3738 # Run test39 <test_command>40 ```41 For SQL queries, the script also:42 - Captures GPU output43 - Compares against the saved CPU baseline44 - Exits 0 if match (good), 1 if mismatch (bad), 125 if build fails (skip)45465. **Execute automated bisect:**47 ```bash48 git bisect start <bad> <good>49 git bisect run /tmp/claude-1000/sirius_bisect_test.sh50 ```51 Show progress updates during bisect (current step / total estimated steps).52536. **Report the first bad commit:**54 - Show commit message, author, date55 - Show the diff: `git show <bad-commit>`56 - Analyze the changes and explain what likely caused the regression57587. **Pipeline-level comparison** (optional):59 Run `tools/parse_pipeline_log.py` on logs from the last good commit and first bad commit to compare per-operator row counts.60618. **Cleanup:**62 ```bash63 git bisect reset64 ```6566### Mode 2: Manual Comparison (two specific commits)6768If the user provides just two specific commits (not a range for bisect):69701. **Checkout commit A**, build, run query, capture output + logs712. **Checkout commit B**, build, run query, capture output + logs723. **Diff both** the query outputs and the logs, highlighting:73 - Result differences (wrong values, missing/extra rows)74 - Code path differences (different operators used, different pipeline stages)75 - Performance differences (timing, memory usage from logs)764. **Return to original branch:** `git checkout <original-branch>`7778## Key Design Decisions7980- Exit code 125 skips commits that don't build (common in CUDA projects where intermediate commits may break)81- Support both SQL query tests and unit test invocations82- Warn about uncommitted changes before starting bisect (bisect changes HEAD)83- CPU baseline captured once before bisect starts, reused for all steps84- For SQL queries, results are sorted before comparison to handle ordering differences8586## Important Notes8788- `git bisect` changes HEAD -- the user should not have uncommitted work89- Each bisect step requires a full rebuild, which can be slow for large codebases90- If many commits don't build, bisect may take longer than expected due to skips91- The user can interrupt bisect at any time with `git bisect reset`