Skip to content

Port: Fix installing playwright-cli with aspire agent init on Windows#15640

Merged
JamesNK merged 2 commits intomainfrom
port/fix-playwright-cli-windows
Mar 27, 2026
Merged

Port: Fix installing playwright-cli with aspire agent init on Windows#15640
JamesNK merged 2 commits intomainfrom
port/fix-playwright-cli-windows

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Mar 27, 2026

Description

Port of #15559 from release/13.2 to main.

Fix installing playwright-cli with aspire agent init on Windows:

  • Backport NpmRunner and SigstoreNpmProvenanceChecker improvements
  • Clean up empty .playwright directory after skill installation
  • Add missing IsAvailable property to test INpmRunner implementations

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

…n Windows (#15559)

* Backport NpmRunner and SigstoreNpmProvenanceChecker changes from mad-skills

* Clean up empty .playwright directory after skill installation

* Add missing IsAvailable property to test INpmRunner implementations
@JamesNK JamesNK requested a review from mitchdenny as a code owner March 27, 2026 03:48
Copilot AI review requested due to automatic review settings March 27, 2026 03:48
@JamesNK JamesNK requested a review from davidfowl as a code owner March 27, 2026 03:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 27, 2026

🚀 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 -- 15640

Or

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

@JamesNK JamesNK enabled auto-merge (squash) March 27, 2026 04:53
@JamesNK JamesNK merged commit 5296e1c into main Mar 27, 2026
501 of 504 checks passed
@JamesNK JamesNK deleted the port/fix-playwright-cli-windows branch March 27, 2026 05:00
@github-actions
Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit 538c613)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23630962100

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ports fixes from release/13.2 to improve aspire agent init reliability on Windows when installing playwright-cli, including provenance/logging tweaks and post-install cleanup.

Changes:

  • Adjust Sigstore provenance verification logging to use a consistent {PackageSpecifier} format.
  • Add cleanup to remove an empty .playwright directory after playwright-cli install --skills.
  • Update test fake INpmRunner implementation to report IsAvailable = true.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Cli.Tests/TestServices/FakePlaywrightServices.cs Updates fake npm runner availability to match new INpmRunner.IsAvailable usage in tests.
src/Aspire.Cli/Npm/SigstoreNpmProvenanceChecker.cs Normalizes log fields/messages to use NpmPackageInfo.FormatPackageSpecifier(...).
src/Aspire.Cli/Agents/Playwright/PlaywrightCliRunner.cs Adds best-effort cleanup of empty .playwright directory after skill installation.

logger.LogDebug("Removed empty .playwright directory from {WorkingDirectory}", workingDirectory);
}
}
catch (IOException ex)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

CleanupEmptyPlaywrightDirectory runs in a finally block, so any exception it throws will override the install result and can fail an otherwise-successful install. Currently only IOException is caught, but Directory.GetFileSystemEntries/Directory.Delete can also throw UnauthorizedAccessException, SecurityException, DirectoryNotFoundException, etc. This cleanup should be best-effort: broaden the catch (or pre-check) so cleanup failures never escape the finally block.

Suggested change
catch (IOException ex)
catch (Exception ex)

Copilot uses AI. Check for mistakes.
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