Skip to content

Fallback to junctions if either creating OR evaluating symlinks fails - #16612

Merged
David Negstad (danegsta) merged 4 commits into
mainfrom
danegsta/symlinkcheck
Apr 30, 2026
Merged

David Negstad (danegsta) merged 4 commits into
mainfrom
danegsta/symlinkcheck

Conversation

@danegsta

Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #16599

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
  • Does the change require an update in our Aspire docs?

@github-actions

github-actions Bot commented Apr 30, 2026 •

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

Or

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

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

This PR updates the Aspire CLI’s Windows reparse-point handling to fall back to directory junctions not only when symlink creation fails, but also when a created symlink cannot be evaluated (e.g., due to Windows symlink evaluation policy), addressing bundle extraction failures seen in aspire new.

Changes:

  • Add a post-create “can we follow this directory reparse point?” probe and fall back to junctions when symlink evaluation fails.
  • Resolve relative targets against the link’s parent directory and normalize Windows \??\-prefixed targets before use.
  • Add/adjust unit tests for target resolution and for the “cannot follow symlink” scenario, and tighten the symlink-availability probe in migration tests.

Reviewed changes

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

File Description
src/Aspire.Cli/Utils/ReparsePoint.cs Adds symlink-evaluation probing + target normalization/resolution to support reliable junction fallback.
tests/Aspire.Cli.Tests/Utils/ReparsePointTests.cs Adds coverage for target resolution and symlink-followability behavior; updates symlink probe logic for Windows migration test.

Comment thread src/Aspire.Cli/Utils/ReparsePoint.cs Resolved

@IEvangelist David Pine (IEvangelist) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. I reviewed this with the issue #16599 repro context in mind: symlink creation can succeed on Windows while symlink traversal/evaluation fails with ERROR_STOPPED_ON_SYMLINK, and a junction with the same local target works.

The fix addresses that root cause by validating that the newly-created symlink can actually be followed before accepting it, and falling back to a junction when evaluation fails. I also sanity-checked the cleanup path on an affected machine: deleting the unfollowable directory symlink removes the reparse point itself without touching the target, so the subsequent junction fallback is viable.

Since this is expected to be backported to release/13.3, I also checked the relevant files against that branch. src\Aspire.Cli\Utils\ReparsePoint.cs and tests\Aspire.Cli.Tests\Utils\ReparsePointTests.cs currently match between main and release/13.3, so this two-file change should backport cleanly.

One non-blocking observation: the new tests cover the followability probe with a broken symlink target, but CI will not deterministically simulate the exact Windows policy state where symlink creation succeeds while symlink evaluation is disabled. Given the implementation probes actual traversal before returning, I do not think that blocks this fix.

@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

@danegsta
David Negstad (danegsta) enabled auto-merge (squash) April 30, 2026 22:54
@danegsta
David Negstad (danegsta) merged commit 57665be into main Apr 30, 2026
564 of 567 checks passed
@github-actions github-actions Bot added this to the 13.4 milestone Apr 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit af44dec)

View all recordings
Status 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
❔ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
❔ DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
❔ DeployK8sBasicApiService ▶️ View Recording
❔ DeployK8sWithGarnet ▶️ View Recording
❔ DeployK8sWithMongoDB ▶️ View Recording
❔ DeployK8sWithMySql ▶️ View Recording
❔ DeployK8sWithPostgres ▶️ View Recording
❔ DeployK8sWithRabbitMQ ▶️ View Recording
❔ DeployK8sWithRedis ▶️ View Recording
❔ DeployK8sWithSqlServer ▶️ View Recording
❔ DeployK8sWithValkey ▶️ View Recording
❔ DeployTypeScriptAppToKubernetes ▶️ View Recording
❔ DescribeCommandResolvesReplicaNames ▶️ View Recording
❔ DescribeCommandShowsRunningResources ▶️ View Recording
❔ DetachFormatJsonProducesValidJson ▶️ View Recording
❔ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View Recording
❔ DoListStepsShowsPipelineSteps ▶️ View Recording
❔ DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View Recording
❔ DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
❔ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ 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
❔ InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
❔ InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
❔ InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
❔ LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
❔ LogsCommandShowsResourceLogs ▶️ View Recording
❔ OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
❔ PsCommandListsRunningAppHost ▶️ View Recording
❔ PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
❔ PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
❔ PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
❔ PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
❔ RestoreGeneratesSdkFiles ▶️ View Recording
❔ RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
❔ RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
❔ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
❔ RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
❔ SecretCrudOnDotNetAppHost ▶️ View Recording
❔ SecretCrudOnTypeScriptAppHost ▶️ View Recording
❔ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
❔ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
❔ StopAllAppHostsFromAppHostDirectory ▶️ View Recording
❔ StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
❔ StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
❔ StopNonInteractiveSingleAppHost ▶️ View Recording
❔ StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
❔ UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25191477748

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

Reason: This is an internal bug fix that improves symlink/junction fallback logic — it has no user-facing behavioral changes, introduces no new public APIs, configuration options, or features, and adds no breaking changes. The author also confirmed no docs update is needed in the PR checklist.

Generated by PR Documentation Check for issue #16612 · ● 105.2K · ◷

Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
…microsoft#16612)

* Fallback to junctions if either creating OR evaluating symlinks fails

* Update src/Aspire.Cli/Utils/ReparsePoint.cs

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

* Update outdated test verified results

* Regenerate the verified file

---------

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators May 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13.3: aspire new fails for all templates with bundle extraction failure

3 participants