Skip to content

CI: extract Get-HostMachineArch for the VC++ round-trip test - #7597

Merged
danielhanchen merged 1 commit into
mainfrom
fix/vcredist-test-harness-arch
Jul 29, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/vcredist-test-harness-arch

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Test-VCRedistInstalled gained a Get-HostMachineArch call in #7549 so it stops
trusting the System32 vcruntime140_1.dll on ARM64. The VC++ runtime detect + install round-trip job in studio-windows-inference-smoke.yml dot-sources a
fixed list of functions out of studio/setup.ps1, and that list was not updated,
so the helper is undefined in the harness scope.

Part A does not notice: on a stock runner the registry hit returns before the
call. Only part B, which removes both signals to prove detection fires on a clean
box, reaches it, and the job fails there with Get-HostMachineArch is not recognized. Currently red on main and on every PR.

Both functions exist in setup.ps1 (:874 and :897), so this is a harness gap
rather than a product defect.

Reproduced and verified locally by dot-sourcing each list and calling the guard:

pre-fix list:  The term 'Get-HostMachineArch' is not recognized...
post-fix list: all 9 extracted OK
               Get-HostMachineArch -> other
               Test-VCRedistInstalled -> False

#7549 taught Test-VCRedistInstalled to consult the host architecture before
trusting the System32 DLL, but the round-trip job dot-sources a fixed list of
functions out of setup.ps1 and that list did not gain the helper. Part A returns
early on the registry hit, so only the clean-box half reaches the call and the
job fails there with "Get-HostMachineArch is not recognized".

Reproduced by dot-sourcing the old list and calling Test-VCRedistInstalled, which
throws; with the helper added the same call returns.
@danielhanchen
danielhanchen merged commit c70c1d2 into main Jul 29, 2026
14 of 16 checks passed
@danielhanchen
danielhanchen deleted the fix/vcredist-test-harness-arch branch July 29, 2026 07:52
danielhanchen added a commit that referenced this pull request Jul 29, 2026
…#7188)

* feat(studio): GGUF host-residency memory mode + Vulkan gpu_ids pinning

Narrowed to complement #6414 (merged), which already provides the GGUF GPU
device picker, gpu_memory_mode (auto/manual), gpu_layers, n_cpu_moe, and
tensor_split. This adds only what #6414 lacks:

1. Host-residency `gguf_memory_mode` (auto/pinned/resident) mapping to
   llama.cpp --mlock / --no-mmap. Distinct from #6414's gpu_memory_mode (that
   controls VRAM/layer offload; this controls host-RAM residency). Default auto
   is a no-op: an omitted value launches identical argv/env to main. First-class
   field shadows and scrubs inherited --mmap/--no-mmap/--mlock and
   LLAMA_ARG_MLOCK/NO_MMAP/MMAP so a stale value can't leak. Backend/API-driven
   (mirrored from /status), no new UI control.

2. Vulkan-ordinal gpu_ids hardening. #6414 rejects gpu_ids on a Vulkan build
   with HTTP 400; this replaces that with real pinning: gpu_ids are treated as
   ggml Vulkan ordinals (matched against the probe directly, never remapped
   through CUDA_VISIBLE_DEVICES), pinned via --device Vulkan<i>, with conflicting
   user --device / inherited LLAMA_ARG_DEVICE stripped under a pin, and the
   training coexistence guard budgeting conservatively against the least-free
   card (ordinals can't map to physical free-VRAM).

Backend: gguf_memory_mode field + validator (LoadRequest / ValidateModelRequest,
echoed on responses); _memory_mode_flags / _canonical_memory_mode; strip_memory_mode
+ strip_device in llama_server_args; is_vulkan_build / assert_requested_gpu_ids_resolvable;
memory-mode reload-dedup in _already_in_target_state and the route matcher
(device-stripped under a pin, mirroring the launch); gpu_ids_are_vulkan_ordinals
budgeting in training_vram. Frontend: a read-only activeMemoryMode mirror wired
into the existing reload flow (no dropdown). #6414's gpu_ids picker is untouched.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Preserve inherited memory flags and reject GPU pins on CPU-only llama.cpp builds

- strip_shadowing_flags: default strip_memory_mode to False (opt-in, matching
  strip_offload / strip_tensor_split / strip_device). The inherit resolver now
  strips an inherited --mlock/--mmap/--no-mmap only when the request supplies
  gguf_memory_mode, so a same-model Apply that omits the field keeps a user's
  pass-through memory flag instead of silently dropping it.
- /load and /validate: on the CUDA path, reject explicit gpu_ids when the
  llama.cpp build ships no cuda/hip/vulkan ggml lib (CPU-only). Such a build
  ignores CUDA_VISIBLE_DEVICES, so the pin would run on CPU while the API
  reports it active. Mirrors the non-CUDA resolvable check.
- Document that gpu_ids are ggml Vulkan ordinals on a Vulkan build (enumerated
  independently of CUDA_VISIBLE_DEVICES), not CUDA physical indices.
- Add regression tests: CPU-only route reject, inherit preserve/strip of memory
  flags, and the flipped strip_memory_mode default.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Detect versioned Vulkan libs and sync memory mode across all load paths

- _is_vulkan_backend now matches versioned Vulkan sonames (libggml-vulkan.so.0)
  via a shared _lib_dir_has_ggml_backend matcher, unified with
  _backend_lacks_gpu_lib so Vulkan detection and the CPU-only-build check agree.
  A distro/split-lib Vulkan install without the dev-only unversioned symlink is
  now detected as Vulkan and gets the --device Vulkan<i> pin instead of being
  misread as CUDA. This also keeps the Chat Settings picker reliably disabled on
  Vulkan builds (main.py gates gguf_gpu_ids_supported on this detection), so the
  UI never emits physical indices into the Vulkan-ordinal route.
- Frontend: fold activeMemoryMode into loadedGpuMemoryFields so every successful
  load path (primary, rollback, compare-load, GGUF/non-GGUF/MTP auto-load) resets
  it from the LoadResponse, not just the primary path. Prevents a stale pinned
  mode from an earlier model being re-sent by an immediate same-model Apply.
- Add test_is_vulkan_backend_matches_versioned_soname.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Pin get_device in gpu_ids GGUF route test for GPU-less CI

test_inference_route_validates_gpu_ids_for_gguf patches resolve_requested_gpu_ids
to exercise the CUDA physical-ID resolver, but did not pin the device. On a GPU-less
CI runner get_device() returns non-CUDA, so the route took the non-CUDA/Vulkan
deferral branch whose 'no GPU backend detected' 400 contains the substring 'not
supported', tripping the test's assertNotIn. Pin get_device to CUDA so the test
deterministically covers the path it intends.

* fix(tests): simplify ordering assertions and tighten GPU validation error message

* fix(studio): add GGUF variant check before reusing draft extras; apply aggregate headroom to Vulkan multi-GPU pins

- inference.py /load path: check extra_args_source and gguf_variant before
  reusing a loaded server's extra_args for draft-device validation, so a
  different quant of the same repo no longer inherits stale --spec-draft-device.

- inference.py /validate path: same variant-aware check before inspecting
  stored backend extras for draft-device rejection.

- training_vram.py: Vulkan multi-GPU pin now also enforces the aggregate
  _MULTI_GPU_OVERHEAD (0.85) check instead of returning early on per-GPU
  min_free alone, preventing a chat load from starting with too little
  protected headroom and OOMing an active training run.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(studio): harden Vulkan probe/budget and diffusion classification for GGUF placement

- Use the versioned-soname matcher in the Vulkan free-memory probe too, matching
  _is_vulkan_backend: a split-library install that ships only libggml-vulkan.so.0
  is now sized correctly instead of returning no devices and rejecting gpu_ids.
- Budget the Vulkan multi-GPU aggregate over the least-free N pinned cards, not all
  visible GPUs: with the ordinal to physical mapping unknown, summing every visible
  card could approve a pin that no N-card placement can actually hold.
- Classify a GGUF from its local header before the name heuristic: a normal
  llama-server GGUF whose path or repo merely contains "diffusion" is no longer
  rejected for gguf_memory_mode, since the loader routes on the decoded header.
- Compute the Vulkan-ordinal flag before diffusion_gpu and gate diffusion_gpu off
  when it fires, so an unclassified GGUF pinned on a Vulkan build is budgeted as
  ordinals instead of the single-device CUDA path sizing the wrong physical card.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(studio): gate XPU gpu_ids rejection to non-Vulkan; skip GGUF memory-mode reject for non-GGUF

- /load and /validate paths now detect the Vulkan build before the XPU
  rejection so Vulkan-backed Intel GPUs can use gpu_ids via --device
  Vulkan<i> ordinals instead of being blocked by the torch-xpu device check.

- _reject_diffusion_memory_mode now returns early for non-GGUF configs so
  a stale or shared payload with gguf_memory_mode cannot block unrelated
  non-GGUF loads.

* fix(studio): skip llama.cpp GPU-lib check for diffusion; resolve versioned Vulkan libs in probe

- /load and /validate paths now skip _backend_lacks_gpu_lib for confirmed
  DiffusionGemma GGUFs, since the diffusion runner bypasses llama-server and
  handles gpu_ids via --gpu/DG_GPU independently of the llama.cpp build.

- _vulkan_probe.py now resolves versioned sonames (libggml-vulkan.so.0 etc.)
  via a directory scan so split-lib installs that lack the unversioned symlink
  are no longer rejected with no visible devices.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test(studio): cover diffusion gpu_ids skip + versioned Vulkan soname; mirror is_vulkan_build on draft-device stubs

- Add is_vulkan_build to three draft-device test stubs so they mirror the real
  backend: the gpu_ids validation now reads it before the draft-device reject.
- test_cpu_only_llama_build_skips_reject_for_diffusion_gguf: a diffusion GGUF is
  served by the visual-server runner, so a CPU-only llama.cpp build does not
  reject its gpu_ids (the flow reaches the id resolver past the skipped reject).
- test_versioned_only_vulkan_soname_is_probed: a split-library install shipping
  only libggml-vulkan.so.0 is still classified Vulkan and probed, not rejected.

* fix(studio): route confirmed diffusion gpu_ids through the CUDA path on a Vulkan build

A confirmed diffusion GGUF is served by the visual-server runner, which takes a
CUDA physical id via --gpu/DG_GPU (it remasks CUDA_VISIBLE_DEVICES), never a
Vulkan ordinal. The gpu_ids preflight previously sent it to the Vulkan-ordinal
branch whenever the installed llama-server was a Vulkan build, so a valid
physical pick could be rejected (no matching Vulkan ordinal) or an ordinal
validated that the runner then applies to the wrong CUDA GPU. Route a confirmed
diffusion GGUF through the CUDA resolver at both /load and /validate even on a
Vulkan build, matching the training guard's existing diffusion_gpu handling.

* Keep llama.cpp fit headroom

* Adapt host memory modes to llama.cpp load mode

* feat(studio): expose GGUF host memory controls

* Clarify GGUF host memory semantics

* Expose Vulkan ordinals in the GGUF GPU picker

* Show Vulkan hardware names in the GPU picker

* Clarify the llama.cpp Vulkan backend selector

* Keep explicit Vulkan choices authoritative

* Preserve requested and effective GGUF GPU pins

* Align GGUF dedupe fixture with requested GPU pins

* Restore Vulkan diffusion pin guard

* Close GPU backend integration gaps

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Simplify GGUF placement state and validation

* Trim GGUF placement comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Address GGUF placement review findings

* Address GGUF placement review follow-ups

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Reject invalid remote diffusion placement before teardown

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct Vulkan GGUF placement boundaries

* Simplify Vulkan metadata handling

* Preserve deferred GPU index namespaces

* Preserve deferred GPU and memory settings

* Preserve host memory in compare loads

* Handle DiffusionGemma memory settings

* Use semantic preset summary font size

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Enforce host memory environment overrides

* Keep host memory default implicit

* Clarify host memory settings

* Clarify host memory choices

* Clarify Host RAM choices

* Explain Host RAM behavior

* Limit Host RAM wording change

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Guard GPU selections by backend namespace

* Correct Host RAM placement semantics

* Restore the GGUF fit target

* Remove GGUF Host RAM controls

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct GPU placement comments

* Fix DiffusionGemma GPU selection capabilities

* Make GPU selections own main device placement

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trim GGUF placement regression coverage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove orphaned memory policy and close Vulkan gaps

* Correct draft-device recovery guidance

* Fix Vulkan source and training device handling

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Align automatic Vulkan device pools

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fail closed on explicit Vulkan no-space, refresh the GPU picker on probe recovery

setup.sh and setup.ps1 both dispatch the prebuilt installer's exit status
before checking whether Vulkan was explicitly requested, so status 4 (no disk
space) took the no-space branch and never reached the strict-backend check in
the else. With an older CUDA, ROCm or CPU llama-server already installed,
_has_local_llama_server kept _LLAMA_CPP_DEGRADED false, so setup exited 0 and
Studio carried on using the backend the user asked to replace. Driving the
real dispatch block with a stubbed installer shows the same explicit request
exiting 1 on a generic failure and 0 on a no-space failure. Apply the same
check to the no-space path in both scripts.

useGpuDevices fetched /api/system once from an effect with no dependencies and
subscribed to nothing. When the Vulkan probe is unavailable, main.py answers
gguf_devices as an empty list rather than omitting it, so the "?? devices"
fallback does not apply and the picker starts hidden. useInferenceGpuInfo then
retries every 3 seconds and refreshes the shared cache, but nothing told the
mounted device hook, so the picker stayed hidden until it was remounted.
Notify subscribers when a refetch replaces the cache and have useGpuDevices
subscribe, comparing by value since each refresh builds a fresh array and an
unconditional set would re-render on every retry tick.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix Vulkan placement state and installation

* Use published Vulkan bundles

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Consolidate llama.cpp backend selector

* Specify UTF-8 for file operations

* fix(studio): harden GGUF GPU placement

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(studio): align backend selection contracts

* fix(studio): align MTP draft device placement

* fix(studio): address Codex P2s on legacy Vulkan env var and cold-cache GPU pins

- llama_backend_from_env() (and setup.sh/setup.ps1's shell-level mirror) falls
  back to the legacy UNSLOTH_LLAMA_BACKEND when UNSLOTH_LLAMA_CPP_BACKEND is
  unset, so an existing UNSLOTH_LLAMA_BACKEND=vulkan environment keeps forcing
  Vulkan across the setup.sh/setup.ps1 consolidation instead of silently
  reinstalling CUDA/ROCm/CPU.
- loadedGpuMemoryFields() no longer drops a just-applied gpu_ids pin to null
  when cachedPinnableGpuIndexKind() returns undefined (cache cold / Vulkan
  probe not ready yet). That state is deferred, not rejected: the pin is kept
  so a reload/rollback during that window still sends gpu_ids instead of
  letting llama.cpp fall back to every device.

The third P2 (force-compile skipping the Vulkan-source-build rejection) was
already fixed by an earlier commit on this branch -- verified
_NEED_LLAMA_SOURCE_BUILD is set before the guard runs in both setup.sh and
setup.ps1, and added a regression test locking in the ordering.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: fix Vulkan backend env fallback and GGUF preflight token

Three narrow correctness fixes on the Vulkan GPU selection path.

setup.sh / setup.ps1 consulted the legacy UNSLOTH_LLAMA_BACKEND only when
UNSLOTH_LLAMA_CPP_BACKEND was empty, while install_llama_prebuilt.py's
llama_backend_from_env() consults it whenever the new var is not an explicit
backend name. With UNSLOTH_LLAMA_CPP_BACKEND=auto beside a legacy
UNSLOTH_LLAMA_BACKEND=vulkan the shell dropped the request, leaving
_explicit_vulkan_backend and _explicit_vulkan_source_build false while the
installer it launches still planned Vulkan, so a Vulkan install that could not
be satisfied silently degraded to a CUDA/ROCm/CPU build instead of failing
closed. Mirror the Python rule in both scripts; an unrecognized value with no
legacy backend is still preserved so the warning can name it.

The new GGUF diffusion preflight in the chat load path sent the raw stored HF
token to /validate before validateModel/loadModel could run
prepareHfTokenForUse. The Hub rejects an invalid Authorization header with 401
even on a public repo, so a stale saved token aborted the whole load instead of
offering the existing continue-anonymously/replace-token recovery. Prepare the
token the same way the compare path already does.

The training guard handed can_load_chat_during_training an empty Vulkan
free-VRAM map for an unclassified GGUF on a Vulkan build. That reads as no free
VRAM anywhere, so every uncached remote GGUF was refused with 409 while
training ran. Only an explicit pin is unbudgetable (the ordinal belongs to one
namespace and neither can stand in for the other); automatic placement has no
ordinal to mis-map, so it keeps the torch view.

Each fix has a regression test that fails without it.

* Let the diffusion runner take physical ROCm indices

device_backend is a display label: _backend_label swaps CUDA for "rocm" when
IS_ROCM is set, but ROCm reuses torch.cuda.* and the DiffusionGemma runner
selects by the same physical index either way. Gating on "cuda" alone marked
every physical ROCm device unpinnable, so the picker vanished on multi-GPU
ROCm hosts and status hydration could discard a valid selection.

* fix(studio): keep unavailable Vulkan inventory out of CUDA fallback, prepare autoload HF token, restore legacy hip/rocm opt-out

Three P2s from the latest Codex review round on PR #7188:

- toGpuDevices(): a confirmed-Vulkan inference backend with a still-cold or
  transiently-empty device probe no longer falls through to the torch/CUDA
  inventory. That fallthrough was marking physical CUDA/ROCm devices
  diffusionPinnable, exposing a GPU picker for DiffusionGemma that sent IDs
  the backend rejects outright whenever is_vulkan_build is true. Now returns
  no devices until the Vulkan probe actually succeeds.

- loadAutoLoadCandidate(): the startup auto-load path's diffusion-classifying
  fetchGgufStagedMetadata probe (fired when a cached GGUF has saved gpu_ids)
  sent the raw stored HF token, bypassing prepareHfTokenForUse. Unlike
  validateModel/loadModel (which prepare internally), fetchGgufStagedMetadata
  does not, so an expired token could 401 even a public repo and abort the
  candidate before the anonymous/replace-token recovery flow got a chance to
  run. Now prepares the token first, mirroring performLoad's identical guard.

- _normalized_llama_backend(): dropped hip/rocm entirely during the backend-
  selector consolidation, despite force_vulkan_requested()'s own comment
  ("so =hip is a real opt-out a stale UNSLOTH_FORCE_VULKAN cannot overrule")
  and _route_to_vulkan_prebuilt()'s ("an explicit hip/cpu is the opt-out")
  describing behavior it no longer delivered. An existing
  UNSLOTH_LLAMA_BACKEND=hip/rocm environment on an unsupported HIP arch read
  as "no backend named" and silently routed to Vulkan (auto-fallback, or a
  stale UNSLOTH_FORCE_VULKAN=1). Restored hip/rocm recognition (canonicalized
  to "hip"), matching the pre-consolidation mapping.

Regression tests added for all three.

* Cover the auto-load HF token preflight behaviourally

The contract test added alongside the fix asserts on the source text. This
runs the real classification block out of chat-adapter.ts under node with a
stubbed Hub that 401s any non-null Authorization value, so it fails on the
token value that actually reaches /api/inference/validate rather than on a
symbol being present.

Reverting only the source (leaving the import in place) reddens it with the
simulated 401, not an ImportError.

* Converge Vulkan backend selection and review fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Stop the structlog stub shadowing the real package for PR #7188

The bare setdefault parked an empty placeholder before anything imported
the real structlog, so every later module calling structlog.get_logger at
import time raised AttributeError. It only bit when this file was collected
first, which is why the 8 hardware-dispatch cases passed alone and failed
under pytest tests/studio. Only stub when the package is genuinely absent.

* Prepare model settings GGUF token preflight

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Keep the established llama.cpp backend selector

* Preserve GPU namespace while Vulkan inventory recovers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix final PR 7188 review findings

* Normalize llama.cpp device flag aliases

* Converge PR 7188 review findings

* Honor backend opt-outs for Intel Vulkan routing

* Retry cold system discovery for GPU selection

* Probe structlog with find_spec instead of a bare import

The availability check imported the module purely for its side effect, so
the import-hoist verifier flagged it as an added-but-unused import and
failed Source lint. find_spec answers the same question without binding a
name.

* Brace the PowerShell variable in the setup.ps1 backend-choice probe

* Leave an existing structlog entry alone in the availability probe

find_spec raises ValueError on a module already in sys.modules whose
__spec__ is None, which is what a bare types.ModuleType stub is. Check
sys.modules first so anything already present, real or stubbed, is left
untouched and only a genuinely absent package gets stubbed.

* Consolidate duplicated Vulkan selector tests without changing behaviour

Three of the tests added for the llama.cpp backend selector asserted on the
same two helpers with the same inputs, and two more differed only in whether
the backend arrived from the environment or from --llama-backend. Fold them
into the parametrized cases that already covered those helpers:

- test_llama_cpp_backend_env_requests_vulkan,
  test_llama_cpp_backend_auto_does_not_trigger_vulkan and
  test_hip_backend_env_opts_out_of_vulkan become rows on
  test_force_vulkan_requested_accepts_public_selector_and_legacy_alias, which
  now also asserts llama_backend_from_env() alongside force_vulkan_requested().
  The unset case and the whitespace-padded HIP/ROCM values keep their coverage
  as new rows.
- test_explicit_non_vulkan_backend_suppresses_intel_auto_route and
  test_non_vulkan_backend_argument_suppresses_intel_auto_route become one test
  parametrized over the env and argument paths.
- test_unclassified_gguf_without_pin_keeps_the_torch_budget and
  test_unclassified_gguf_with_pin_refuses_to_budget shared the same four
  patches and differed only in the pin, so they become subtests of one case.

No source changes and no assertion is dropped. Each behaviour was re-checked by
reverting the source hunk it guards and confirming the surviving test fails on
a value.

* Keep the standing GPU mode on diffusion loads and the ARM64 Vulkan fallback for PR #7188

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Make the Intel auto-route guard test able to fail and stop the ps1 harness doubling --force-cpu

test_non_vulkan_backend_suppresses_intel_auto_route ran on Linux x86_64, where
dropping the explicit_backend guard changes only a log line, so the test passed
either way. Move it to Linux ARM64 + Intel GPU, the host where the guard decides
the routed repo, and assert that value.

_run_ps1 composed the --force-cpu snippet twice: it is already inside the
normalized block the helper extracts. The substring assertion hid the duplicate.
Compose it once and compare the whole argv. setup.ps1 appends the flag once and
is unchanged.

* Dot-source Get-HostMachineArch in the setup.ps1 Pester suite

#7549 taught Test-VCRedistInstalled to consult the host architecture before
trusting the System32 DLL. The Pester suite dot-sources a fixed list of
functions out of setup.ps1 one at a time, and that list did not gain the
helper, so the two clean-box cases (registry miss, and an old sub-14.20
redist) throw "Get-HostMachineArch is not recognized" instead of returning
false. The registry hit returns early, which is why the other cases pass.

#7597 made exactly this fix to the sibling list in the VC++ round-trip job
but left the Pester suite alone. Verified with pwsh 7.6 + Pester: 3 failed
before, 31 passed 0 failed after.

* Drop the branch's Pester Get-HostMachineArch fix now that #7606 landed

This branch carried a local fix for the same Pester dot-source gap that
#7606 has since merged to main (f21b280). Keeping both leaves the PR
diff with an unrelated, now-duplicated change, so drop the branch copy
and take main's.

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: oobabooga <[email protected]>
Co-authored-by: alkinun <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: Lee Jackson <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: danielhanchen <[email protected]>
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.

1 participant