Skip to content

tools/box.sh: check the cargo-oxide pin against the executable Cargo runs - #560

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:fix-box-oxide-pin
Oct 20, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:fix-box-oxide-pin

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

box.sh의 cargo-oxide 핀 대조가 PATH의 cargo-oxide와 다른 설치 루트를 읽어 컨테이너에서 멈추던 문제를 고칩니다.

What and why

tools/box.sh compares the installed cargo-oxide with the rev pinned in Cargo.toml and stops when they differ. It read the installed rev with cargo install --list, which lists only the first install root. A dev container that sets CARGO_INSTALL_ROOT to a root holding only just, while cargo-oxide sits in the default cargo root, therefore had no cargo-oxide line, and the check refused a correct install. No BLOOMERY_BOX_LOCAL=1 just gate-* recipe could run in that container.

The check now selects the cargo-oxide that Cargo would run: CARGO_HOME/bin (default $HOME/.cargo/bin) first, then PATH. It resolves symlinks, reads the install list with --root set to the root of the real executable, and compares that rev with the pin. The error names the root it read. A different rev still stops with the same error and exit code. The check also exits 70 when no cargo-oxide executable can be found or when cargo install --list itself fails, so a failed listing that still prints the pinned record no longer passes.

Release notes: internal. The check read the wrong install root in containers that set CARGO_INSTALL_ROOT.

Code shape

  • No second copy. The change edits the one pin check in tools/box.sh.
  • Model code holds only architecture facts. No model or common code is touched.
  • Dead code is gone. Nothing was made unused.
  • No silent failure. A missing or different rev still names itself and the root it read, and stops the run.
  • Comments state what is true now. The comment above the check states the selection order.
  • No relaxed gate. The pinned rev, the comparison and the exit code are unchanged.
  • cargo fmt and cargo clippy are not affected: only tools/box.sh changes, and no Rust file.

Duplication found or removed (path:line): none

What I ran

Two runs back the change. The GPU run used the earlier head 0015d9b4. The card stub tests ran on commit 1a1fe823, which has the same tree as the current head c72c295d.

On a DGX Spark (GB10), head 0015d9b4, inside the CUDA 13.3.1 dev container with CARGO_INSTALL_ROOT set to the root that holds only just, with BLOOMERY_BOX_LOCAL=1:

# Cargo.toml rev replaced by 1111111111111111111111111111111111111111
BLOOMERY_BOX_LOCAL=1 ./tools/box.sh "cargo oxide --version"
box.sh: the installed cargo-oxide is from rev 87bc9518, not the pin 1111111111111111111111111111111111111111: reinstall it ...
WRONGPIN_RC=70

# Cargo.toml restored
BLOOMERY_BOX_LOCAL=1 ./tools/box.sh "cargo oxide --version"
cargo-oxide 0.2.1
RIGHTPIN_RC=0

BLOOMERY_BOX_LOCAL=1 just gate-gpu-linear
gate_linear: 68 clauses, 0 failed
gpu-gate.sh: gate_linear ran 10 s (exit 0)
GATE_RC=0

The tree with the wrong rev still stops with rc 70 (WRONGPIN_RC=70). The correct pin passes with rc 0 (RIGHTPIN_RC=0), and just gate-gpu-linear ends with rc 0 (GATE_RC=0). I did not rerun the GPU gate on the current head.

On a CPU-only Linux host (no GPU card), commit 1a1fe823, bash tools/ref/card-tests/run.sh covers split install roots, Cargo home precedence, symlink resolution, rev-mismatch refusal, a missing executable and a failing install list, each with exit code 70 where refused:

ok box.sh: no cargo-oxide in Cargo home or on PATH is refused
ok box.sh: a failed install-list cannot verify the pin
card-tests: 863 tests, 0 failed

The two newest cases fail on the previous check. With the failing install list the command ran with exit 0 and no refusal:

FAIL box.sh: a failed install-list cannot verify the pin: rc 0, want 70

With no executable, the check read the wrong root and reported from rev none:

FAIL box.sh: no cargo-oxide in Cargo home or on PATH is refused: no line matches /cannot resolve cargo-oxide executable/

I did not run the tools/box.sh self-test.

Hardware (if the change is for a machine)

The GPU run used a DGX Spark (GB10) in the CUDA 13.3.1 dev container. The card stub tests need no GPU. The change only picks which install root tools/box.sh reads.

What I ran into

Nothing here blocks this PR. just gate-gpu-gemm passes the pin check and builds on this machine, then stops with io error: No such file or directory, because gate_gemm reads model files that are not on it. I ran just gate-gpu-linear instead, which needs none.

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 20, 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: No must-fix findings remain after validation.

Checked

Duplicates: no new named functions/types/constants; compared the root-aware fixture and existing cargo stubs. No duplicate owner found.
Complexity: no Rust functions changed; no crapper candidates.
Silent failure: executable lookup, symlink resolution and install-list failure paths at tools/box.sh:1172 stop with named errors and exit 70.
Tests: both changed scripts pass bash -n. Static mutation review confirms the split-root fixture rejects dropping --root, and the failed-list fixture rejects accepting pinned output from a failed command. Fixtures also cover selection precedence, symlinks, non-executable entries, missing executables and revision mismatch.
Gates: revision pin and refusal code remain unchanged; replaced fixtures have a dated reason.
Escape catalog: no C1–C4 defects matched in the changed code. Listing status is checked before parsing; the new heredoc is quoted.

Notes

Dryer and crapper did not run because no Rust file changed. The full card suite and box.sh self-test were not rerun during validation.

🔨 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 87044ec into midagedev:main Oct 20, 2026
6 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.

1 participant