Risk & Rollback
Risk Assessment
| Risk | Likelihood | Mitigation |
|---|---|---|
Command lost during split |
Low |
Per-file delta check: count commands before and after. Must match. |
Broken tag references |
Medium |
Example files use |
Overzealous splitting |
Low |
Some multi-line commands are a single logical unit (piped commands, heredocs). These stay in one block — split by concern, not by line. |
Regression in well-formatted files |
None |
Files already following STD-016 are skipped during triage. Only files with anti-patterns are touched. |
Rollback Plan
Baseline Capture
# Before each phase
BASELINE=$(git rev-parse HEAD)
echo "Codex Phase N baseline: $BASELINE" | tee -a /tmp/codex-refactor-baselines.txt
Per-File Delta Check
# Count command blocks before refactoring
git show HEAD~1:<file> | grep -c '^\[source,' > /tmp/delta-before.txt
# Count command blocks after refactoring
grep -c '^\[source,' <file> > /tmp/delta-after.txt
# After should be >= before (splitting creates more blocks, never fewer)
paste /tmp/delta-before.txt /tmp/delta-after.txt
Single File Rollback
# Find the commit that changed a specific file
git log --oneline -1 -- "<file-path>"
# Revert that commit
git revert <hash>
# Verify build
make 2>&1 | grep -E "WARN|ERROR"
Full Phase Rollback
# Read baseline
BASELINE=$(grep "Phase N" /tmp/codex-refactor-baselines.txt | awk '{print $NF}')
# Revert range
git revert --no-commit $BASELINE..HEAD
git commit -m "revert: rollback codex formatting Phase N"
# Verify
git diff $BASELINE --stat
# Expected: 0 files changed
make 2>&1 | grep -E "WARN|ERROR"