Repository navigation
Make the macOS bootstrap tests pass on a SIP-enabled Mac without npm (tests only; supersedes #178) - #228
Merged
Conversation
LlamaWrapperQuotingTests failed on a SIP-enabled Mac (macOS 26.5.1) and passed on GitHub's hosted macos-15 runner. Its stand-in llama-server was a #!/bin/sh script: with System Integrity Protection enabled, macOS purges DYLD_* variables when it launches a SIP-protected binary such as /bin/sh, so the stand-in printed an empty DYLD_LIBRARY_PATH even though the wrapper had exported it. The product wrapper is not affected. It sets DYLD_LIBRARY_PATH after its own /bin/sh has started and execs the real llama-server, an unprotected, ad-hoc signed Mach-O, so the value arrives. On the same SIP-enabled Mac the pinned b11057 asset installed through install_llama_cpp into a shell-syntax path runs through the generated wrapper, and with its dylibs moved away the wrapper's DYLD_LIBRARY_PATH alone still loads them. The stand-in is now a script for the test's own Python, unprotected like the real binary. A control run first checks that this interpreter sees a DYLD_* value handed to it directly; if not, the test skips only the DYLD_LIBRARY_PATH assertion, after the data-safety assertions have run. The wrapper now receives DYLD_LIBRARY_PATH unset rather than empty: an inherited variable stays exported, so a missing export line had gone unnoticed on every non-SIP host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 3fd39cd)
test_places_the_verified_tarball_correctly_when_the_prefix_is_reached_through_a_symlink uses the npm-packed fixtures that PlatformDependencyInstallTests.setUpClass builds only when npm is on PATH: self.verified_tarball directly and self.verified_sha256 through _platform_dependency_pin. Unlike its npm-dependent siblings it had no @unittest.skipUnless(NPM, ...) since it was added in #94, so on a host without npm it errored with AttributeError instead of skipping. Hosted runners have npm, so CI never hit it. The class's other three undecorated tests use no npm fixtures and still run without npm. Re-hash tests/test_adoption_bootstrap_macos.py in manifests/evidence.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
# Conflicts: # manifests/evidence.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a developer Mac with System Integrity Protection (SIP) enabled and no
npmonPATH,tests/test_adoption_bootstrap_macos.pyhas one failure and one error on unmodifiedmain. Both are test-harness problems, so this PR changes tests only.adoption/bootstrap-macos.shis unchanged.Reproduced at
d478fd5on macOS 26.5.1 (25F80) arm64.csrutil statusreports enabled, andls -lO /bin/shshowsrestricted. The interpreter is uv-managed CPython 3.13.15. Temp paths are shortened to<tmp>:1. Llama wrapper quoting test under SIP (commit carried over from #178)
llama-serverwas a#!/bin/shscript. With SIP enabled, dyld purgesDYLD_*variables when it launches the protected/bin/sh, so the stand-in could not see the wrapper'sDYLD_LIBRARY_PATHexport. The realllama-serveris an unprotected Mach-O, so the generated wrapper is correct.3fd39cd, cherry-picked unchanged with-x. Neither the test file norbootstrap-macos.shhas changed onmainsince Make the llama wrapper quoting test pass on SIP-enabled Macs (wrapper unaffected) #178's base (4911baf), and the commit applied cleanly.sys.executablein the test's temp dir. The symlink keeps spaces out of the shebang. The script printssys.argv[0]andos.environ.get('DYLD_LIBRARY_PATH', '').PWNED/PWNED2assertions are unchanged. So are the exec-target ($0) check and the exact[target, prefix]assertion.DYLD_*value handed to it directly (for example the SIP-protected/usr/bin/python3), only theDYLD_LIBRARY_PATHassertion is skipped, and only after the other assertions have run.DYLD_LIBRARY_PATHunset instead of empty, so a missingexportline fails on every host.2. Missing npm skip
test_places_the_verified_tarball_correctly_when_the_prefix_is_reached_through_a_symlinkuses the npm-packed fixtures. It readsself.verified_tarballdirectly andself.verified_sha256through_platform_dependency_pin.setUpClassbuilds these only whennpmis onPATH.@unittest.skipUnless(NPM, "native npm unavailable"), but this test was added in macOS arm64 clean install: Homebrew prerequisites, darwin pins, launchd agents (brew-services semantics), embedding acceptance, recording-tooling CI #94 without it. The test passed on greenmainCI, so hosted runners have npm and it will keep running there.Checks on this Mac
tests.test_adoption_bootstrap_macosmain, npm absentnative npm unavailablePATH)The remaining skips are environment gaps: PyYAML not installed (14), shellcheck not installed (1), the non-macOS guard test (1), and the npm tests (22, only when npm is absent).
The branch was rebased onto
636751a(#224), which touches none of these files. After the rebase:python3 scripts/validate.py(system Python 3.9.6) passed with 69 components, 5338 hashed files, 4 profiles and 145 receipts.tests.test_adoption_bootstrap_macoswas re-run: OK, skipped=38.python3.13 -m unittest, npm absent, at this PR's head): ran 4714 tests with failures=1 and skipped=647.tests.test_new_host_grand_list.RecordHostToGrandListTests.test_recorded_host_gets_non_null_measured_in_the_grand_list. It fails the same way on unmodifiedmain(d478fd5, re-run in a clean checkout) on this host, so it is unrelated to this PR.hardware_profile.py --record-hostrefuse the test's fixture id (exit 2).d478fd5plus these two commits, gave the same single failure (4713 tests).manifests/evidence.jsonre-hashes onlytests/test_adoption_bootstrap_macos.py, throughhost_receipts.register_file.Relation to #178
This PR contains #178's commit plus the npm fix, re-hashed once. If this merges, #178 is redundant and can be closed. It has been left open for you to decide.
Evidence class: local integration on one SIP-enabled Mac. No product change, no receipt added, and no launchd, embedding or model run.
🤖 Generated with Claude Code