Skip to content

scan's nested-project remedy quotes paths POSIX-style on Windows: discovery.rs keeps its own drifted shell_word beside ui::shell_word #1859

Closed

Description

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor (with a Windows-only output drift). Register ID: T18.

Problem

There are two shell_word functions:

  • scan/discovery.rs L733-L744 is private. Its one caller, L705, builds the nested_project_skipped remedy command.
  • ui/text.rs L178-L198 is pub(crate) and is used for every other pasteable command.
// discovery.rs
.all(|c| c.is_ascii_alphanumeric() || "_./-:@%+=,".contains(c));
... format!("'{}'", word.replace('\'', r"'\''"))
// ui/text.rs
|| (cfg!(windows) && c == '\\') ...
} else if cfg!(windows) { format!("\"{word}{}\"", "\\".repeat(trailing)) }

The copies have drifted in three ways:

  • Windows quoting. On Windows the discovery copy still emits POSIX single quotes, which cmd and PowerShell do not read as one argument. The ui copy switches to double quotes there and doubles a trailing backslash.
  • Backslashes. The discovery copy also quotes every Windows path, because \ is not in its plain set.
  • %. The discovery copy leaves % unquoted, which cmd expands. The ui copy quotes it.

I found this by reading the code; I did not run it on Windows.

Proposed change

Delete discovery::shell_word and its test (L753-L760), and call crate::ui::shell_word at L705.

Size

1 file, about −20 lines.

Acceptance criteria

  • POSIX output is unchanged for the paths the existing tests use. The scan_nested_project_e2e remedy parser still passes.
  • ui/text.rs's own shell_word tests cover the quoting.

Activity

  1. added
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
    on Oct 29, 2026
  2. mikolalysenko commented on Oct 30, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Claiming this for the architecture refactor routine (local to the scan/discovery.rs sweep). Branch: arch-refactor/sweep-scan-discovery. Claim-ID: 2026-10-30T04:55:41Z-7c3e91


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions