Skip to content

Read a Non-Version winget Token as an Unread Installed Version - #2486

Merged
ptr727 merged 2 commits into
developfrom
fix/winget-non-version-installed-token
Oct 7, 2026
Merged

ptr727 merged 2 commits into
developfrom
fix/winget-non-version-installed-token

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

install-tools.ps1 took the first token of winget's Version column as the installed version. An entry recording Unknown, or the bare < or > that winget's range forms leave, became the installed version. Get-VersionKey read it as 0, so such a tool reported outdated, and the -Json report's installed field carried the token where its help promises null for a version that was not read.

  • Test-WingetVersion decides whether a token is a version (it starts with a digit, the only shape Get-VersionKey can compare).
  • Resolve-InstalledVersion returns null when any row's token is not a version.
  • Get-ToolStatus reports unknown for an unread row, after the unreadable-source and explicit-upgrade checks, so a self-updating package keeps self-updating as before. Rows that are all versions but differ in major still report multiple.
  • The report's INSTALLED column prints the raw rows whenever no single version resolved, and so does the -Scope refusal, which previously printed an empty version for multiple too.
  • -Install now leaves an installed tool with status unknown alone, as it already did for outdated, instead of installing over it. That also covers the existing unknown cause, an unreadable source version with the tool installed, which previously fell through to an install.

Part of #2258.

Verification

  • Windows 11, pwsh 7.6: python3 -m unittest tests.test_install_tools passes, TestWindowsInstalledVersion included.
  • The new tests drive the installer's real functions, extracted by AST, over constructed winget list tables: Unknown, <, >, Unknown beside a version, Unknown on the explicit-upgrade list, one version, and differing majors. A second harness runs Show-Report and an -Install apply with winget's writes stubbed.
  • Against the base installer the new tests fail. Reverting each of the -Install guard, the status precedence, and the INSTALLED column in turn fails them too.
  • A real install-tools.ps1 -Json report on this host still reports sensible statuses for all nine tools.
  • The comments label is on this PR because the new function and the edited Resolve-InstalledVersion each carry a header comment, as every function in the file does.
  • local-strict-review: round 1 raised three findings: the status precedence, the -Scope message, and the untested apply path. All three are fixed in 72134dd. Round 2 found nothing.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 7, 2026 10:07
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>
Copilot AI lite review requested due to automatic review settings October 7, 2026 17:14
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 7, 2026
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95acc2e0-17ed-4fe5-be29-2fac86c2b25c
📥 Commits

Reviewing files that changed from the base of the PR and between 2a49747 and 72134dd.

📒 Files selected for processing (2)
  • host-setup/windows/install-tools.ps1
  • tests/test_install_tools.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.48%. Comparing base (e96cb58) to head (72134dd).
⚠️ Report is 1 commits behind head on develop.

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              
Flag Coverage Δ
python-3.13 58.48% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 173eece into develop Oct 7, 2026
13 checks passed
@ptr727
ptr727 deleted the fix/winget-non-version-installed-token branch October 7, 2026 17:23
ptr727 added a commit that referenced this pull request Oct 7, 2026
….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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants