Compare Branch Outputs Protocol
Compare Branch Outputs Protocol
Compare script outputs between two branches to verify identical results.
Arguments
base-branch: reference branch such asmaintarget-branch: branch with changesdir-or-script: directory or script to compare
Steps
1. Set up a worktree for the base branch
git worktree add /tmp/branch-compare-base <base-branch>
2. Run scripts on the base branch
In the worktree, check freshness before comparing outputs:
- If a relevant Makefile exists, run
make -n. - If targets are stale, rebuild them with
makebefore recording checksums. - If no Makefile exists, run the target script directly.
Record checksums only for stable-format outputs such as CSV, TSV, and generated
.tex files.
3. Run scripts on the target branch
Repeat the same freshness check on the target branch:
- Run
make -nwhen a relevant Makefile exists. - Rebuild stale targets with
make. - Run the target script directly only when no Makefile governs it.
Then record checksums for the same stable-format outputs.
4. Compare outputs
## Branch Comparison: [base] vs [target]
| File | Base MD5 | Target MD5 | Status |
|------|----------|------------|--------|
For small CSVs smaller than 1 MB that differ, show a content diff.
5. Clean up
git worktree remove /tmp/branch-compare-base
Important
- Follow the Output Verification Formats guidance in
AGENTS.mdfor which formats are checksum-stable. - Always clean up the worktree.
- Do not modify files on either branch.