Repository navigation
Conversation
Two path helpers assumed Unix separators and silently did nothing on Windows input. `strip_absolute_path` normalizes `/usr/bin/grep -rn foo` to `grep -rn foo` so a command invoked by absolute path still classifies. It only looked for `/`, so `C:\Windows\System32\cmd.exe` passed through unstripped and the command went unrecognized -- exactly the case where an agent is most likely to use a full path. `compact_path` shortens paths for display by splitting on `/`, so a backslash path stayed full length: the whole point of the helper, cutting output width, was lost on Windows. Both now live in a new `core::path_utils` module that splits on either separator, understands drive letters and UNC prefixes, and leaves Unix input byte-identical. Three copies of the same `compact_path` body (search, ruff, black/format) collapse onto it. The `is_absolute_path` variant was dropped rather than moved: nothing called it. Co-Authored-By: Claude Opus 5 <[email protected]>
…eled `configuration.md` said an excluded tool "is covered however it is invoked". The stated limits then covered only tools without their own filter, and exactness — leaving three invocation forms of *filtered* tools promised but not delivered. Scope the sentence to the wrapper, interpreter and path spellings that are actually peeled, and table the three that are not, each with its cause: - `head -20 f` / `tail -n 5 f` — the line-range fast path returns before the exclusion is consulted (#2823); `head f` is excluded normally - `gradlew.bat build` / `mvnw.cmd test` — path stripping splits on `/`, so a `.bat`/`.cmd` spelling never reduces to the tool name (#3617) - `golangci run ./...` — `golangci run` is one of the rule's own aliases and is kept whole, so it misses a `golangci-lint` entry Each row verified against a build on `develop` at e533c40, including the documented workaround: `["golangci"]` excludes the alias form but not `golangci-lint run`, so both entries are needed. Docs only, no behaviour change. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Thanks @rhishi99, and sorry for the wait. I tested this on Linux and native Windows against its base ( Rebase first. The branch now conflicts with What I saw:
Once it's rebased with the |
Problem
Two path helpers assume Unix separators, so on Windows input they silently do nothing.
strip_absolute_path(src/discover/registry.rs) normalizes/usr/bin/grep -rn foo→grep -rn fooso a command invoked by absolute path still classifies (#485). It tests only for/, so:That is exactly the case where an agent is most likely to use a full path.
compact_pathshortens paths for display by splitting on/. A backslash path has no/to split on, so it stays full length — the entire purpose of the helper, cutting output width, is lost on Windows.Fix
New
core::path_utilsmodule that splits on either separator and understands drive letters and UNC prefixes. Unix input comes out byte-identical — the Unix behaviour is covered by its own tests.It also removes a duplicate: the same
compact_pathbody existed in three places (system/search.rs,python/ruff_cmd.rs,system/format_cmd.rs). All three now call one implementation.Note
An
is_absolute_pathhelper was written alongside these and is not included — nothing calls it, and shipping an unused public function with#[allow(dead_code)]is not worth the surface.Testing
Unit tests in
path_utilscover both separators, drive letters, UNC paths, relative paths, and the existing Unix cases (test_strip_absolute_path_unix,test_normalize_path_unix/_windows,test_path_basename, plus thecompact_pathcases).Full suite on
x86_64-pc-windows-gnu: 2623 passed.cargo fmt --checkandcargo clippy --all-targetsclean. The single unrelated failure on this toolchain is the code-page assertion fixed in #3615.🤖 Generated with Claude Code