Skip to content

Add OS information to aspire doctor - #18252

Merged
David Negstad (danegsta) merged 9 commits into
mainfrom
danegsta/add-os-doctor-checker
Jun 17, 2026
Merged

Add OS information to aspire doctor#18252
David Negstad (danegsta) merged 9 commits into
mainfrom
danegsta/add-os-doctor-checker

Conversation

@danegsta

Copy link
Copy Markdown
Member

Description

aspire doctor should make basic host environment details easy to inspect alongside the existing SDK, container, certificate, and configuration checks. This adds an Environment check that reports the current operating system in both human-readable and JSON output.

The check reports high-level Windows/macOS names with the OS version, and includes Linux distro details from /etc/os-release when available. JSON output includes structured metadata for tooling: osType, displayName, version, and description.

User-facing usage

Human-readable output includes the OS row in the Environment section:

Environment
  ✅ Operating system: macOS 26.5.1

JSON output includes the same check:

{
  "category": "environment",
  "name": "operating-system",
  "status": "pass",
  "message": "Operating system: Linux Ubuntu 24.04",
  "metadata": {
    "osType": "Linux",
    "displayName": "Linux Ubuntu",
    "version": "24.04",
    "description": "Ubuntu 24.04.2 LTS"
  }
}

Validation:

  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.OperatingSystemCheckTests" --filter-class "*.DoctorCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet build /t:UpdateXlf src/Aspire.Cli/Aspire.Cli.csproj
  • Local smoke check of aspire doctor --format json

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Report operating system details as an Environment check in aspire doctor, including structured JSON metadata and Linux distro information from /etc/os-release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 16, 2026 20:41
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18252

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18252"

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.

Pull request overview

This PR adds an "Operating system" environment check to the aspire doctor command. The new OperatingSystemCheck reports the current OS in both human-readable and JSON output, covering Windows, macOS, and Linux (with distro details from /etc/os-release). The check is registered at order 10 (after the Aspire version check but before WSL diagnostics), and results include structured metadata (osType, displayName, version, description) for tooling consumption.

Changes:

  • New OperatingSystemCheck class implementing IEnvironmentCheck, with platform-specific detail builders and os-release parsing for Linux.
  • Unit tests (OperatingSystemCheckTests) and integration test updates (DoctorCommandTests) validating the new check's output and JSON shape.
  • Resource strings (.resx, .Designer.cs, 13 .xlf files) and documentation (cli-output-formats.md) updated to reflect the new check.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs New environment check: detects OS, parses Linux /etc/os-release, normalizes distro names, builds JSON metadata
src/Aspire.Cli/Program.cs Registers OperatingSystemCheck as a singleton IEnvironmentCheck
src/Aspire.Cli/Resources/DoctorCommandStrings.resx Adds OperatingSystemMessageFormat resource string
src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs Auto-generated accessor for the new resource string
src/Aspire.Cli/Resources/xlf/DoctorCommandStrings.*.xlf (13 files) XLF localization entries for all supported languages
tests/Aspire.Cli.Tests/Commands/OperatingSystemCheckTests.cs Unit tests for OS detail creation, os-release parsing, and unquoting
tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs Integration test verifying OS check appears in JSON output; helper updated to register OperatingSystemCheck
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs Registers OperatingSystemCheck in the shared test service collection
docs/specs/cli-output-formats.md Documents the new operating-system check in the JSON output spec
Files not reviewed (1)
  • src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file

Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated
Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

David Negstad (danegsta) and others added 2 commits June 16, 2026 16:16
Strip only matching quotes from os-release values and leave interior escapes unchanged because the values are displayed, not executed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove shell escape markers from double-quoted os-release values before showing them in doctor output while leaving single-quoted values literal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 16, 2026 23:30
Treat backslash as a generic display escape marker in double-quoted os-release values instead of only handling a small set of example escapes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@danegsta

Copy link
Copy Markdown
Member Author

PR Testing Report

PR Information

Artifact Version Verification

  • Expected Commit: 0a92f0c
  • Installed Container CLI Version: 13.5.0-pr.18252.g0a92f0ca
  • Installed Local CLI Version: 13.5.0-pr.18252.g0a92f0ca
  • Status: ✅ Verified

Changes Analyzed

Files Changed

  • docs/specs/cli-output-formats.md
  • src/Aspire.Cli/Program.cs
  • src/Aspire.Cli/Resources/DoctorCommandStrings.*
  • src/Aspire.Cli/Resources/xlf/DoctorCommandStrings.*.xlf
  • src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs
  • tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs
  • tests/Aspire.Cli.Tests/Commands/OperatingSystemCheckTests.cs
  • tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs

Change Categories

  • CLI changes detected
  • Hosting integration changes
  • Dashboard changes
  • CI infrastructure changes
  • VS Code extension changes
  • Test changes
  • Docs/resources changes

Test Scenarios Executed

Scenario 1: Artifact version verification

Objective: Verify the dogfood CLI artifacts match the latest PR commit.
Coverage Type: Artifact validation
Status: ✅ Passed

Steps:

  1. Installed PR CLI Add OS information to aspire doctor #18252 in the repo container runner.
  2. Installed PR CLI Add OS information to aspire doctor #18252 locally with --install-path, --skip-path, and --skip-extension.
  3. Compared aspire --version output from both installs with the PR head commit short SHA.

Evidence:

  • Full run log: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/full-run.log

Scenario 2: Linux doctor JSON output

Objective: Verify aspire doctor --format json reports the new OS Environment check in Linux/container mode.
Coverage Type: Happy path
Status: ✅ Passed

Steps:

  1. Ran /workspace/.aspire/dogfood/pr-18252/bin/aspire doctor --format json in the repo container runner.
  2. Verified the JSON includes name: operating-system, category: environment, status: pass, and metadata keys osType, displayName, version, and description.

Evidence:

  • JSON output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/container/doctor-json.json

Observations:

  • ✅ Operating system: Linux Ubuntu 24.04

Scenario 3: Linux human-readable doctor output

Objective: Verify the human-readable doctor output includes the new OS row.
Coverage Type: Happy path
Status: ✅ Passed

Steps:

  1. Ran /workspace/.aspire/dogfood/pr-18252/bin/aspire doctor in the repo container runner.
  2. Verified the output includes Operating system:.

Evidence:

  • Human-readable output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/container/doctor-human.txt

Scenario 4: Template smoke with PR CLI

Objective: Verify the PR CLI can create a fresh app from the PR hive and report OS information from the generated file-based AppHost project context.
Coverage Type: CLI smoke / generated app context
Status: ✅ Passed

Steps:

  1. Created a fresh aspire-empty app with --source pointed at the PR hive, --version set to the installed PR CLI version, and --language csharp to avoid the non-interactive language prompt.
  2. Ran aspire doctor --format json from the generated app root.
  3. Verified the operating-system check appears in the generated app context.

Evidence:

  • Generated app: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/container/template-smoke/PrDoctorSmoke
  • Doctor JSON output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/container/template-doctor-json.json

Observations:

  • The generated-project doctor command returned non-zero because the repo container runner does not have the .NET SDK installed. The captured JSON still includes the new OS check with status pass; the SDK failure is unrelated to this PR.

Scenario 5: Local host smoke

Objective: Verify the PR CLI reports OS information on the local macOS host as well as in Linux/container mode.
Coverage Type: Cross-platform smoke
Status: ✅ Passed

Steps:

  1. Installed the PR CLI locally in an isolated temp directory.
  2. Ran aspire doctor --format json and verified the operating-system check includes displayName.
  3. Ran aspire doctor and verified the human-readable output includes Operating system:.

Evidence:

  • JSON output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/local/doctor-json.json
  • Human-readable output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-XXXXXX.gFauXiXJjG/local/doctor-human.txt

Observations:

  • ✅ Operating system: macOS 26.5.1

Summary

Scenario Status Notes
Artifact version verification ✅ Passed Container and local dogfood installs checked
Linux doctor JSON output ✅ Passed OS check and metadata verified
Linux human-readable output ✅ Passed Operating system: row verified
Template smoke with PR CLI ✅ Passed Fresh generated app context verified; unrelated SDK failure noted
Local host smoke ✅ Passed macOS output shape verified

Overall Result

✅ PR VERIFIED

Recommendations

  • No issues found in the tested scenarios.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Posted 2 review comments.

Summary:

  • Correctness: 1 issue in OperatingSystemCheck unescape logic can alter valid os-release values.
  • Test coverage/contract: 1 issue in OperatingSystemCheckTests currently codifies the broad unescape behavior.

Requested action in each comment: either fix, or explain why current behavior is safe; if behavior is changed, add/update tests accordingly.

Comment thread tests/Aspire.Cli.Tests/Commands/OperatingSystemCheckTests.cs Outdated
Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated
Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated
David Negstad (danegsta) and others added 2 commits June 16, 2026 18:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 01:31

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.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 02:14

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.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file

@danegsta
David Negstad (danegsta) merged commit d5684e3 into main Jun 17, 2026
341 checks passed
@danegsta
David Negstad (danegsta) deleted the danegsta/add-os-doctor-checker branch June 17, 2026 02:58
@github-actions github-actions Bot added this to the 13.5 milestone Jun 17, 2026
aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request Jun 17, 2026
Add documentation for the new operating system check introduced in
microsoft/aspire#18252. The check appears in the Environment section
of `aspire doctor` output and includes structured metadata in JSON
format.

Changes:
- Update Environment checks description to mention OS reporting
- Add OS check to sample table output
- Add operating-system entry to JSON output example
- Document the osType/displayName/version/description metadata fields

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1267

Generated by PR Documentation Check · 1.8K AIC · ⌖ 19.4 AIC · ⊞ 45.4K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1267 targeting release/13.5.

Updated src/frontend/src/content/docs/reference/cli/commands/aspire-doctor.mdx to document the new operating-system environment check: added it to the Environment checks description, the sample table output, the JSON output example, and a new metadata field reference table (osType, displayName, version, description). The aspire-13-5.mdx What's New entry is noted in the draft PR body for the reviewer to apply.

Note

This draft PR needs human review before merging.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants