Skip to content
Source
Sign inSign up
pingdotgg/t3code

Stage fff native binaries in desktop builds #3109

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/3109/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Closes #3104 Closes #3105

Only 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-node at the pinned 0.9.4 version and add a patch so the runtime resolves binaries from app.asar.unpacked when needed.
  • Update the desktop artifact builder to stage architecture-specific fff binary dependencies for the target platform and write a scoped pnpm-workspace.yaml for the staging app.
  • Unpack fff binary 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.ts updated 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.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ca018dfbb872c02d4fc01aa2a67b99e56f3dd429. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Stage fff native binaries in desktop builds by unpacking platform-specific ASAR dependencies

  • Adds resolveFffNativeDependencies in 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 new DESKTOP_ASAR_UNPACK constant, so native binaries are accessible at runtime.
  • Adds a patch to @ff-labs/fff-node that rewrites binary paths inside an Electron ASAR to the corresponding .asar.unpacked path when it exists.
  • Writes a stage-local pnpm-workspace.yaml with supportedArchitectures to constrain dependency resolution to the target OS/CPU, and drops --no-optional from the stage install args so optional native packages are included.
  • Pins @ff-labs/fff-node to exact version 0.9.4 and registers the patch in pnpm-workspace.yaml.
Macroscope summarized ca018df.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 5339c034-af9d-4eea-9f7b-ed7eb0039d84

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `feature/stage-fff-native-binaries`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. 🚀 Expo continuous deployment is ready!

      • Project → t3-code
      • Platforms → android, ios
      • Scheme → t3code-preview
       🤖 Android🍎 iOS
      Fingerprintf9033cdeb2089379d2da4fc425aba1c94bc5feb758a0e3786e25e8165e9c158dc7b1ba699ce30e0d
      Build DetailsBuild Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: f9033cdeb2089379d2da4fc425aba1c94bc5feb7
      App version: 0.1.0
      Git commit: faf29de3ea86189290f8410d2bea65a7ee0dfba2
      Build Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: 58a0e3786e25e8165e9c158dc7b1ba699ce30e0d
      App version: 0.1.0
      Git commit: faf29de3ea86189290f8410d2bea65a7ee0dfba2
      Update DetailsUpdate Permalink
      DetailsBranch: pr-3109
      Runtime version: f9033cdeb2089379d2da4fc425aba1c94bc5feb7
      Git commit: faf29de3ea86189290f8410d2bea65a7ee0dfba2
      Update Permalink
      DetailsBranch: pr-3109
      Runtime version: 58a0e3786e25e8165e9c158dc7b1ba699ce30e0d
      Git commit: faf29de3ea86189290f8410d2bea65a7ee0dfba2
      Update QR
    4. 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).
    5. juliusmarminge merged this85fe62d

    6. juliusmarminge closed this

Sign in to join this conversation.