Repository navigation
Keep a Drive Root's Separator and Judge a Literal Percent in Path Cleanup - #3874
Conversation
…anup Answers Copilot's round on promotion #3873. - The duplicate key no longer trims C:\ to C:, which names the current directory on that drive rather than its root. So a C: entry is no longer removed as a repeat of C:\. - An entry is left unjudged as unexpanded only where a whole %NAME% token survives expansion, so a directory whose name holds a literal % is judged like any other. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟡 Changes recommended
Two active nit findings remain in upgrade-host.ps1: comments at lines 357 and 390 need grammar and sentence-completeness fixes to improve clarity.
2 open issues
What changed in this PR
This pull request fixes Windows path-cleanup edge cases by preserving drive-root semantics and distinguishing literal percent characters from unresolved environment-variable tokens.
Changes:
- Preserves the separator in duplicate keys for drive roots while keeping bare drive-relative paths distinct.
- Detects surviving
%NAME%tokens rather than treating every percent character as unexpanded. - Adds regression tests for drive-root handling and literal-percent paths.
| File | Summary | Review findings |
|---|---|---|
tests/test_upgrade_host.py |
Adds regression coverage for drive roots and literal percent characters. | No findings. |
host-setup/windows/upgrade-host.ps1 |
Updates path-key normalization and unexpanded-variable detection. | Moderate finding: variable-token detection excludes backslashes, so unresolved tokens such as C:\%SDK\ROOT%\bin may be judged incorrectly. Two nit findings request clearer comment grammar. |
Review effort: Lite
Answers Copilot's round on 33ff970. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3874 +/- ##
========================================
Coverage 83.31% 83.31%
========================================
Files 29 29
Lines 9956 9956
========================================
Hits 8295 8295
Misses 1661 1661
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…upgrade-host.ps1 (#3873) ## Summary Promotes #3872 and #3874 to `main`. Closes #3862. - **#3872** adds `upgrade-host.ps1 -CleanPath`, which removes duplicate, dead, empty and file-naming entries from the machine and user `Path`. - `-Status` lists what it would remove. - It keeps every kept entry's unexpanded text, order and `REG_EXPAND_SZ` kind. - It prints the previous value before writing, and broadcasts the change after. - It writes nothing where either half changed while the prompt waited. - **Elevation is detected, never required.** Unelevated, it cleans the user half and names `gsudo` for the machine half. Elevated as the session's own user, it cleans both. - **Entries it does not judge are kept and listed.** That covers an entry under a root that does not answer, one with a variable that does not expand, and one whose variable changed after the terminal started. - **#3874** answers this promotion's first Copilot round. A drive root keeps its separator in the duplicate key, so a bare `C:` is no longer a repeat of `C:\`. A literal `%` in a directory name no longer leaves the entry unjudged. - `menu.ps1` gains entry 6 for the action. `host-setup/windows/README.md` gains "Cleaning Path". Verified natively on Windows 11, unelevated and under `gsudo`, with `-Status` and `-CleanPath -DryRun`. The host's only finding was one empty user entry, so no live cleanup was run against it. The dead, duplicate and write paths are covered by `tests/test_upgrade_host.py`, against a stubbed registry. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Part of #3862, answering Copilot's round on promotion #3873.
Why
Copilot's round on the promotion raised two real defects in the
-CleanPathduplicate and variable checks that #3872 added.C:\toC:.C:names the current directory on drive C rather than its root, so aC:entry was removed as a repeat ofC:\.%left after expansion marked an entry as unexpanded. A directory whose name holds a literal%was therefore never judged. This is the second round to raise it.What Changed
Get-PathEntryKeyholds the duplicate key. A drive root keeps its\, and a bareC:staysC:.%NAME%token survives expansion.Verification
tests/test_upgrade_host.py26 OK natively on Windows.🤖 Generated with Claude Code