Skip to content

test(shell): stop a slow first otool on a fresh macOS runner from failing the sherpa bundle check - #496

Merged
GeiserX merged 2 commits into
mainfrom
fix/sherpaotool-flake
Oct 31, 2026
Merged

GeiserX merged 2 commits into
mainfrom
fix/sherpaotool-flake

Conversation

@GeiserX

@GeiserX GeiserX commented Oct 31, 2026

Copy link
Copy Markdown
Owner

The sherpa-onnx bundle check failed check (macos-latest) on PR #494 with Expected to contain "@rpath/libsherpa-onnx-c-api.dylib", Received "". The addon was fine. The test asked otool -L for the libraries it links, and otool never answered in time.

/usr/bin/otool is an xcrun shim. On a fresh runner its first lookup is always cold. On a quiet Mac it costs 0.4 s after xcrun --kill-cache and 0.00 s warm. On CI it is much slower: the test took 0.44 to 2.8 s (median 1.3 s) across 54 macOS check jobs, and once 5.02 s. That once, Bun hit the 5 s test timeout, killed the child (the log says killed 1 dangling process five seconds into the test) and the check read empty stdout. So a slow tool showed up as "the addon links neither library".

The fix reads the libraries straight from the addon's Mach-O load commands in the test process (tests/macho-helpers.ts, about 40 lines). No subprocess, no xcrun. On the real addon it returns the same four names otool -L prints after the file's own id. A file that is not a thin Mach-O throws, so a bad read can't pass as "links nothing". On darwin-arm64 a missing addon now fails the check instead of skipping it.

Before and after, on 20 fresh macos-latest runners (a temporary probe workflow, deleted in the second commit):

  • before, the otool check from main: 0.79 to 2.90 s per run
  • after, the in-process read: 0.8 to 12.7 ms per run

The CI history has 1 failure in 54 jobs, and nothing in it beat the 5 s timeout except the one failure.

Regression test: [spike] Native libraries missing from the bundle: the linked names come from the file's load commands, with no otool to outlive the test. Positive controls: an addon missing one library is caught, and a shell script throws. I also checked two mutations on a Mac. Dropping LC_LOAD_DYLIB from the parser turns both sherpa tests red. Naming an extra library in SHERPA_LIBS turns the bundle test red.

The TRAPS entry sits at the end of Packaging.

…first otool cannot fail the check

On a fresh macOS runner the first otool call goes through a cold xcrun
lookup (0.8 to 2.9 s on 20 fresh runners, once over 5 s in CI), and at
the 5 s test timeout Bun killed it and the check read empty output.
The load commands are now parsed from the Mach-O file; a file that is not
one throws. Removes the temporary probe workflow.
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 81ee47a and ed9b5c5.

Files selected for processing: 3
  • docs/TRAPS.md
  • tests/macho-helpers.ts
  • tests/shell.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@GeiserX

GeiserX commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 27 minutes.

@GeiserX
GeiserX merged commit c135bfa into main Oct 31, 2026
29 checks passed
@GeiserX
GeiserX deleted the fix/sherpaotool-flake branch October 31, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant