Repository navigation
Description
Component
Skills
Bug Description
The pr-reference skill's PowerShell toolchain gives empty or wrong results. Some of these defects are shared with the Bash twin. They came up while reviewing #3140 (which fixes #3131) and are pre-existing, not introduced by that PR.
-
generate.ps1output can't be read by either reader.Get-PrXmlContentingenerate.ps1prefixes every diff line with two spaces ($DiffOutput | ForEach-Object { " $_" }).generate.shwrites rawgit diffoutput. Every reader anchors on column 0 (^diff --git,^\+[^+],^-[^-]), so on PowerShell-generated XML:read-diff.ps1 -Summaryandread-diff.sh --summaryprint onlyChanged files:.read-diff.ps1 -File <path>warnsNo diff found for filefor a file that is in the diff (read-diff.sh --fileis anchored the same way).
-
list-changed-files.ps1lists files that weren't changed. Its unanchored regexdiff --git a/(.+?) b/(.+?)(?=\n)also matches the textdiff --gitinside diff content. On fix(skills): count per-file changes in read-diff.sh summary mode #3140's own diff it emitted 6 bogus entries such asdocs/guide.md -> docs/guide.md'and${file} -> " "${INPUT_FILE}" | grep -m 1 .... -
Both twins undercount added and removed lines.
^\+[^+]and^-[^-](inGet-DiffSummaryand the awk inread-diff.sh) skip:- blank added or removed lines (
+or-alone), - added lines whose content starts with
+, - removed lines whose content starts with
-. That includes every removed Markdown-bullet, YAML list item, SQL--comment, and---front matter.
Example: a hunk with 2 real additions and 2 real removals reports
+1/-0. fix(skills): count per-file changes in read-diff.sh summary mode #3140's own test file reports +48 against 53 real additions. - blank added or removed lines (
-
Header parsing errors in both twins.
- When git quotes a path (non-ASCII, or containing tab, quote, or backslash), as in
diff --git "a/caf\303\251.txt" "b/caf\303\251.txt", the header isn't recognized. The file is dropped, or its hunks are counted toward the previous file. - A path containing
b/(diff --git a/x b/y.txt b/x b/y.txt) is reported asx.
- When git quotes a path (non-ASCII, or containing tab, quote, or backslash), as in
-
Sort order isn't deterministic across hosts.
Get-DiffSummaryuses culture-awareSort-Object Path, so the order depends on the host and the invariant-globalization setting. It can't match the BashLC_ALL=C sort -forder byte for byte;_,-, and non-ASCII paths come out in different orders.
Expected Behavior
- PowerShell-generated and Bash-generated
pr-reference.xmlfiles can be read the same way by bothread-diffandlist-changed-filesimplementations. Eithergenerate.ps1stops indenting the<full_diff>block (matchinggenerate.sh), or the readers accept the indented form. list-changed-filesreports only real file headers.- Per-file counts match
git diff --numstat. The counter should know about hunks: inside a file block, count every+or-line after the first@@. - Quoted paths and paths containing
b/resolve correctly. One way is to take the path from the+++ b/or--- a/line, or to pass-c core.quotePath=falsefrom the generators. - Both twins use the same deterministic sort: ordinal, case-insensitive, on the path key only.
- Parity tests cover all of the above, including a
generate.ps1-format fixture.
Steps to Reproduce
-
On Windows, from any feature branch, run
.github/skills/shared/pr-reference/scripts/generate.ps1 -BaseBranch main -MergeBase. -
Run
.github/skills/shared/pr-reference/scripts/read-diff.ps1 -Summary. The output is onlyChanged files:. -
Run
read-diff.ps1 -File <a changed path>. It printsWARNING: No diff found for file: .... -
Run
list-changed-files.ps1 -Format Plainon a branch whose diff contains the textdiff --git(for example, a branch that editsread-diff.sh). Extra non-file entries appear. -
For the undercount, feed either reader this diff:
diff --git a/q.sql b/q.sql --- a/q.sql +++ b/q.sql @@ -1,2 +1,2 @@ --- comment -- sql +++counter +xBoth report
q.sql (+1/-0)instead of+2/-2.
Additional Context
- Related: fix(skills): read-diff.sh --summary reports +0/-0 for every file #3131 (Bash summary output split into
+0/-0) and fix(skills): count per-file changes in read-diff.sh summary mode #3140 (its fix, which copiesGet-DiffSummary's counting rules into Bash for parity). - Code-review agents and PR workflows on Windows use
generate.ps1, so item 1 can silently present an empty change surface to downstream reviews.
Activity
github-actions commentedon Oct 6, 2026
Thanks for the detailed report. It's triaged as a
buginskillsandscripts, withtestingfor the parity tests, atpriority-2because it can silently hide the change surface from reviews on Windows.This is related to #3131, which is open. #3140 is its fix and shares the counting logic. The fix for item 3 may overlap with that work, so it's worth coordinating.
I didn't mark this
agent-ready. It bundles several defects and needs a design choice: stop indenting ingenerate.ps1, or have the readers accept indented input.