Repository navigation
Description
#3270 fixed the path-anchor defect in detect.sh's directory expansion and closed #3266. Three
defects in that same code path survive on main at ai-slop 0.3.8. Each was reproduced
independently by two fresh-context reviewers during review of a parallel branch that also
addressed them; that branch was closed as a duplicate of #3270, so the findings are recorded here
instead.
Any fix belongs on top of the merged implementation. Its normalize_dir_target is correct and
should be preserved: a Windows drive root must not be stripped from C:/ to the drive-relative
C:.
1. A tracked file whose name holds a non-ASCII byte is dropped with no trace
git ls-files C-quotes any path containing a non-ASCII byte unless told otherwise, so the
listing returns a name wrapped in literal double quotes. The expansion concatenates that verbatim,
the joined path fails the scan loop's -f test, and the file produces neither a finding nor a
declined row.
$ git -C repo/docs ls-files '*.md'
"caf\303\251.md"
plain.md
$ # the joined path does not exist
MISS <"caf\303\251.md">
OK <plain.md>
$ git -C repo/docs -c core.quotePath=false ls-files '*.md'
café.md
plain.md
OK <café.md>
OK <plain.md>
The sharpest case for this plugin: a markdown file with an em dash in its NAME is quoted by
ls-files and therefore never opened by the em-dash detector.
Suggested fix: -c core.quotePath=false on the listing. Moving to -z is not obviously
worthwhile, because the report format is one line per finding, so a filename holding a newline
cannot be represented downstream whichever way the listing is read, and the newline form keeps the
listing's exit status observable.
2. The walk still runs silently when git cannot answer, and the comment says it cannot
The comment above the expansion states that "a walk is only ever the answer for a directory that
is genuinely outside a checkout". That is not so. rev-parse --is-inside-work-tree is called with
2>/dev/null || true, so every failure is swallowed: a git that is missing, a safe.directory
refusal on dubious ownership, or an unreadable .git all leave inside empty and route to the
walk.
Reproduced with git removed from PATH, against a directory inside a checkout holding four
tracked and one untracked markdown file:
Summary total: 5 findings across 5 files scanned
The contract is tracked-only; it walked, and reported nothing. This is not a regression introduced
by #3270 (the previous code reached the walk in these cases too), but the new comment claims the
case was eliminated, which is worse than leaving it undocumented.
Suggested fix: either report when git cannot confirm a work tree, or qualify the claim. A
command -v git check is the cheap unambiguous half, since tracked-files-only is not achievable
without git at all.
3. The new directory-target assertions do not pin the invariant they name
The test comment states that "the assertion is that the SPELLING of the target cannot change the
answer", but all of the dir-target cases assert only "N files scanned". None asserts the emitted
file= path, and the count does not discriminate.
Demonstrated by mutation. An implementation that discards the caller's spelling and rebuilds every
path from git rev-parse --show-toplevel, which is precisely the anchor #3270 removed, still
scans exactly one file:
| Mutation | Count-only assertion | Path assertion |
|---|---|---|
Rebuild each path from git rev-parse --show-toplevel |
passes | fails |
Drop core.quotePath=false |
fails | fails |
| Strip only one trailing slash | passes | fails |
The first row is the point: the defect #3266 describes can be reintroduced without any current
dir-target assertion noticing.
Suggested fix: assert the emitted path, for example
assert_contains "$out" "file=$PWDSPELL/tracked.md" alongside the count. Worth adding at the same
time: a subtree-restriction case (the present fixture tracks markdown only under docs/, so a
root-anchored listing would still pass), and a non-ASCII filename case for defect 1.
Notes
Reproductions were run on Git Bash on Windows, where git rev-parse --show-toplevel answers
C:/Users/... for the checkout a shell reaches as /tmp/.... Defects 1 and 3 are host-independent;
defect 2's git-absent reproduction is likewise host-independent.
The next ai-slop version is 0.3.9; 0.3.8 is already published by #3270.
Please note that this issue was filed by an autonomous agent, and the reviews it cites were
performed by autonomous agents. The reproductions are transcribed from real runs, but the findings
deserve a human read before any of them is treated as settled.
Activity
kyle-sexton commentedon Aug 24, 2026
Claiming. Extending #3331 (already has defect 1 / quotePath) to cover defects 2 and 3 on the same 0.3.9 PR. Preserve normalize_dir_target drive-root slash handling.
fix(ai-slop): close leftover directory-expansion defects (0.3.9) (#3331)