Skip to content

ci(desktop) [DO NOT MERGE]: try preMake sync hook to dodge hdiutil race#730

Closed
softmarshmallow wants to merge 1 commit into
mainfrom
worktree-dmg-sync-hook-test
Closed

ci(desktop) [DO NOT MERGE]: try preMake sync hook to dodge hdiutil race#730
softmarshmallow wants to merge 1 commit into
mainfrom
worktree-dmg-sync-hook-test

Conversation

@softmarshmallow

@softmarshmallow softmarshmallow commented May 20, 2026

Copy link
Copy Markdown
Member

This PR is for CI verification only — do NOT merge.

Purpose

PRs #729 (runner bump macos-15 → macos-26) didn't fix the deterministic hdiutil convert failed - Resource temporarily unavailable error. This PR layers a speculative preMake sync hook on top to see if flushing pending I/O before the DMG maker dodges the race.

What's here

Two commits on top of main:

  1. e78d187a6macos-15 → macos-26 (already in #729)
  2. 243c04a30 — new: preMake sync hook in desktop/forge.config.ts, plus bumping desktop/package.json to 0.0.2-dmg-test.1 so this run lands on a clearly-test prerelease tag separate from 0.0.1 production.

Verification path

Trigger the workflow on this branch with prerelease=true:

gh workflow run realease-desktop-app.yml -R gridaco/grida --ref worktree-dmg-sync-hook-test -f prerelease=true

update.electronjs.org skips prereleases by default, so no installed user gets this build. Approve in the release environment gate. If the macOS job completes through to publish, the hook works and we cherry-pick the sync hook (without the version bump) into a clean PR. If it fails again, we close this and fall back to dropping MakerDMG.

Cleanup

Regardless of outcome, after the test run:

  • Delete the 0.0.2-dmg-test.1 release + tag on GitHub.
  • This PR gets closed (not merged).

Summary by CodeRabbit

  • Bug Fixes

    • Resolved a macOS DMG creation race condition to improve installation reliability.
  • Chores

    • Bumped app version to 0.0.2-dmg-test.1.

Review Change Stack

Two prior runs (macos-15 #76977463044, macos-26 #76981259137) both
failed identically at the DMG maker step:

  hdiutil: convert failed - Resource temporarily unavailable

Upstream investigation: this is a known appdmg + GitHub-Actions-macOS
race that electron-forge has not fixed (electron-builder fixed it in
June 2025 by switching to dmgbuild; we're on forge). One documented
workaround (CMake Discourse) is to flush pending I/O with `sync`
before hdiutil so the convert step doesn't race with the package
step's writes.

Add a darwin-only preMake hook that runs `sync` and sleeps 2s before
makers start. Speculative — if it doesn't help, fallback is to drop
MakerDMG entirely.

Also bump desktop/package.json version to 0.0.2-dmg-test.1 so this
test run lands on a clearly-test prerelease tag separate from the
0.0.1 production releases. Will be reset before final merge.
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

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

7 Skipped Deployments
Project Deployment Actions Updated (UTC)
backgrounds Ignored Ignored Preview May 20, 2026 2:45pm
blog Ignored Ignored Preview May 20, 2026 2:45pm
code Ignored Ignored May 20, 2026 2:45pm
docs Ignored Ignored Preview May 20, 2026 2:45pm
grida Ignored Ignored Preview May 20, 2026 2:45pm
legacy Ignored Ignored May 20, 2026 2:45pm
viewer Ignored Ignored Preview May 20, 2026 2:45pm

Request Review

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 39a38bf4-287a-4225-98d3-a63a4ec284eb

📥 Commits

Reviewing files that changed from the base of the PR and between 233a926 and 243c04a.

📒 Files selected for processing (2)
  • desktop/forge.config.ts
  • desktop/package.json

Walkthrough

Electron Forge configuration in the desktop app now includes a preMake hook that runs exclusively on macOS. The hook dynamically loads node:child_process, invokes the sync command to flush pending writes, and delays 2 seconds before packaging—addressing a DMG creation I/O race condition. Package version is incremented to 0.0.2-dmg-test.1.

Changes

macOS DMG Build Race Condition Mitigation

Layer / File(s) Summary
Forge preMake hook and version bump
desktop/forge.config.ts, desktop/package.json
Electron Forge hooks.preMake async handler is added to conditionally run sync and delay 2 seconds on macOS before DMG packaging. Package version is bumped to 0.0.2-dmg-test.1 to mark the test build.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a preMake sync hook as a workaround for an hdiutil race condition in macOS DMG creation, which matches the core content of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-dmg-sync-hook-test

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@softmarshmallow

Copy link
Copy Markdown
Member Author

Hypothesis disproven — the sync hook mitigated EAGAIN but exposed appdmg's parallel-arch "Target already exists" race (electron/forge#3517). Going with arm64-only on macOS instead — see #731.

pull Bot pushed a commit to A-Archives-and-Forks/grida that referenced this pull request May 20, 2026
Two distinct failure modes when building --arch="x64,arm64" together,
both surface only with multi-arch parallel builds:

1. `hdiutil convert failed - Resource temporarily unavailable`
   (EAGAIN from contention on the runner's filesystem)
2. `Target already exists` from appdmg
   (known unfixed forge bug — electron/forge#3517: maker-dmg fails
    when run in parallel)

The sync hook from PR gridaco#730 mitigated #1 but exposed #2. With one arch
there is no parallel race, so both go away. DMG stays.

Tradeoff: Intel Mac users can't install or autoupdate. Apple Silicon
share dominates in 2026, so the cost is small for a 0.x.x technical
preview. We can add Intel back later (universal binary or serialized
arch builds) when there's actual demand.

Also bump desktop/package.json version to 0.0.2-arm64-test.1 for the
CI verification run so this test prerelease lands on its own tag and
doesn't touch 0.0.1 production releases. Will be reset before final
merge.
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