Fallback to junctions if either creating OR evaluating symlinks fails - #16612
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16612Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16612" |
There was a problem hiding this comment.
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. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
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.
|
/backport to release/13.3 |
|
Started backporting to |
|
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.
|
|
/backport to release/13.3 |
|
Started backporting to |
|
/backport to release/13.3 |
|
Started backporting to |
|
🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25191477748 |
|
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.
|
…microsoft#16612) * Fallback to junctions if either creating OR evaluating symlinks fails * Update src/Aspire.Cli/Utils/ReparsePoint.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update outdated test verified results * Regenerate the verified file --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
<remarks />and<code />elements on your triple slash comments?aspire.devissue: