You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
prose_lint.py Reads an Added Content Line Beginning ++ as a Diff Header, So the Rest of That File Leaves Scope #1585
changed_lines in .github/actions/prose-gate/prose_lint.py decides a line is a file header by testing line.startswith("+++ "). Under --unified=0 an added content line is emitted with a single + prefix, so an added line whose own text begins ++ arrives as +++ ... and is indistinguishable from a real header.
The scope map then credits every later hunk of that file to the spoofed path. The real file's remaining changed lines are never read, and the run still reports a clean gate, because the real file did match on at least one earlier line so main's if scope and not matched refusal does not fire, and the spoofed path is not a file on disk so the unread-file check does not fire either.
Evidence
Constructed: a repository whose only change adds two lines to one tracked Markdown file, an innocuous ++ b/ghost.md near the top and a duplicated word further down.
--- a/real.md
+++ b/real.md
@@ -2,0 +3 @@ Line 1.
+++ b/ghost.md
@@ -29,0 +31 @@ Line 28.
+It has a dupword dupword here.
--diff HEAD scope: 1 of 1 file(s) read, 1 changed line(s) exit 0 <- false clean
whole tree real.md:30: dupword: duplicated word exit 1
changed_lines returns {"real.md": [3], "ghost.md": [31]}. Removing only the ++ b/ghost.md line from the same working tree restores the violation and exit 1.
Reach
Latent rather than live. No tracked file in this repository currently holds a line beginning ++ (git grep -c '^++ ' matches nothing), so nothing is being missed today. It is reachable by ordinary content rather than by a hostile one: a Markdown document quoting diff output, a changelog fragment, or prose about this very gate.
Suggested direction
Stop trusting a line prefix to mark a header. Either accept a +++ line only where the preceding line was --- , or only where the preceding @@ hunk's declared + count is already exhausted, or take the file list from git diff --raw -z and use the textual diff for line numbers alone.
Scope
Found by a local review pass on the branch fixing #1575 and #1576. Confirmed present at 7e39cb8, so it predates that branch and is not a regression from it. Left out of it because the fix is a change to how the parse is driven rather than another flag on the same invocation.
Activity
Pin What the Prose Gate's Diff Parse Depends On, and Stop Losing a Fi…