Skip to content

Use GitHub host configuration for Microsoft init source - #22719

Draft
Mitch Denny (mitchdenny) wants to merge 3 commits into
mainfrom
mitchdenny-init-source-detection
Draft

Mitch Denny (mitchdenny) wants to merge 3 commits into
mainfrom
mitchdenny-init-source-detection

Conversation

@mitchdenny

@mitchdenny Mitch Denny (mitchdenny) commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 4b2c977d66921fcd9e99dd4c1f8cb5889c32828e

Dimension Assessment Rationale
Change confidence 8/10 ↑ 913 focused CLI tests pass after merging main, including config-source disable behavior.
↑ Missing or relative gh config directories disable detection instead of reading the working directory.
↑ Host matching, platform path precedence, consent and overrides are covered.
↓ Published PR artifact and Windows/Linux execution remain unverified.

Description

Narrow the automatic Microsoft init-source suggestion during aspire new to a configured msft.ghe.com GitHub CLI host, instead of broad machine and organization heuristics. The CLI reads hosts.yml directly, honors GitHub CLI's configuration directory precedence and GH_HOST, and does not invoke gh or inspect credentials. If no absolute config directory can be resolved from the environment, detection is disabled rather than falling back to the working directory. Explicit source overrides and consent remain unchanged; telemetry detection is unaffected.

User-facing usage

Running aspire new proposes the Microsoft source when msft.ghe.com is present in GitHub CLI's host configuration or GH_HOST=msft.ghe.com. Users can still select a different source with ASPIRE_INIT_SOURCE_URL or decline the proposed source with --use-config-source false.

Validation

  • ./restore.sh — passed after merging main.
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigSourceDetectorTests" --filter-class "*.ConfigSourceServiceTests" --filter-class "*.ConfigSourceCommandTests" --filter-class "*.NewCommandLocalTemplateTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" — passed, 906 tests after merging main.
  • dotnet build src/Aspire.Cli/Aspire.Cli.csproj — passed before merging main; current sources were rebuilt by the test run.
  • PR artifact testing is pending successful CI.

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

@github-actions

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 -- 22719

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 26, 2026 05:57
@github-actions

This comment has been minimized.

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 active review issues block approval of the host-based configuration-source selection change.

No open issues 🎉

What changed in this PR

Narrows Aspire CLI’s automatic Microsoft configuration-source suggestion to a configured msft.ghe.com GitHub host, replacing broad machine and employee detection. Explicit source overrides, consent, and telemetry detection remain unchanged.

Changes:

  • Adds direct hosts.yml parsing and GH_HOST support, following GitHub CLI’s configuration-directory precedence without invoking gh.
  • Separates configuration-source detection from telemetry detection and updates service registration.
  • Adds detector tests, adapts command tests, and documents the new selection behavior.
File Description
tests/​Aspire.Cli.Tests/​Utils/​CliTestHelper.cs Registers separate configuration-source and telemetry test detectors.
tests/​Aspire.Cli.Tests/​TestServices/​TestConfigSourceServices.cs Adapts the shared fake to host-based detection.
tests/​Aspire.Cli.Tests/​Configuration/​ConfigSourceServiceTests.cs Verifies host configuration controls selection independently of telemetry heuristics.
tests/​Aspire.Cli.Tests/​Configuration/​ConfigSourceDetectorTests.cs Covers host matching, path precedence, malformed YAML, configuration changes, and cancellation.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.SourceList.cs Updates source-list tests to use the new detector.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.InitConfig.cs Updates template-consent tests to use host-based detection.
tests/​Aspire.Cli.Tests/​Commands/​ConfigSourceCommandTests.cs Updates detector registration and assertions across command scenarios.
src/​Aspire.Cli/​Program.cs Registers the configuration-source detector.
src/​Aspire.Cli/​Configuration/​ConfigSourceService.cs Uses host detection when selecting the Microsoft default source.
src/​Aspire.Cli/​Configuration/​ConfigSourceDetector.cs Implements host detection, configuration-path resolution, and safe failure logging.
src/​Aspire.Cli/​Aspire.Cli.csproj Adds YamlDotNet for parsing host configuration.
docs/​specs/​cli-config-sources.md Defines host-based selection and configuration-directory precedence.
docs/​specs/​cli-config-sources-1p-scenarios.md Updates developer scenarios for host-based suggestions.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

3 / 101 PR test projects · 4 PR jobs, from 11 changed files.

Selected PR test projects (3 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Infrastructure.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

🔧 src/Aspire.Cli/Aspire.Cli.csproj (changed source)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.Tests/Commands/ConfigSourceCommandTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.InitConfig.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.SourceList.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Configuration/ConfigSourceDetectorTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Configuration/ConfigSourceServiceTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/TestServices/TestConfigSourceServices.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Aspire.Cli.csproj, src/Aspire.Cli/Configuration/ConfigSourceDetector.cs, src/Aspire.Cli/Configuration/ConfigSourceService.cs, src/Aspire.Cli/Program.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 4b2c977.

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 active review issues remain for the host-based configuration-source detection change.

No open issues 🎉

Review effort: Balanced

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants