[PR #7786] [MERGED] fix(build): give the desktop client build the heap its type-check needs #7927

Closed
opened 2026-10-24 04:08:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7786
Author: @ylli-selmani
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ylli-selmani

Base: staging ← Head: fix/client-build-heap


📝 Commits (5)

  • de8afe9 fix(build): give the desktop client build the heap its type-check needs
  • c02d6b9 fix(build): a NODE_OPTIONS heap spelled with underscores also wins
  • 09bfa34 fix(build): recognize the heap flag only as its own option
  • e347ec0 fix(build): read NODE_OPTIONS the way Node does before looking for a heap
  • 8724456 fix(build): respect a container's memory limit and the heap percentage flag

📊 Changes

3 files changed (+120 additions, -4 deletions)

View changed files

📝 packages/client/scripts/build-heap.mjs (+61 -0)
📝 packages/client/scripts/build.mjs (+4 -2)
📝 scripts/regressions/launcher/termux-client-build.regression.mjs (+55 -2)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7785

Why this change

Native install/build on the macOS runners runs out of memory in the client build's type-check, on every run of any branch that has merged current staging (seen on #7773). A cold type-check of the client now needs about 2.1 GiB of heap. Node's default heap is about 4 GiB on a 16 GiB machine but only about 2 GiB on the 7 GiB macOS runners, and build.mjs only raised the heap for Android builds.

@SpicyMarinara, flagging this one since it blocks macOS CI on anything based on current staging, ahead of the release.

What changed

  • packages/client/scripts/build-heap.mjs: a desktop rule beside the Termux one. A desktop build gets 3072 MiB when Node's own default is lower and half the machine's memory allows it.
    • A larger default is never lowered: on a 16 GB+ machine nothing changes.
    • A heap already set in NODE_OPTIONS (the user's) is left alone.
    • Termux/Android builds keep their own rule, unchanged.
  • packages/client/scripts/build.mjs uses the Termux rule for low-memory builds and the desktop rule otherwise. It only sets the heap for the build's own children, as before.
  • termux-client-build.regression.mjs covers the desktop rule: a 7 GiB machine gets 3072, a 4 GiB default is kept, never more than half the memory, and a NODE_OPTIONS heap wins.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Measured a cold tsc of the client with --extendedDiagnostics: 2.14 GB on #7773's branch and 2.15 GB on a branch whose macOS build passed, so the macOS runners sit right at the line. The CI crash stops at 2041.9 MB.
  • Ran the real build.mjs while reporting a 7 GiB machine with a 2048 MiB default: it logs Client build heap limit: 3072 MiB. and the client builds (tsc, Vite, multiplayer guest).
  • On this 32 GB machine (Node default 4192 MiB) the rule picks nothing and the build runs as before.
  • pnpm regression:launcher-update and termux-client-build.regression.mjs pass. The full regression run (complete-node-regressions) includes the Termux file, so the new cases run in CI.

Not tested: an actual macOS runner; this PR's own Platform Artifact Checks will be that test. Every path that builds the client goes through build.mjs (pnpm build, the launchers' updates, the Windows installer's install.bat), so users on low-memory desktops get the same rule: 3072 MiB only where half their memory allows it and Node's default is lower.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Build Improvements
    • Desktop client builds can use a heap size based on available device or container memory, capped at 3 GiB. The allocation is increased only when the default heap is lower and half of the applicable memory permits it.
    • Explicit Node.js heap settings take precedence. Android and low-memory builds continue to use their existing memory allocation behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7786 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `fix/client-build-heap` --- ### 📝 Commits (5) - [`de8afe9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/de8afe9eecdd3cfc12c5d83ffb0cbef05f9682e7) fix(build): give the desktop client build the heap its type-check needs - [`c02d6b9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c02d6b9a9670eda83a0c51a7e07a5de96792b7db) fix(build): a NODE_OPTIONS heap spelled with underscores also wins - [`09bfa34`](https://github.com/Pasta-Devs/Marinara-Engine/commit/09bfa3417fa9a2d9dcd28fd81c950c1f6738ccdb) fix(build): recognize the heap flag only as its own option - [`e347ec0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e347ec0956e64ca92c3fc8b921a55c52e8febd54) fix(build): read NODE_OPTIONS the way Node does before looking for a heap - [`8724456`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8724456feb2e386e8274d05a2ed30cb587a7569b) fix(build): respect a container's memory limit and the heap percentage flag ### 📊 Changes **3 files changed** (+120 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/scripts/build-heap.mjs` (+61 -0) 📝 `packages/client/scripts/build.mjs` (+4 -2) 📝 `scripts/regressions/launcher/termux-client-build.regression.mjs` (+55 -2) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7785 ## Why this change `Native install/build` on the macOS runners runs out of memory in the client build's type-check, on every run of any branch that has merged current `staging` (seen on #7773). A cold type-check of the client now needs about 2.1 GiB of heap. Node's default heap is about 4 GiB on a 16 GiB machine but only about 2 GiB on the 7 GiB macOS runners, and `build.mjs` only raised the heap for Android builds. @SpicyMarinara, flagging this one since it blocks macOS CI on anything based on current `staging`, ahead of the release. ## What changed - `packages/client/scripts/build-heap.mjs`: a desktop rule beside the Termux one. A desktop build gets 3072 MiB when Node's own default is lower and half the machine's memory allows it. - A larger default is never lowered: on a 16 GB+ machine nothing changes. - A heap already set in `NODE_OPTIONS` (the user's) is left alone. - Termux/Android builds keep their own rule, unchanged. - `packages/client/scripts/build.mjs` uses the Termux rule for low-memory builds and the desktop rule otherwise. It only sets the heap for the build's own children, as before. - `termux-client-build.regression.mjs` covers the desktop rule: a 7 GiB machine gets 3072, a 4 GiB default is kept, never more than half the memory, and a `NODE_OPTIONS` heap wins. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Measured a cold `tsc` of the client with `--extendedDiagnostics`: 2.14 GB on #7773's branch and 2.15 GB on a branch whose macOS build passed, so the macOS runners sit right at the line. The CI crash stops at 2041.9 MB. - Ran the real `build.mjs` while reporting a 7 GiB machine with a 2048 MiB default: it logs `Client build heap limit: 3072 MiB.` and the client builds (tsc, Vite, multiplayer guest). - On this 32 GB machine (Node default 4192 MiB) the rule picks nothing and the build runs as before. - `pnpm regression:launcher-update` and `termux-client-build.regression.mjs` pass. The full regression run (`complete-node-regressions`) includes the Termux file, so the new cases run in CI. Not tested: an actual macOS runner; this PR's own Platform Artifact Checks will be that test. Every path that builds the client goes through `build.mjs` (`pnpm build`, the launchers' updates, the Windows installer's `install.bat`), so users on low-memory desktops get the same rule: 3072 MiB only where half their memory allows it and Node's default is lower. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Build Improvements** * Desktop client builds can use a heap size based on available device or container memory, capped at 3 GiB. The allocation is increased only when the default heap is lower and half of the applicable memory permits it. * Explicit Node.js heap settings take precedence. Android and low-memory builds continue to use their existing memory allocation behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7927
No description provided.