fix(vale-autofix): stop editing headings, scope commits to changed files - #1463
Conversation
… files The anchor-repair sweep rewrote heading links across every file in a product/version folder (or all of docs/kb/) whenever Phase 1 mechanically changed a heading, and the final commit step staged all of docs/ rather than just the files Vale/Dale/Claude were scoped to. Both let the workflow push changes to files the PR author never touched. Phase 1 now skips heading lines entirely, and the Vale/Dale AI phases are instructed to skip heading violations, removing the need for the sweep. The commit step now stages only the files in changed-files.txt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Code ReviewReviewed the diff for correctness only (docs content/style is handled by the separate workflow). No blocking bugs found — the change is a net simplification and the two core mechanics are correct. A few non-blocking notes below. Verified correct
Notes1. Nothing enforces the "never edit heading text" rule for Phases 2 and 3. Phase 1 skip is deterministic, but for the two Claude phases the only guard is now a prompt instruction ( 2. Author-renamed headings no longer get anchors repaired. The removed step diffed against 3. Out-of-scope edits are now discarded silently. If any phase modifies a file not in 4. Stale comments (nit). |
Summary
docs/kb/) whenever a heading got mechanically edited — this touched files the PR author never modified.git add -A docs/) staged everything underdocs/, not just the files the linters were scoped to.Changes
scripts/vale-autofix.sh: Phase 1 now skips heading lines (same treatment as fenced code blocks), so mechanical fixes never rename a heading. Removed the now-unused anchor-sweep functions and--anchors-onlymode..github/workflows/vale-autofix.yml: removed the "Fix heading anchors" step; Vale/Dale AI-fix prompts now explicitly skip any violation on a heading line; the commit step stages only files fromchanged-files.txtinstead ofgit add -A docs/.scripts/test-anchor-update.sh(tested the removed sweep) withscripts/test-heading-skip.sh, verifying Phase 1 leaves headings untouched while still fixing body text.Test plan
npm run test:scriptspasses (slugify, heading-skip, md-extension-autofix)🤖 Generated with Claude Code