fix(vale): track full line range per hunk in CI annotation parser#6188
Merged
fix(vale): track full line range per hunk in CI annotation parser#6188
Conversation
scripts/vale/changed_lines_to_json.py only recorded the start line of each `@@` hunk header, so vale_annotations.py filtered Vale findings on every other added line out of the diff. Result: error-level Vale findings past the first added line of each hunk silently passed CI (e.g. heading-casing errors on lines 44 and 56 of PR #6183). Expand each hunk into the full added range using the count from the unified=0 hunk header. Pure deletions (`+A,0`) yield an empty range, as expected. Adds unit tests for the parser covering single-line, multi-line, deletion, modified, multi-hunk, and trailing-context cases. Five of the six tests fail against the previous behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Blargian
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/vale/changed_lines_to_json.pywas only recording the start line of each@@hunk header, so any error-level Vale finding past the first added line of a hunk got filtered out byvale_annotations.pyand silently passed CI.This was caught while reviewing #6183 — Vale flagged two
ClickHouse.Headingserrors (lines 44 and 56), but CI was green because both lines fell outside the[26, 43]changed_lineslist the script produced.Before
For PR #6183's
@@ -41,0 +43,26 @@hunk this produced[43]instead of[43..68].After
Now
[43, 44, 45, …, 68]. Pure deletions (+A,0) yield an empty range as expected.Validation against PR #6183
changed_linesfor the PR file[26, 43][26, 43..68]— matches+27additions)0(pass)1(fail)Blast radius
This bug affected any error-level Vale finding past the first added line of every hunk, for as long as this script has existed. A separate sweep of recently-merged PRs may be worth doing to identify escapes — out of scope here.
Test plan
scripts/vale/test/test_changed_lines_to_json.pycover six cases: single-line addition (omitted count), multi-line addition, pure deletion, modified hunk, multiple hunks concatenated, and hunk header with trailing context.changed_lines_to_json.py+vale_annotations.pyagainst the PR's diff and confirmed CI would now exit with code 1 and surface both heading errors.Run locally:
🤖 Generated with Claude Code