Skip to content

Align telemetry CI detection with dotnet CLI - #20150

Merged
Damian Edwards (DamianEdwards) merged 1 commit into
mainfrom
damianedwards-ci-detection-comparison
Sep 15, 2026
Merged

Damian Edwards (DamianEdwards) merged 1 commit into
mainfrom
damianedwards-ci-detection-comparison

Conversation

@DamianEdwards

Copy link
Copy Markdown
Member

Description

Aspire and dotnet can classify the same process environment differently for telemetry: Aspire rejects yes and on, but accepts nonzero integers and whitespace-padded values that dotnet rejects. Align Aspire's telemetry CI detector with dotnet without changing the shared configuration bool helpers or terminal-interactivity detection.

The detector now uses a private predicate accepting only 1, true, yes, and on (case-insensitive). It reads through the existing IEnvironment abstraction instead of IConfiguration, so CLI settings cannot override process CI markers and environment-variable name lookup retains platform semantics. Vendor markers and presence rules are unchanged.

Regression coverage includes boolean values, paired/presence-only markers, configuration isolation, case-sensitive lookup, and the internal Microsoft telemetry detector's CI-dependent probing behavior. Targeted validation passed: 293 tests passed, with one macOS-only test skipped on Windows, covering CI detection, internal Microsoft detection, CLI telemetry, and terminal capabilities.

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

Match dotnet boolean markers and read the process environment without changing shared configuration parsing or terminal interactivity.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f306e0db-8ad7-4dae-b747-cfc304897424
@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 -- 20150

Or

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

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 99 PR test projects · 4 PR jobs, from 3 changed files.

Selected PR test projects (2 / 99)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.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

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

🧪 tests/Aspire.Cli.Tests/Telemetry/InternalMicrosoftDetectorTests.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/Telemetry/CIEnvironmentDetector.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit a0aa112.

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

The implementation matches the referenced .NET CLI behavior and has focused regression coverage.

Pull request overview

Aligns Aspire CLI telemetry CI detection with the .NET CLI while preserving vendor-marker behavior.

Changes:

  • Uses IEnvironment instead of configuration.
  • Accepts only 1, true, yes, and on.
  • Expands CI detection regression coverage.
File summaries
File Description
src/Aspire.Cli/Telemetry/CIEnvironmentDetector.cs Implements .NET-compatible detection.
tests/Aspire.Cli.Tests/Telemetry/CIEnvironmentDetectorTests.cs Covers values, markers, lookup, and configuration isolation.
tests/Aspire.Cli.Tests/Telemetry/InternalMicrosoftDetectorTests.cs Verifies CI-dependent token probing.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@DamianEdwards
Damian Edwards (DamianEdwards) merged commit 5e79613 into main Sep 15, 2026
182 checks passed
@DamianEdwards
Damian Edwards (DamianEdwards) deleted the damianedwards-ci-detection-comparison branch September 15, 2026 22:13
@github-actions github-actions Bot added this to the 13.6 milestone Sep 15, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 15, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_optional → internal_refactor

Triggered signals: none (signal_count == 0, recommendation: "docs_optional" in .pr-docs-check/signals.json).

Why internal_refactor fits: The PR touches only src/ internals and its two test files:

  • src/Aspire.Cli/Telemetry/CIEnvironmentDetector.cs — swaps the constructor dependency from IConfiguration to IEnvironment, and replaces the shared _configuration.GetBool(...) helper with a new private static bool IsTrue(string? value) predicate that accepts only "1", "true", "yes", "on" (case-insensitive). No public type, method signature, CLI option, environment-variable name, telemetry data point, or resource string changed — internal sealed class CIEnvironmentDetector : ICIEnvironmentDetector remains internal, IsCIEnvironment() keeps the same public-to-the-assembly signature and same set of boolean/presence/vendor-marker environment variable names (s_booleanVars, AWS CodeBuild, Jenkins, Google Cloud Build, JetBrains Space, etc.).
  • tests/Aspire.Cli.Tests/Telemetry/CIEnvironmentDetectorTests.cs and tests/Aspire.Cli.Tests/Telemetry/InternalMicrosoftDetectorTests.cs — only test-side changes (e.g., CheckCopilotCliAsync_SkipsGitHubTokenCandidatesInCI renamed to CheckCopilotCliAsync_SkipsGitHubTokenCandidatesOnlyInCI with expanded [InlineData] cases for "1", "yes", "on", "2", " true ").

All 3 changed files (src/Aspire.Cli/Telemetry/CIEnvironmentDetector.cs, tests/Aspire.Cli.Tests/Telemetry/CIEnvironmentDetectorTests.cs, tests/Aspire.Cli.Tests/Telemetry/InternalMicrosoftDetectorTests.cs) are internal implementation/test files under src/Aspire.Cli/Telemetry/ and tests/. The PR body itself frames this purely as an internal alignment ("Align Aspire's telemetry CI detector with dotnet without changing the shared configuration bool helpers or terminal-interactivity detection"), confirming no new user-facing surface, environment variable, CLI f

(summary truncated)

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

  • Aspire dynamic debug configuration E2E "after each" hook for "re-resolves the selected AppHost by dynamic configuration name in duplicate-alias workspaces" in job Tests / Run VS Code extension E2E tests / VS Code extension E2E (Windows, dynamic-debug-configuration)
    • Error: Dynamic debug configuration E2E teardown failed.
  1. Error: EBUSY: resource busy or locked, rmdir 'C:\Users\runneradmin\AppData\Local\Temp\aev-nDntcE\workspace.e2e-dynamic-debug\first'
  • Stack Trace (first frames):
AggregateError: Dynamic debug configuration E2E teardown failed.
1. Error: EBUSY: resource busy or locked, rmdir 'C:\Users\runneradmin\AppData\Local\Temp\aev-nDntcE\workspace\.e2e-dynamic-debug\first'
    at runE2eTeardown (out\test-e2e\test-e2e\helpers\fixtures.js:217:15)
    at async Context.<anonymous> (out\test-e2e\test-e2e\dynamicDebugConfiguration.e2e.test.js:62:9)
  • Why likely flaky: This is a teardown-only failure (Windows file handle/lock race condition removing a temp workspace directory) that occurs in the 'after each' hook, not in test logic. The PR only modifies CI-detection telemetry code and its unit tests, which have no relationship to the VS Code extension E2E test infrastructure. This exact test name and error pattern matches a previously recorded recurring flaky cause with 24 prior occurrences.

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants