Skip to content

Stage macOS updates with Electron's unpatched filesystem - #200

Merged
BunsDev merged 1 commit into
mainfrom
fix-update-asar
Oct 13, 2026
Merged

BunsDev merged 1 commit into
mainfrom
fix-update-asar

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

The first signed v0.0.12 release run (38437820616) failed all three native updater scenarios: upgrade, native-failure and interrupted. Signing, notarization, packaged E2E and the Windows and Linux candidates all passed. No draft was created, and nothing was published.

What happened

In each scenario, the signed 0.0.0 source refused the tampered ZIP, which is correct. It then showed "The update could not be downloaded or verified" for the authentic candidate: 131,698,006 bytes, SHA-256 a1156e6d….

Running the shipped staging inside the run's signed 0.0.0 fixture app gives the real error, which the controller's catch had hidden:

Invalid package …/updates/verify-…/Modex.app/Contents/Resources/app.asar
    at Object.open (node:electron/js2c/node_init…)

Electron's fs treats any path ending in .asar as an archive to read, and every real Modex update contains Contents/Resources/app.asar. Two other results narrow it down:

  • In plain Node, the same stageUpdateArchive and verifyMacUpdateBundle accept the same bytes, and every codesign, PlistBuddy, lipo and spctl step passes (source=Notarized Developer ID).
  • No test had staged inside Electron: unit tests run in Node, and the updater UI tests substitute staging.

Fix

  • update-archive.ts: inside Electron, staging uses the unpatched original-fs module; plain Node is unchanged. This module is the only updater code that writes or removes files in the unpacked bundle.
  • e2e/update-archive-electron.spec.ts: stages an archive containing app.asar (plus app.asar.unpacked/) inside Electron, then checks the file contents and their removal. It failed with the production error before the fix and passes after it. It loads the module the same way the release harness does, so it also runs in packaged E2E.
  • e2e/store-desktop.spec.ts: the Store recovery test now waits for the new browser tab's address field to take focus before filling the draft. That race failed main's post-merge CI on e3fecf0 once. Its rerun passed, as did 15 local repeats.
  • Docs: the v0.0.12 release record gains "First tagged run", and the two In flight entries in docs/status.md are updated.

Verification

  • npm run build, npm run typecheck and npm test all pass: 1,426 unit tests, 1,410 passed, 16 skipped, 0 failed.
  • All updater e2e specs pass locally (16 of 16), including the new one.
  • The Store recovery test passed all four variants, four repeats each.
  • Inside Electron, the fixed staging and the real publisher verification accept the run's signed candidate ZIP and remove the staging directory.
  • I did not run Squirrel's native replacement locally, because it shares state with the installed Modex. The three hosted scenarios cover it when v0.0.12 is retagged on this fix.

The first signed v0.0.12 run (38437820616) failed all three native
updater scenarios. The signed 0.0.0 source refused the tampered ZIP as
intended, then reported the authentic candidate as "could not be
downloaded or verified". Inside Electron, staging failed with "Invalid
package .../Modex.app/Contents/Resources/app.asar": Electron's fs treats
any path ending in .asar as an archive to read, and every real update
contains that file. Unit tests run in plain Node, and the updater UI
tests substitute staging, so no test had staged inside Electron.

Stage with original-fs when running in Electron. A new e2e test stages
an archive containing app.asar inside Electron. It failed with the
production error before this change. With the fix, staging and the real
publisher verification accept the run's signed candidate ZIP inside
Electron.

Also wait for the new browser tab to take focus before the Store
recovery test fills its draft. That race failed main's post-merge CI
on e3fecf0 once.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 13, 2026 6:18pm UTC

Request Review

@BunsDev
BunsDev merged commit a4383ff into main Oct 13, 2026
7 checks passed
@BunsDev
BunsDev deleted the fix-update-asar branch October 14, 2026 00:46

This branch was successfully deployed

1 active deployment
Preview — bd4f7fb1 Deployed Oct 13, 2026 by vercel[bot]
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