Skip to content
Source
Sign inSign up
pingdotgg/t3code

Repair missing Effect modules after desktop packaging #4160

Closedjuliusmarmingewants to merge 3 commits intomain fromt3code/fix-bundling-issue-4154opened View on GitHub

juliusmarmingecommented

May fix #4154, but couldnt reproduce reliably

Summary

  • Add an electron-builder afterPack hook for desktop artifacts.
  • Restore and verify the required Effect runtime modules in app.asar.unpacked.
  • Add focused tests covering module repair and build configuration wiring.

Testing

  • Added desktop-after-pack.test.ts coverage for replacing stale unpacked payloads.
  • Updated build-desktop-artifact.test.ts to verify the after-pack hook configuration.

Note

Low Risk Build-time packaging verification only; no runtime auth or data-path changes, though a stricter check could fail CI if unpack layout regresses.

Overview Adds an electron-builder afterPack hook so desktop packaging fails fast if required runtime files are missing from app.asar.unpacked/node_modules (e.g. effect, @effect/platform-node, mime, undici).

desktop-after-pack.ts exports verifyUnpackedRuntimeFiles and an afterPack entry that checks a fixed list of paths under the packaged app output. build-desktop-artifact.ts copies the hook into the stage workspace, passes its path into createBuildConfig via optional afterPackHookPath, and sets build.afterPack when provided. Tests cover the verifier and Windows build config wiring (DESKTOP_AFTER_PACK_HOOK_FILE).

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

Note

Add afterPack hook to verify required Effect modules are present after desktop packaging

  • Introduces desktop-after-pack.ts as an electron-builder afterPack hook that checks for required files in app.asar.unpacked/node_modules after packaging, throwing an error listing any missing files.
  • Updates buildDesktopArtifact in build-desktop-artifact.ts to stage the hook file into the app directory and pass its path to createBuildConfig, which now conditionally sets afterPack in the electron-builder config.
  • Risk: packaging will now fail if any required unpacked runtime files are absent, which is a new hard failure for previously silent omissions.
📊 Macroscope summarized 301d19d. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 078c4995-dd34-4a54-a884-05d27dba891b

      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 `t3code/fix-bundling-issue-4154`

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

    3. @@ -0,0 +44,21 @@
      44+ resolver: ReturnType<typeof NodeModule.createRequire>,
      45+ packageName: string,
      46+): Promise<string> {
      47+ return findPackageRoot(resolver.resolve(packageName), packageName);
      48+}
      49+
      50+export async function repairUnpackedEffectModules(input: {
      51+ readonly stageAppDir: string;
      52+ readonly appOutDir: string;
      53+}): Promise<void> {
      54+ const stageResolver = NodeModule.createRequire(NodePath.join(input.stageAppDir, "package.json"));
      55+ const platformNodeRoot = await resolvePackageRoot(stageResolver, "@effect/platform-node");
      56+ const platformNodeResolver = NodeModule.createRequire(
      57+ NodePath.join(platformNodeRoot, "package.json"),
      58+ );
      59+ const unpackedNodeModules = NodePath.join(
      60+ input.appOutDir,
      61+ "resources",
      62+ "app.asar.unpacked",
      63+ "node_modules",
      64+ );

      Wrong unpack path on macOS

      High Severity

      The repairUnpackedEffectModules function incorrectly assumes a fixed unpacked module path (appOutDir/resources/app.asar.unpacked). On macOS, the actual unpacked resources are located under Contents/Resources within the .app bundle. This mismatch causes the module repair to write to the wrong location, failing to update modules for macOS builds.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7c7f4b45b862dfbf8bb4b4ab32b1aba8952be08a. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      An unresolved high-severity comment identifies that the unpacked resource path logic may be incorrect for macOS builds, where the path structure differs from Windows/Linux. This potential bug in the new verification hook warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      Current main packages the server into server.asar and validates native sidecars. This branch expects Effect modules under the older app.asar.unpacked layout and can reject a valid current artifact.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.