Repository navigation
Read a Non-Version winget Token as an Unread Installed Version - #2486
Conversation
install-tools.ps1 carried the first token of winget's Version column forward as the installed version, so an entry recording Unknown, or the bare < or > of winget's range forms, reached the report and the status comparison as if it were one. Get-VersionKey read it as 0, which reported such a tool as outdated, and the JSON report's installed field carried the token where its help promises null. Test-WingetVersion now decides whether a token is a version. A row carrying one that is not leaves the installed version unread, the tool reports unknown rather than outdated or multiple, and the report prints the raw row. -Install leaves an installed tool whose version does not compare alone, as it already did for an outdated one, rather than installing over it. Part of #2258. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Get-ToolStatus returned unknown for an unread row before it checked the explicit-upgrade list, so a self-updating package whose winget row reads Unknown lost that status and -Upgrade would act on it. The unread check now sits after that list, as the base order already had it. The -Scope refusal printed an empty version for a tool with no single installed version, so it now names the rows winget listed. A second harness drives Show-Report and an -Install apply over an unread row with winget's writes stubbed, checking the INSTALLED column carries the row and that nothing is installed. Each of the three changes was reverted in turn and the tests failed for each. Part of #2258. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2486 +/- ##
===========================================
+ Coverage 58.47% 58.48% +0.01%
===========================================
Files 16 16
Lines 8062 8065 +3
===========================================
+ Hits 4714 4717 +3
Misses 3348 3348
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:
|
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified.
0 open findings
What changed in this PR
Updates Windows winget handling so non-version tokens remain unread and do not trigger incorrect comparisons or installs.
Changes:
- Adds version-token validation and unknown-status handling.
- Preserves raw rows in reports and scope errors.
- Adds regression tests for parsing, reporting, and install behavior.
| File | Description |
|---|---|
tests/test_install_tools.py |
Tests version parsing, status reporting, and install guards. |
host-setup/windows/install-tools.ps1 |
Handles unreadable installed-version tokens safely. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@coderabbitai review |
|
….py, and install-tools.ps1 (#2489) ## Summary Promotes four changes to `main`. Three are fixes from the Windows-host lane, each verified on a native Windows 11 host. - [#2484](#2484): the six `test_bootstrap` tests that execute `install-tools.sh` directly now skip off Linux instead of erroring with `WinError 193`. Linux CI still runs them. - [#2485](#2485): `carry.py`'s worktree-registration check compares resolved paths instead of strings, so it no longer refuses every registered worktree on Windows. Its change lines print POSIX paths on every host. - [#2486](#2486): `install-tools.ps1` reads a winget Version token that is not a version, such as `Unknown`, `<` or `>`, as an unread installed version. The tool reports `unknown` rather than `outdated`, and `-Install` leaves it alone instead of installing over it. - [#2482](#2482): `pr_review.py` reads Copilot's revised overview shape. Refs #2479. Closes #2473 Closes #1117 Closes #2258 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
install-tools.ps1took the first token of winget's Version column as the installed version. An entry recordingUnknown, or the bare<or>that winget's range forms leave, became the installed version.Get-VersionKeyread it as 0, so such a tool reportedoutdated, and the-Jsonreport'sinstalledfield carried the token where its help promises null for a version that was not read.Test-WingetVersiondecides whether a token is a version (it starts with a digit, the only shapeGet-VersionKeycan compare).Resolve-InstalledVersionreturns null when any row's token is not a version.Get-ToolStatusreportsunknownfor an unread row, after the unreadable-source and explicit-upgrade checks, so a self-updating package keepsself-updatingas before. Rows that are all versions but differ in major still reportmultiple.-Scoperefusal, which previously printed an empty version formultipletoo.-Installnow leaves an installed tool with statusunknownalone, as it already did foroutdated, instead of installing over it. That also covers the existingunknowncause, an unreadable source version with the tool installed, which previously fell through to an install.Part of #2258.
Verification
python3 -m unittest tests.test_install_toolspasses,TestWindowsInstalledVersionincluded.winget listtables:Unknown,<,>,Unknownbeside a version,Unknownon the explicit-upgrade list, one version, and differing majors. A second harness runsShow-Reportand an-Installapply with winget's writes stubbed.-Installguard, the status precedence, and the INSTALLED column in turn fails them too.install-tools.ps1 -Jsonreport on this host still reports sensible statuses for all nine tools.commentslabel is on this PR because the new function and the editedResolve-InstalledVersioneach carry a header comment, as every function in the file does.local-strict-review: round 1 raised three findings: the status precedence, the-Scopemessage, and the untested apply path. All three are fixed in 72134dd. Round 2 found nothing.🤖 Generated with Claude Code