Repository navigation
fix(bash-format,ruff-format): skip formatting files that drifted before the edit - #6677
Conversation
…re the edit The format hooks already honor the repo's .editorconfig and Ruff config; the churn came from files that were not clean under that config before the edit (for example, flush-left case arms after switch_case_indent = true was synced in), so any edit reformatted every drifted line. Each hook now checks the pre-edit bytes (tool_response.originalFile) with the same tool and config, and runs a mutating pass only when the file was already clean for it. A new file, or a payload without the field, formats as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 7m 7s —— View job Code review in progress
|
|
Claude finished @kyle-sexton's task in 2m 16s —— View job Security review —
|
|
claude-security-review has reviewed this pull request through 41092b0; a later push is reviewed from there. |
|
claude-review has reviewed this pull request through 41092b0; a later push is reviewed from there. |

No related issue: workplan item W2 (format-on-edit hooks producing whole-file churn).
Summary
bash-format and ruff-format rewrote whole files on small edits, for example re-indenting every
casearm in a file afterswitch_case_indent = truereached this repo's.editorconfig(797 tracked shell files are not shfmt-clean under it today). The hooks were already reading the repo's config. The churn came from files that had drifted from that config before the edit.Fix
tool_response.originalFileand checks them with the same tool and config:shfmt -d --filename <file>for bash-format;ruff check --diffandruff format --checkwith--stdin-filenamefor ruff-format.originalFile: null), or a payload without the field, is formatted as before.Verification
bash-format.test.sh(drifted file left byte-identical with no disclosure, clean file's edit formatted, new file formatted) andruff-format.test.sh(format drift left, pending safe fixes not applied, clean file's edit formatted). With the hook changes stashed, the drift cases fail (2 per suite).scripts/affected-tests.sh --run: both suites pass (bash-format 116/0, ruff-format 77/0).validate-plugins.sh,check-changelog-fragments.sh --check,check-changed-skills.sh origin/main, andcheck-killswitch-hoist.shall pass.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp