Skip to content

fix(xla): rename aux.rs so the repository checks out on Windows - #2533

Merged
inureyes merged 6 commits into
mainfrom
fix/issue-2531-rename-aux-module
Oct 22, 2026
Merged

inureyes merged 6 commits into
mainfrom
fix/issue-2531-rename-aux-module

Conversation

@inureyes

@inureyes inureyes commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

src/lib/mlxcel-xla/src/aux.rs used the Windows reserved device name AUX, so Git for Windows could not check the repository out. The file and module are renamed to auxiliary, and a new CI job rejects any tracked path that uses a Windows device name.

What changed

  • git mv of aux.rs to auxiliary.rs, mod auxiliary; in lib.rs, every crate::aux:: import rewritten (11 files, with rustfmt's resulting import reorder), and the include_str! path in src/loading/vlm_gemma_xla_tests.rs updated. The module is renamed, not aliased with #[path]. aux_*.rs siblings keep their names. TECHNICAL_REPORTS is untouched.
  • New scripts/ci/check_windows_reserved_paths.py: reads git ls-files -z (decoded as UTF-8) and fails, listing each path, when a component's stem (before the first dot, trailing spaces removed, case-insensitive) is CON, PRN, AUX, NUL, COM0-9, LPT0-9, or COM/LPT followed by a superscript 1, 2 or 3. Trailing spaces are stripped because Windows trims them, so aux .txt is the AUX device too.
  • New scripts/ci/check_windows_reserved_paths_test.sh: throwaway-repo cases that must fail (src/aux.rs, docs/Con.md, a/nul/b.txt, lpt1, plus multi-dot, superscript, and trailing-space names) and must pass (aux_manifest.rs, console.rs, nullable.rs, com10, data.aux, auxiliary.rs), and the real tree.
  • New windows-reserved-paths job in .github/workflows/ci.yml after binary-assets, outside the changes filter, with the same runner, contents: read, and persist-credentials: false checkout.
  • New make verify-windows-paths target next to verify-binary-assets, listed under Maintenance Targets in make help. The name avoids "reserved" because the help target's Run Targets filter matches the substring "serve".

Out of scope

Other names Windows cannot create (<>:"|?*, backslashes, control characters, components ending in a dot or space, case-only collisions) are not checked; the guard covers device names as the issue specifies.

Test plan

  • cargo check --all-targets (root crate)
  • cargo check -p mlxcel-xla --all-targets and cargo fmt -p mlxcel-xla -- --check
  • cargo test -p mlxcel-xla (363 passed)
  • python3 scripts/ci/check_windows_reserved_paths.py passes on this branch and names src/lib/mlxcel-xla/src/aux.rs on the tree of origin/main
  • bash scripts/ci/check_windows_reserved_paths_test.sh (16 cases plus the real tree)
  • git grep for remaining aux:: and aux.rs references outside TECHNICAL_REPORTS finds none
  • The xla-iree-gated test containing the include_str! could not be built locally (needs IREE_DIST); the target path was checked by hand, and the xla-compile CI job compiles it with cargo check --features cuda,xla-iree --all-targets
  • Manual: git clone on Windows completes and git status is clean

Closes #2531

`src/lib/mlxcel-xla/src/aux.rs` used the Windows reserved device name AUX, which is reserved with any extension and in any case. Git for Windows refuses to write such a path (core.protectNTFS defaults to true), so the repository could not be cloned or reset on Windows at all. macOS and Linux accept the name, so CI never caught it.

Rename the file to `auxiliary.rs` and the module to `auxiliary` (not a `#[path]` shim, so the Rust module name also avoids the reserved word). Every `crate::aux::` import is rewritten, and the `include_str!` path in `src/loading/vlm_gemma_xla_tests.rs` follows the file. The `aux_*.rs` siblings are not reserved names and keep theirs. TECHNICAL_REPORTS is left untouched.

Add `scripts/ci/check_windows_reserved_paths.py`, which fails on any tracked path component whose stem (the part before the first dot, case-insensitive) is CON, PRN, AUX, NUL, COM0-9, LPT0-9, or COM/LPT followed by a superscript 1, 2 or 3. Look-alikes such as `aux_manifest.rs`, `console.rs` and `nullable.rs` pass. `check_windows_reserved_paths_test.sh` builds throwaway repos for each case and checks the real tree. A `windows-reserved-paths` CI job runs both, outside the `changes` filter, next to `binary-assets`.

Verified with cargo check -p mlxcel-xla --all-targets, cargo test -p mlxcel-xla (363 passed), and both new scripts. The checker run against the tree of origin/main names `src/lib/mlxcel-xla/src/aux.rs`.

Closes #2531
@inureyes inureyes added type:bug Bug fixes, error corrections, or issue resolutions priority:high High priority platform:windows Windows (native) specific status:review Under review labels Oct 22, 2026
Add `make verify-windows-paths`, next to `verify-binary-assets` and listed under Maintenance Targets, so the guard runs locally the same way its sibling does. The name avoids the substring "serve", which the help target's Run Targets filter would otherwise match. Also replace an em dash in the checker's OK message with a colon.
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

Rename src/lib/mlxcel-xla/src/aux.rs (a Windows reserved device name) so the repository checks out on Windows, and add a CI guard that rejects reserved device-name paths.

Findings Addressed

No CRITICAL or HIGH findings, so no fixes were committed.

Remaining Items

  • The checker's failure message and the windows-reserved-paths job comment list COM0-COM9 and LPT0-LPT9 but not the superscript variants (COM¹-COM³, LPT¹-LPT³) that the rule also rejects. (LOW) Wording only; the matching set itself includes them.
  • tracked_files decodes git ls-files -z output with the locale encoding (text=True, same as check_binary_assets.py). Passing encoding="utf-8" would make superscript paths independent of the runner locale. (LOW) Matches the existing sibling script, so left as is.

Verification

  • All stated requirements implemented
  • No placeholder/mock code remaining
  • Integrated into project code flow (CI job, make verify-windows-paths, listed in make help under Maintenance Targets)
  • Project conventions followed
  • Existing modules reused where applicable
  • No unintended structural changes
  • Tests pass (cargo check -p mlxcel-xla --all-targets, cargo test -p mlxcel-xla: 363 passed, both scripts under scripts/ci)

Checked directly: git grep -nE '\baux::|\baux\.rs' -- ':!TECHNICAL_REPORTS' and git ls-tree -r --name-only HEAD | grep -iE '(^|/)aux(\.[^/]*)?$' print nothing; the checker run against the main tree exits 1 and names src/lib/mlxcel-xla/src/aux.rs; the self-test cleans up its temp directory via trap; the new job has the same shape as binary-assets; no em dashes in the diff or commit messages.

The checker's failure text and the CI job comment listed COM0-9 and LPT0-9 but not the COM/LPT plus superscript 1, 2, 3 names the rule also rejects. Decode `git ls-files -z` output as UTF-8 explicitly so matching those names does not depend on the runner's locale.
@inureyes

Copy link
Copy Markdown
Member Author

Security and performance review

No CRITICAL or HIGH findings, so no commits were added. python3 scripts/ci/check_windows_reserved_paths.py, bash scripts/ci/check_windows_reserved_paths_test.sh and make verify-windows-paths all pass locally (15/15 cases).

Checked and fine:

  • Workflow job: job-level permissions: contents: read (the workflow default is also read-only), persist-credentials: false, no secrets, no ${{ }} expressions in run: lines, so nothing attacker-controlled reaches a shell. It matches the existing binary-assets job exactly, including the actions/checkout@v7 tag style used across the file.
  • Checker: subprocess.run takes an argument list (no shell), git ls-files -z avoids quoting and newline problems, check=True makes a git failure fail the job, and a non-UTF-8 path raises instead of being skipped. Fail-closed throughout. Runtime is linear in the number of tracked paths.
  • Test script: set -euo pipefail, every expansion is quoted, the temp dir comes from mktemp -d and is removed by an EXIT trap, case names are fixed literals, and each throwaway repo resolves the checker's root through __file__, so it never reads the real repository by accident.

Not covered by the rule (LOW, not blocking; the guard's stated scope is device names and none of these exist in the tree today):

  • A stem with trailing spaces before the extension, such as aux .txt: Win32 path normalization trims the spaces and resolves it to the AUX device, but component.split(".", 1)[0] yields "aux " and passes. Stripping trailing spaces from the stem (.rstrip(" ")) would close this.
  • Other names Windows cannot create are out of scope and pass: <>:"|?*, a backslash inside a name, control characters, components ending in a dot or space, and paths that differ only by case. If one of those becomes a concern, the same script is the natural place to add it.
  • COM0 and LPT0 are matched although current Windows versions do not treat them as devices. This only produces false positives, which is the safe direction, and the docstring documents it.

Windows trims trailing spaces from a name's stem, so `aux .txt` opens the AUX device just as `aux.txt` does. Strip them before comparing, and add a `docs/aux .txt` case to the self-test.
Renaming the aux module to auxiliary changed the alphabetical position of `crate::auxiliary` relative to `crate::aux_manifest` and `aux_smoke`, so `cargo fmt -p mlxcel-xla -- --check` failed. This reorders the affected `use` lines and the `mod` declarations in lib.rs. No behavior change.

Validation:
- cargo fmt -p mlxcel-xla -- --check: clean
- bash scripts/ci/check_windows_reserved_paths_test.sh: all cases passed

Refs #2531
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 22, 2026
@inureyes
inureyes merged commit f47e061 into main Oct 22, 2026
55 of 57 checks passed
@inureyes
inureyes deleted the fix/issue-2531-rename-aux-module branch October 22, 2026 09:52
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform:windows Windows (native) specific priority:high High priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(xla): rename aux.rs so the repository checks out on Windows

1 participant