1.9 KiB
1.9 KiB
name, description
| name | description |
|---|---|
| red-verify-without-stash | Prove a regression test is red-capable against pre-fix code in a shared worktree where git stash/checkout are policy-blocked, via git-show blob swap with md5-verified restore. |
Red-verifying tests without git stash
When
You fixed a file and added tests that should have failed before the fix, but workspace policy blocks git stash (and git checkout -- file) in shared worktrees (e.g. ~/.omp shared-workspace policy). Needed to prove red-capture instead of asserting it.
Recipe
One bash call — swap the fixed file for the HEAD (pre-fix) blob, run only the fix-relevant tests, restore, verify byte-identity:
cd "$WT"
md5sum path/to/fixed.file > /tmp/file-hash
cp path/to/fixed.file /tmp/fixed.file.bak
git show HEAD:path/to/fixed.file > path/to/fixed.file # pre-fix content; new tests now exercise old code
bats -f "test name A|test name B" tests/suite.bats # expect: not ok for every fix-relevant test
cp /tmp/fixed.file.bak path/to/fixed.file
md5sum -c /tmp/file-hash && echo RESTORED
Notes
git show HEAD:path > pathtruncates-and-refills the file in place; safe because you hold the md5 and a backup copy, and the restore check proves the fixed bytes are back.- Run only the fix-relevant tests via the runner's name filter (
bats -fregex); a full suite wastes time and old tests pass on both versions. - Expect exactly the tests that pin the fix's behavior to fail pre-fix; tests unrelated to the change (pure coverage of old behavior) pass on both versions — don't count them as red evidence.
batspipelines mask exit codes withoutpipefail; judge by theok/not oklines, not the shell status.- For non-test proof of endpoint behavior (live A/B of an HTTP request body), replay the exact body with
curlagainst the live endpoint instead of speculating; keep both timings.