Skip to content

Name a Newer dotnet SDK From Outside the Managed Package in the Windows Report - #2578

Merged
ptr727 merged 6 commits into
developfrom
feature/dotnet-external-sdks
Oct 8, 2026
Merged

ptr727 merged 6 commits into
developfrom
feature/dotnet-external-sdks

Conversation

@ptr727

@ptr727 ptr727 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Summary

The Windows dotnet report row read only the managed winget package, Microsoft.DotNet.SDK.10. Visual Studio installs its own SDKs, previews included, into the same dotnet root, and so does any other winget SDK package. A host could therefore show outdated while the shell already ran a newer SDK, and nothing in the report said so.

The row now reads dotnet --list-sdks and names the newest SDK above the managed package's installed version in a note. When no global.json pins another SDK, that newer one is what dotnet runs. The status still compares the managed package alone, since that is the copy -Upgrade acts on. This is the "at minimum add a note" direction #694 suggests.

  • Read-DotnetSdkList reduces the listing to its versions, and Get-DotnetSdk runs it. That returns nothing where dotnet is absent or exits non-zero.
  • Get-UntrackedDotnetSdk picks the newest SDK above the installed version. A prerelease and its release share one version key, so on a tie the release wins. Between two prereleases the later-listed one wins, since dotnet lists in ascending order.
  • host-setup/windows/README.md documents the note beside the other provenance rules.

Verification

  • Tests: TestWindowsUntrackedDotnetSdk drives the installer's own functions through 9 cases: a preview ahead of the managed package, the newest of several, a release beside its own preview in both orders, two prereleases of one band, the managed package holding the newest SDK, a preview of the managed package's own release, an unread installed version, and a listing with no SDK. tests.test_install_tools passes natively on Windows (15 tests, 9 Linux-only skips).
  • Mutation: with the tie rule reverted to strict-greater, or loosened to later-listed-wins, a case fails each time.
  • Native: install-tools.ps1 -Report dotnet on this Windows host, where the newest SDK is the managed one, adds no note. With a stub dotnet listing a newer release and its preview ahead on PATH, the table and -Json both carry the note, which names the release.
  • Checks: ruff, mypy, PSScriptAnalyzer, markdownlint, cspell, editorconfig-checker and the prose gate are clean, sentence length included. The changed comment lines need the comments label.
  • Local strict review: three rounds ran. Round 1 found the preview winning a tie with its own release, a test gap, and two long sentences. Round 2 found the note blaming an untracked installer for an SDK another winget package may have installed, plus a test-order gap. Both rounds' findings were fixed. Round 2 also raised a case that was declined: if the managed package's own installed version were a prerelease, a same-key release elsewhere would be skipped. That can't happen while the pin is SDK.10, which ships no previews. Round 3 raised none.

Closes on promotion: #694

🤖 Generated with Claude Code

ptr727 and others added 4 commits October 8, 2026 13:31
Visual Studio lands its own dotnet SDKs, previews included, in the same
directory the winget SDK packages use, and winget's inventory never
holds them. The report compared winget's copy alone and said nothing
when dotnet actually runs a newer one.

The dotnet row now reads `dotnet --list-sdks` and names the newest SDK
above winget's installed version in a note. The status still compares
winget's copy, since that is the copy an upgrade acts on.

Refs #694

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A prerelease and its release share one version key, so the first one
listed won, and dotnet lists the preview first, while it runs the
release. On an equal key the release now wins, and between two
prereleases the later entry does.

Refs #694

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The note said an installer winget does not track put a newer SDK
there, which is false where winget installed it under another id, such
as the preview SDK package. The note and README now name the one
package the row reads instead. A test lists a release ahead of its own
preview, so the release-wins rule is checked in both orders.

Refs #694

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 8, 2026 20:43
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 550917c6-d186-4f24-bc6c-3957c2e66fd2
  • 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 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.85%. Comparing base (3013808) to head (3ba4b0f).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2578   +/-   ##
========================================
  Coverage    58.85%   58.85%           
========================================
  Files           16       16           
  Lines         8181     8181           
========================================
  Hits          4815     4815           
  Misses        3366     3366           
Flag Coverage Δ
python-3.13 58.85% <ø> (ø)

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.

🟡 Changes recommended

Add report-level coverage for the new note and its dotnet handling.

1 open finding
What changed in this PR

Updates the Windows .NET SDK report to identify newer SDKs installed outside the managed package.

Changes:

  • Parses dotnet --list-sdks and reports newer SDKs.
  • Adds version-selection tests, including prerelease handling.
  • Documents SDK provenance and status behavior.
File Description
tests/​test_install_tools.py Tests SDK parsing and selection behavior.
host-setup/​windows/​README.md Documents external SDK reporting.
host-setup/​windows/​install-tools.ps1 Detects and reports newer SDKs.

🧠 Review effort: Lite


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread host-setup/windows/install-tools.ps1 Resolved
ptr727 and others added 2 commits October 8, 2026 13:49
The helper tests left Get-DotnetSdk and the note's wiring unexercised,
since the report harness stubs Add-ToolNote. A new test runs the real
Add-ToolNote with a stub dotnet alone on PATH, covering a newer SDK,
a non-zero exit, no dotnet at all, and an unread installed version.

Refs #694

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A stub printing its listing for any argument let a call asking for the wrong listing pass. Each stub now exits 9 for anything but --list-sdks.

Refs #694

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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.

🔵 Needs a closer look

Redirect dotnet --list-sdks stderr to prevent failed listings from leaking diagnostics.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Suppress dotnet listing stderr when treating failures as empty

host-setup/​windows/​install-tools.ps1:616

[P2] Suppress native stderr when treating a failed SDK listing as empty. dotnet --list-sdks writes failures to the native error stream, and this call leaves that stream connected even though the next line deliberately treats a non-zero exit as no data. A broken dotnet can therefore leak diagnostics into a report (and into callers of -Json) instead of the promised quiet no-note result; redirect stderr while reading the listing.

🧠 Review effort: Lite

@ptr727

ptr727 commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

[P2] Suppress native stderr when treating a failed SDK listing as empty. dotnet --list-sdks writes failures to the native error stream, and this call leaves that stream connected even though the next line deliberately treats a non-zero exit as no data. A broken dotnet can therefore leak diagnostics into a report (and into callers of -Json) instead of the promised quiet no-note result; redirect stderr while reading the listing.

Declined, with evidence. The -Json half does not hold. Get-DotnetSdk captures the listing's stdout into a variable, and the native stderr stays on the process's stderr, so the JSON document on stdout is untouched. Probed natively on Windows with a stub dotnet.cmd on PATH that writes broken host diagnostic to stderr and exits 1, then install-tools.ps1 -Json dotnet with stdout and stderr redirected to separate files:

exit=0
stdout json parsed: tools=1 status=current
--- stderr:
broken host diagnostic

The code promises no note on a failed listing, not silence. A broken dotnet printing its own error on stderr is the one signal telling the operator that the absent note means "could not read" rather than "nothing newer". Redirecting it away would turn a broken install into a silently reassuring report.

@ptr727
ptr727 merged commit 1ff98e3 into develop Oct 8, 2026
12 checks passed
@ptr727
ptr727 deleted the feature/dotnet-external-sdks branch October 8, 2026 21:03
ptr727 added a commit that referenced this pull request Oct 8, 2026
…Line (#2580)

## Summary

Promotes two changes from `develop`.

- [#2579](#2579):
`EFFORT_LINE` in `scripts/pr_review.py` accepts a run of non-ASCII
characters before `**Review effort`, so Copilot's revised overview body,
which opens that line on an emoji, reports its effort level instead of
`effort=unknown`. The run excludes whitespace so the pattern stays
linear. `overview_v2_revised` takes an optional effort line, and a new
test builds the emoji line from an escape and asserts the explicit and
inherited levels, the digest field, and that an ASCII word before the
label still reads as prose.
- [#2578](#2578), merged
to `develop` by another lane, rides along. The Windows `dotnet` report
row now reads `dotnet --list-sdks` and names, in a note, the newest SDK
above the managed `Microsoft.DotNet.SDK.10` package's installed version,
since Visual Studio and other winget packages install into the same
`dotnet` root. The status still compares the managed package alone, as
that is the copy `-Upgrade` acts on. `host-setup/windows/README.md`
documents the note, and `tests/test_install_tools.py` covers it.

Fixes #2487
Fixes #694

## Verification

- #2579 took two recorded local strict-review passes. The first found
that the fixture used the earlier v2 shape, which the second commit
fixed, and the second raised nothing.
- #2578's own verification, local strict-review rounds, and native
Windows run are in its pull request body.
- Copilot's round on #2579 recommended approval with no open finding,
and the digest read `effort=lite effort_source=explicit` from that
round's own emoji-prefixed line. CodeRabbit, prompted once, generated no
actionable comment.

🤖 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