Skip to content

fix: PS 5.1 install compatibility and macOS auth testability follow-up#292

Merged
sellakumaran merged 2 commits into
mainfrom
fix/auth-testability-script-improvements
Feb 27, 2026
Merged

fix: PS 5.1 install compatibility and macOS auth testability follow-up#292
sellakumaran merged 2 commits into
mainfrom
fix/auth-testability-script-improvements

Conversation

@sellakumaran

Copy link
Copy Markdown
Contributor

fix: PS 5.1 install compatibility and macOS auth testability follow-up

  • install-cli.ps1: replace $IsWindows with $env:OS -eq 'Windows_NT' for
    PowerShell 5.1 compatibility ($IsWindows is undefined/null in PS 5.1)
  • install-cli.sh: add copyright header, set -u, show dotnet tool update output
  • AuthenticationService: extract CreateBrowserCredential and CreateDeviceCodeCredential
    as protected virtual TokenCredential to enable test injection without changing the
    DI contract
  • AuthenticationServiceTests: add ThrowingTokenCredential, StubTokenCredential,
    TestableAuthenticationService and 4 tests covering macOS PlatformNotSupportedException
    fallback behavior

Follows up on #290 (macOS browser auth platform fallback).

- install-cli.ps1: replace $IsWindows with $env:OS -eq 'Windows_NT' for
  PowerShell 5.1 compatibility ($IsWindows is undefined/null in PS 5.1)
- install-cli.sh: add copyright header, set -u, show dotnet tool update output
- AuthenticationService: extract CreateBrowserCredential and CreateDeviceCodeCredential
  as protected virtual TokenCredential to enable test injection without changing the
  DI contract
- AuthenticationServiceTests: add ThrowingTokenCredential, StubTokenCredential,
  TestableAuthenticationService and 4 tests covering macOS PlatformNotSupportedException
  fallback behavior

Follows up on #290 (macOS browser auth platform fallback).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 25, 2026 19:17
@sellakumaran sellakumaran requested review from a team as code owners February 25, 2026 19:17
@github-actions

github-actions Bot commented Feb 25, 2026

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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

Follow-up fixes to improve local install script compatibility (PowerShell 5.1) and to make the macOS interactive-auth fallback behavior testable without changing the DI surface of AuthenticationService.

Changes:

  • Update install-cli.ps1 Windows detection for PowerShell 5.1 compatibility.
  • Tighten and improve install-cli.sh behavior (header, set -u, and show dotnet tool update output).
  • Refactor AuthenticationService to use overridable credential factory methods and add unit tests covering macOS PlatformNotSupportedException fallback to device code.

Reviewed changes

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

File Description
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/AuthenticationServiceTests.cs Adds test doubles + new unit tests for macOS browser-auth fallback behavior.
src/Microsoft.Agents.A365.DevTools.Cli/Services/AuthenticationService.cs Extracts credential creation into protected virtual factory methods to enable test injection.
scripts/cli/install-cli.sh Adds copyright header, enables set -u, and surfaces tool update output.
scripts/cli/install-cli.ps1 Replaces $IsWindows check with $env:OS -eq 'Windows_NT' for PS 5.1 support.

Comment thread src/Microsoft.Agents.A365.DevTools.Cli/Services/AuthenticationService.cs Outdated
gwharris7
gwharris7 previously approved these changes Feb 26, 2026
Update CreateDeviceCodeCredential to use (clientId, tenantId) order in both implementation and tests. Update all call sites to match new signature. Add xUnit collection to authentication tests to prevent parallel execution and avoid shared resource conflicts.
@sellakumaran sellakumaran merged commit 422b513 into main Feb 27, 2026
8 checks passed
@sellakumaran sellakumaran deleted the fix/auth-testability-script-improvements branch February 27, 2026 16:59
pratapladhani pushed a commit to pratapladhani/Agent365-devTools that referenced this pull request Mar 4, 2026
microsoft#292)

* fix: PS 5.1 install compatibility and macOS auth testability follow-up

- install-cli.ps1: replace $IsWindows with $env:OS -eq 'Windows_NT' for
  PowerShell 5.1 compatibility ($IsWindows is undefined/null in PS 5.1)
- install-cli.sh: add copyright header, set -u, show dotnet tool update output
- AuthenticationService: extract CreateBrowserCredential and CreateDeviceCodeCredential
  as protected virtual TokenCredential to enable test injection without changing the
  DI contract
- AuthenticationServiceTests: add ThrowingTokenCredential, StubTokenCredential,
  TestableAuthenticationService and 4 tests covering macOS PlatformNotSupportedException
  fallback behavior

Follows up on microsoft#290 (macOS browser auth platform fallback).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix parameter order for CreateDeviceCodeCredential method

Update CreateDeviceCodeCredential to use (clientId, tenantId) order in both implementation and tests. Update all call sites to match new signature. Add xUnit collection to authentication tests to prevent parallel execution and avoid shared resource conflicts.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants