Stage fff native binaries in desktop builds #3109
main fromrefs/pull/3109/head·merged by juliusmarminge View on GitHubOnly installing peerdeps wasn't enough, it fixed the crashloop but still didn't properly resolve the underlying binaries so search was not working.
Summary#
- Stage
@ff-labs/fff-nodeat the pinned0.9.4version and add a patch so the runtime resolves binaries fromapp.asar.unpackedwhen needed. - Update the desktop artifact builder to stage architecture-specific
fffbinary dependencies for the target platform and write a scopedpnpm-workspace.yamlfor the staging app. - Unpack
fffbinary assets in Electron packaging so the shared library remains accessible for filesystem and FFI access. - Add coverage for the new staging config, unpack rules, and native dependency resolution paths.
Testing#
scripts/build-desktop-artifact.test.tsupdated with assertions for staged workspace config,asarUnpack, and native binary dependency selection.- Not run:
vp check - Not run:
vp run typecheck - Not run: project lint scripts
Note
Medium Risk Changes desktop dependency staging and native binary resolution for workspace search FFI; wrong arch or unpack paths would break the desktop app at runtime.
Overview
Desktop builds now ship architecture-specific @ff-labs/fff-bin-* packages in the staged app, write a minimal pnpm-workspace.yaml with supportedArchitectures for that target, and set asarUnpack so those binaries live outside the ASAR archive for filesystem/FFI access.
@ff-labs/fff-node is pinned to 0.9.4 and patched so resolved native library paths under app.asar are redirected to app.asar.unpacked when the unpacked file exists. The patch is registered in the workspace lockfile; staged installs drop --no-optional so optional native bins can install.
pnpm-workspace.yaml changes are mostly reorder/formatting plus wiring the new patch entry.
Note
Stage fff native binaries in desktop builds by unpacking platform-specific ASAR dependencies#
- Adds
resolveFffNativeDependenciesin build-desktop-artifact.ts to select the correct@ff-labs/fff-bin-*packages for the target platform/arch (darwin, win32, linux with gnu/musl variants) and promotes them to direct staged dependencies. - Configures electron-builder to unpack
node_modules/@ff-labs/fff-bin-*/**/*from the ASAR via a newDESKTOP_ASAR_UNPACKconstant, so native binaries are accessible at runtime. - Adds a patch to
@ff-labs/fff-nodethat rewrites binary paths inside an Electron ASAR to the corresponding.asar.unpackedpath when it exists. - Writes a stage-local
pnpm-workspace.yamlwithsupportedArchitecturesto constrain dependency resolution to the target OS/CPU, and drops--no-optionalfrom the stage install args so optional native packages are included. - Pins
@ff-labs/fff-nodeto exact version0.9.4and registers the patch in pnpm-workspace.yaml.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
🚀 Expo continuous deployment is ready!
- Project → t3-code
- Platforms → android, ios
- Scheme → t3code-preview
🤖 Android 🍎 iOS Fingerprint f9033cdeb2089379d2da4fc425aba1c94bc5feb7 58a0e3786e25e8165e9c158dc7b1ba699ce30e0d Build Details Build Permalink Details
Distribution:INTERNAL
Build profile:preview:dev
Runtime version:f9033cdeb2089379d2da4fc425aba1c94bc5feb7
App version:0.1.0
Git commit:faf29de3ea86189290f8410d2bea65a7ee0dfba2Build Permalink Details
Distribution:INTERNAL
Build profile:preview:dev
Runtime version:58a0e3786e25e8165e9c158dc7b1ba699ce30e0d
App version:0.1.0
Git commit:faf29de3ea86189290f8410d2bea65a7ee0dfba2Update Details Update Permalink Details
Branch:pr-3109
Runtime version:f9033cdeb2089379d2da4fc425aba1c94bc5feb7
Git commit:faf29de3ea86189290f8410d2bea65a7ee0dfba2Update Permalink Details
Branch:pr-3109
Runtime version:58a0e3786e25e8165e9c158dc7b1ba699ce30e0d
Git commit:faf29de3ea86189290f8410d2bea65a7ee0dfba2Update QR Approvability#
Verdict: Needs human review
This PR introduces a patch to a third-party library that changes runtime binary resolution for Electron apps, and modifies the desktop build process including install arguments and dependency staging. These build infrastructure changes with runtime implications warrant human review.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).juliusmarminge merged this85fe62d
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
5339c034-af9d-4eea-9f7b-ed7eb0039d84You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.