Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Let the uv-safe requirements test pass where 8.3 names exist (#11365)

Daniel Han06ca3c0b8a04
diff --git a/tests/studio/test_uv_safe_requirements_path.ps1 b/tests/studio/test_uv_safe_requirements_path.ps1
index 1e0afcda76c..986e49195ed 100644
--- a/tests/studio/test_uv_safe_requirements_path.ps1
+++ b/tests/studio/test_uv_safe_requirements_path.ps1
@@ -59,14 +59,49 @@ try {
"typer" | Set-Content -LiteralPath $spaced
$r2 = Get-UvSafeRequirementsPath -Path $spaced
Check "a spaced path never comes back containing a space" (-not $r2.Path.Contains(" "))
- Check "the relocated copy carries the same content" ((Get-Content -Raw -LiteralPath $r2.Path).Trim() -eq "typer")
+ Check "the space-free path carries the same content" ((Get-Content -Raw -LiteralPath $r2.Path).Trim() -eq "typer")
# 3. Only a copy may be deleted. Deleting what the helper reported must leave the user's file.
+ # There are TWO legitimate ways to get a space-free path, and which one happens is a
+ # property of the volume, not of the helper: where 8.3 creation is enabled the helper
+ # returns the ALIAS OF THE USER'S OWN FILE and reports Temporary = $false, because deleting
+ # it would delete the user's file; where 8.3 is unavailable it copies and reports
+ # Temporary = $true. Asserting only the copy made this test fail on any Windows runner with
+ # 8.3 enabled, which is a fact about that runner rather than a defect. The invariant that
+ # actually has to hold on both is: Temporary tells the caller whether the path is safe to
+ # delete, and the user's file survives either way.
+ #
+ # Identity, not spelling, on BOTH branches. An alias differs from the long name as a string
+ # while naming one file, so a string comparison cannot tell "a copy" from "the user's file
+ # under another name" -- and getting that backwards is precisely the mistake that deletes
+ # someone's requirements file.
+ function Test-SameUnderlyingFile([string]$a, [string]$b) {
+ try {
+ if ((Get-Item -LiteralPath $a -Force).FullName -eq (Get-Item -LiteralPath $b -Force).FullName) { return $true }
+ } catch { return $false }
+ # Different strings can still be one file. Write through one, read back through the other,
+ # and put the content back. Confined to this test's own fixture.
+ $probe = "typer-probe-" + [guid]::NewGuid().ToString("N")
+ try {
+ $original = Get-Content -Raw -LiteralPath $b
+ $probe | Set-Content -LiteralPath $b
+ $same = ((Get-Content -Raw -LiteralPath $a).Trim() -eq $probe)
+ $original.TrimEnd("`r", "`n") | Set-Content -LiteralPath $b
+ return $same
+ } catch { return $false }
+ }
+
if ($r2.Temporary) {
+ # Reported safe to delete, so it had better not be the user's file.
+ Check "a copy is not the user's own file" (-not (Test-SameUnderlyingFile $r2.Path $spaced))
Remove-Item -LiteralPath $r2.Path -Force
Check "deleting the copy leaves the original in place" (Test-Path -LiteralPath $spaced)
} else {
- Check "a relocated path is reported as temporary" $false
+ # Reported unsafe to delete, so it had better BE the user's file, reached by another name.
+ Check "a non-temporary path is the user's own file under another name" (
+ Test-SameUnderlyingFile $r2.Path $spaced)
+ Check "the user's file is still there and untouched" (
+ (Test-Path -LiteralPath $spaced) -and ((Get-Content -Raw -LiteralPath $spaced).Trim() -eq "typer"))
}
# 4. Every candidate unusable: the original comes back, and the user is told why. Without the