fix(desktop): rewrite the tokenizers prebuild's install name before signing - #153
Conversation
…igning
The v0.0.14 desktop release failed the bundle gate at step [3/5]:
FAIL leaks a build path: Contents/Resources/app/node_modules/tokenizers/tokenizers.darwin-arm64.node
/Users/runner/work/tokenizers/tokenizers/bindings/node/target/aarch64-apple-darwin/release/deps/libnode.dylib
`tokenizers` arrived with the delegate token counter (#150), and that path is
its upstream `LC_ID_DYLIB` — the same defect `mlx-core` and `@napi-rs/keyring`
ship with, and `package.ts` already rewrites both of those. This adds the third
fixup, on the staged copy and before packager/codesign, beside the keyring one.
`stage-app.ts` already ships exactly one slice of the package
(`tokenizers.darwin-arm64.node`), so one rewrite covers the bundle.
Measured on the real artifact: before the rewrite, the gate's own
`buildPathLeaks(parseLoadCommandPaths(otool -l …))` reports that path; after it,
nothing — and `process.dlopen` still loads the rewritten addon.
Verified: `yarn typecheck` clean; `verify-bundle.test.ts` + `stage-app.test.ts`
64/64.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a971f2e9-4f4f-44b0-b358-fb6a07b0f042) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What failed
The v0.0.14 desktop release (run 34937845040) failed in
Sign, notarize, publish→Verify bundle (pre-notarization):Why, and why it is our fixup to make
That path is the binary's
LC_ID_DYLIB— its own install name, written by the publisher's CI:tokenizersarrived with the delegate token counter (#150) and is loaded lazily bypackages/dashboard/src/ingest/tokenizer.ts. This is the same defectmlx-coreand@napi-rs/keyringship with, andpackage.tsalready rewrites both withinstall_name_tool -id @rpath/<file>on the staged copy, before packager/codesign. Rewriting the install name is therefore the established remedy here — not excluding the package (the token counter is a live feature) and not carving it out of the gate (the gate is what caught this).stage-app.tsalready ships exactly one slice of the package — its copy filter keeps onlytokenizers.darwin-arm64.node— so a single rewrite covers the bundle.The change (one file)
Verification
["/Users/runner/work/tokenizers/tokenizers/bindings/node/target/aarch64-apple-darwin/release/deps/libnode.dylib"][]process.dlopenof the rewritten copyyarn typecheckverify-bundle.test.ts+stage-app.test.tsI discarded an earlier attempt that carved third-party prebuilds out of step [3/5]; the real defect turned out to be fixable in the bundle, which keeps the gate absolute.
Re-releasing needs your call
The workflow checks out
inputs.dry_run ? github.ref : refs/tags/<release_tag>, so:dry_run: trueonmain(or this branch): it builds and signs, and step [3/5] should pass.v0.0.14's tree does not contain this fix. Either move the tag onto the fixed commit, or cut0.0.15frommain.My recommendation is
0.0.15: the number0.0.14already exists (npm may hold it), and re-pointing a tag after a publish makes one version mean two different trees.Note
Low Risk
Packaging-only Mach-O install-name rewrite on the staged app tree; mirrors existing mlx-core/keyring fixups with no auth or data-path changes.
Overview
Fixes desktop release verify-bundle step [3/5] failing on
tokenizers.darwin-arm64.node, which ships with the publisher’s CI path inLC_ID_DYLIB(same issue already handled for mlx-core and keyring).package.tsnow runsinstall_name_tool -id @rpath/tokenizers.darwin-arm64.nodeon the staged copy undernode_modules/tokenizersbefore packager/codesign, so the delegate token counter’s lazytokenizersimport can stay in the bundle without weakening the gate.Reviewed by Cursor Bugbot for commit 6b24c95. Bugbot is set up for automated code reviews on this repo. Configure here.