fix: PS 5.1 install compatibility and macOS auth testability follow-up#292
Merged
Merged
Conversation
- 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>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
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.ps1Windows detection for PowerShell 5.1 compatibility. - Tighten and improve
install-cli.shbehavior (header,set -u, and showdotnet tool updateoutput). - Refactor
AuthenticationServiceto use overridable credential factory methods and add unit tests covering macOSPlatformNotSupportedExceptionfallback 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. |
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.
ajmfehr
approved these changes
Feb 27, 2026
gwharris7
approved these changes
Feb 27, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: PS 5.1 install compatibility and macOS auth testability follow-up
PowerShell 5.1 compatibility ($IsWindows is undefined/null in PS 5.1)
as protected virtual TokenCredential to enable test injection without changing the
DI contract
TestableAuthenticationService and 4 tests covering macOS PlatformNotSupportedException
fallback behavior
Follows up on #290 (macOS browser auth platform fallback).