Skip to content

[MAX] Fix macOS type checking for Linux-only OS calls - #7436

Open
vguerra wants to merge 1 commit into
modular:mainfrom
vguerra:codex/fix-macos-python-build
Open

vguerra wants to merge 1 commit into
modular:mainfrom
vguerra:codex/fix-macos-python-build

Conversation

@vguerra

@vguerra vguerra commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Add Linux platform guards to the checkpoint page-cache eviction and precompile worker CPU affinity helpers so macOS mypy checks do not resolve os.posix_fadvise, os.POSIX_FADV_DONTNEED, or os.sched_setaffinity. Linux behavior is unchanged.

Validation: both affected mypy checks and Ruff lint and formatting checks pass on macOS.

Assisted-by: AI

Type of change

  • [ X] Bug fix (non-breaking change that fixes an issue)
  • Performance improvement (includes benchmark results below)
  • Documentation update
  • New feature or public API (requires prior proposal or issue approval)
  • Refactor / internal cleanup (no user-visible change)
  • [ X] Build, CI, or tooling change

Motivation

  • macOS builds fail during mypy checks because two helpers reference Linux-only APIs: os.posix_fadvise, os.POSIX_FADV_DONTNEED, and os.sched_setaffinity.
  • These helpers need explicit platform guards so type checking succeeds on macOS.

What changed

  • Added an early return outside Linux in the checkpoint page-cache eviction helper.
  • Added the same guard to the precompilation worker’s CPU-affinity helper.
  • Updated the CPU-affinity docstring to state its Linux scope.
  • Linux behavior and function signatures remain unchanged.

Testing

  • The affected macOS mypy checks pass after reproducing the failures before the fixes.
  • Ruff lint and formatting checks pass for both modified files.
  • The full repository build completed successfully on macOS.
  • No new regression tests were added; validation used the existing type-checking and build targets.

Checklist

  • The linked issue above has been reviewed by a maintainer and is
    agreed-upon, or this is a trivial fix that does not need prior
    approval
  • [ X] PR is small and focused — I've split larger changes into a sequence of
    smaller PRs where possible (see
    pull request sizes)
  • I ran ./bazelw run format to format my changes
  • I added or updated tests to cover my changes
  • [ X] If AI tools assisted with this contribution, I have included an
    Assisted-by: trailer in my commit message or this PR description (see
    AI Tool Use Policy)

Add Linux platform guards to the checkpoint page-cache eviction and
precompile worker CPU affinity helpers so macOS mypy checks do not resolve
os.posix_fadvise, os.POSIX_FADV_DONTNEED, or os.sched_setaffinity. Linux
behavior is unchanged.

Validation: both affected mypy checks and Ruff lint and formatting checks
pass on macOS.

Assisted-by: AI
Signed-off-by: vm.guerramoran <[email protected]>
@vguerra
vguerra requested a review from a team as a code owner October 30, 2026 22:45
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vguerra

vguerra commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

modular-cla-bot Bot added a commit to modular/cla that referenced this pull request Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant