Skip to content

mac-remote: fake_remote stubs uname with the Mac arch its toolchain is built for, so the self-test's lock cases pass on aarch64 Linux - #113

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-mac-remote-arch
Oct 13, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-mac-remote-arch

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

tools/mac-remote.sh --self-test fails on aarch64 Linux, so just check-recipes (and contrib-check --tier t1)
is red there. The lock cases run the preflight against a fake remote with a uname stub that answers Darwin for
-s and passes -m to the real uname. On aarch64 Linux that reads aarch64, and the preflight's host check takes
only Darwin arm64 and Darwin x86_64:

missing: a macOS host (this is Darwin aarch64)

fake_remote now writes the uname stub itself, and the stub answers -m too. It gives the Mac arch the fake
toolchain was built for (arm64 on an arm64 host, x86_64 otherwise), picked in the same case that names the
toolchain, so the two cannot disagree. The lock cases no longer write their own stub, and every case that uses
fake_remote gets the new one. The preflight and its host check are unchanged.

Closes #110.

Code shape

  • No second copy. The mapping stands in fake_remote and in the run script, which is separate code that runs on the remote Mac. This change removes one repeat, listed under Duplication below.
  • Model code holds only architecture facts. No model code touched.
  • Dead code is gone.
  • No silent failure.
  • Comments state what is true now.
  • No relaxed gate. The preflight still refuses any host that is not Darwin arm64 or Darwin x86_64.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. No Rust touched.

Duplication found or removed (path:line), or "none": the arm64-else-x86_64 mapping stood in three places of tools/mac-remote.sh once the first version of this fix was in: the run script (line 516), fake_remote (line 804) and a stub in the lock cases (line 891). The stub now comes from fake_remote, so the mapping stands in two places: fake_remote and the run script (line 516), which runs on the remote Mac and cannot share fake_remote's code.

What I ran

On aarch64 Linux (DGX Spark), bash tools/mac-remote.sh --self-test from the repository's tools/ directory in a fresh git repository, on d90151ed and then on e676ee26:

# d90151ed
mac-remote self-test FAIL: the preflight did not take a dead lock: HOME=<temp dir>/lockrem
missing: a macOS host (this is Darwin aarch64)
mac-remote self-test FAIL: the reclaim does not name the old owner and heartbeat: ...
mac-remote self-test FAIL: the reclaimed lock is not the new owner's
mac-remote self-test FAIL: a lock with a fresh heartbeat was taken (rc 69): ...
mac-remote: self-test 4 failed

# e676ee26
mac-remote: self-test ok (the flow against a fake remote needs macOS: skipped on Linux)

The next two blocks are from a24ab58c, the earlier version of this fix, and I did not rerun them on e676ee26. just check-recipes on the same machine, in a CUDA 13.3.1 container:

# d90151ed
check-recipes: the mac-remote self-test failed
error: recipe `check-recipes` failed on line 119 with exit code 1

# a24ab58c
mac-remote: self-test ok (the flow against a fake remote needs macOS: skipped on Linux)
check-recipes: 52 tool self-tests ok
check-recipes: ok
check-recipes-rc=0

The check-recipes: ok line and the exit code 0 are the evidence here, along with the mac-remote self-test. I did not run a full T1. The container image is not part of the repository and has no rsync. The lock cases need rsync on the test host (the preflight checks for it), and the T0 and T1 docs do not list it. I bind-mounted the host's rsync into the container. I also set RUSTUP_TOOLCHAIN=nightly-2026-08-28, as tools/contrib-check.sh does, since just check-recipes run on its own does not. Both runs had the same setup. I make no claim about an unmodified container.

On macOS (arm64), on e676ee26, bash tools/mac-remote.sh --self-test gives mac-remote: self-test ok, bash -n tools/mac-remote.sh is clean and tools/check-comments.sh is ok. The fake-remote flow runs there, so the new stub is exercised on macOS too: its -s and -m answers match what the real uname says on that Mac, and any other argument passes to the real uname. shellcheck reports the same warnings before and after.

just check-recipes on the Mac, run on a24ab58c and not rerun on e676ee26, is red, and so it is on d90151ed. I ran it once on each, with CARGO_BUILD_JOBS=4 taskpolicy -b and RUSTUP_TOOLCHAIN=nightly-2026-08-28, one at a time, each commit in its own worktree. Both runs print mac-remote: self-test ok and check-recipes: 52 tool self-tests ok, then end with rc 1 for the same reason:

FAIL chain: a lane item green on one key ends green: rc=124 gate-batch: stopped; ...
gate-batch self-test: part 6 ended without its count line
check-recipes: the gate-batch self-test failed

So this failure is not caused by the fix. bash tools/gate-batch.sh --self-test run alone passes on both commits (gate-batch self-test: 572 of 572 ok), and bash tools/ref/depth-serve.sh --self-test run alone passes on both (52 checks ok). Inside check-recipes, the gate-batch parts ran slower than alone (part 13 took 481 s on a24ab58c and 533 s on d90151ed, against 193 s alone). The case that failed ended with rc 124, a time bound; I did not isolate why it is hit only inside check-recipes. The depth-serve.sh self-test passed inside check-recipes in both of these runs. An earlier Mac run of the fix had also failed one depth-serve.sh check (0 servers started, 1 expected) that did not reproduce; I do not know why.

Hardware (if the change is for a machine)

Machine CPU, RAM, OS What I ran
DGX Spark 20 Arm cores, 128 GB unified, Ubuntu 24.04.5, kernel 6.17.0-1032-nvidia the self-test on the host, on d90151ed and on e676ee26; just check-recipes in a CUDA 13.3.1 container, on d90151ed and on a24ab58c
Mac Apple M4 Pro, macOS 27.0.1 the self-test and tools/check-comments.sh on e676ee26; just check-recipes, gate-batch.sh --self-test and depth-serve.sh --self-test, on d90151ed and on a24ab58c

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 13, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: the lock fixture duplicates an architecture decision that already belongs to fake_remote.

Must fix

1. Make the fixture own its stub architecture

tools/mac-remote.sh:891 repeats tools/mac-remote.sh:804: both select the fake Mac architecture from the local uname -m. This is a proven duplicate (kind B, R14). The toolchain and its stub now require separate edits to keep them consistent.
Close this in the existing fixture now, before another host mapping requires synchronized changes.

Replace fake_remote's local declaration and architecture case with:

  local rh=$1 ch=$2 h m t
  case $(uname -m) in
    arm64) h=aarch64-apple-darwin; m=arm64 ;;
    *) h=x86_64-apple-darwin; m=x86_64 ;;
  esac

Immediately after its mkdir -p, add:

  printf '#!/bin/sh\ncase $1 in -s) echo Darwin ;; -m) echo %s ;; *) /usr/bin/env -i PATH=/usr/bin:/bin uname "$@" ;; esac\n' "$m" > "$rh/opt/bloomery-bin/uname"
  chmod +x "$rh/opt/bloomery-bin/uname"

Replace the lock-case setup at lines 889–892 with:

    local lr=$d/lockrem lb
    fake_remote "$lr" nightly-x

Checked

Duplicates: 0 new functions, types or constants; the new mapping duplicates the fixture owner.
Complexity: no Rust functions changed; one case added to the shell fixture setup.
Silent failure: the wildcard mirrors the synthetic fixture architecture; no error result is discarded.
Tests: shell syntax, the proposed replacement's syntax, and in-memory arm64/aarch64/x86_64 mappings pass. Mutation: drop the stub's -m arm at line 892; PREP returns 69 on aarch64 Linux, rejected at lines 900 and 904 (static trace).
Gates: no thresholds or host rejection rules changed; the PR includes FAIL-first output.
Escape catalog: C1–C4 do not match the changed code.

Notes

Full self-test not run. This diff has no Rust code for dryer or crapper.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

…s built for, so the self-test's lock cases pass on aarch64 Linux
@juliankang4
juliankang4 force-pushed the dgx-spark-mac-remote-arch branch from a24ab58 to e676ee2 Compare October 13, 2026 13:38
@juliankang4 juliankang4 changed the title mac-remote: the self-test's lock cases stub uname -m with the Mac arch, so they pass on aarch64 Linux mac-remote: fake_remote stubs uname with the Mac arch its toolchain is built for, so the self-test's lock cases pass on aarch64 Linux Oct 13, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: The fixture reports the Mac architecture selected for its fake toolchain, and the real remote host check remains intact.

Checked

  • Duplicates: no new functions, types or constants; one owner for the fake remote's uname stub serves both callers.
  • Complexity: no Rust functions changed; the fixture adds one uname match arm.
  • Silent failure: 0 new silent-failure sites; delegated uname calls preserve the command's exit status.
  • Tests: shell syntax and in-memory checks of the mapping, generated stub and host guard passed for arm64, aarch64 and x86_64 inputs. Restoring -m passthrough at tools/mac-remote.sh:811 makes the guard reject Darwin aarch64 with rc 69; the existing lock assertions at lines 904 and 908 reject that result.
  • Gates: no thresholds, assertions or host-check clauses removed or relaxed; the PR includes failing and passing self-test output.
  • Escape catalog: C1–C4 do not match the changed lines. The fallback's isolated PATH prevents recursive invocation of the stub.
  • Performance: tools only; no inference hot path changed. Both fake_remote callers were checked.

Notes

The full self-test was not rerun; selected shell fragments were checked in memory.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit bd29e9c into midagedev:main Oct 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mac-remote: lock self-test fails on aarch64 Linux

1 participant