Skip to content

fix(build): align Rollup native packages with supported platforms#337

Merged
shantur merged 3 commits intoNeuralNomadsAI:devfrom
Pagecran:fix/windows-rollup-optional
Apr 19, 2026
Merged

fix(build): align Rollup native packages with supported platforms#337
shantur merged 3 commits intoNeuralNomadsAI:devfrom
Pagecran:fix/windows-rollup-optional

Conversation

@pascalandr
Copy link
Copy Markdown
Contributor

@pascalandr pascalandr commented Apr 18, 2026

Fixes #324

Summary

  • declare root Rollup optional dependencies for the repo's current supported build matrix: macOS x64/arm64, Linux x64/arm64, and Windows x64
  • pin those root platform packages to the same Rollup version already used by the repo
  • keep the existing workflow/manual-install fallback steps in place for now

Validation

  • regenerated package-lock.json with npm install --package-lock-only --ignore-scripts
  • verified the root package entry now records the supported platform packages under optionalDependencies
  • kept the change scoped to the platforms currently represented in workflows and packages/tauri-app/scripts/prebuild.js

Declare @rollup/rollup-win32-x64-msvc as an explicit optional workspace dependency so fresh Windows checkouts and worktrees materialize the native Rollup package at install time instead of failing at runtime.
@pascalandr
Copy link
Copy Markdown
Contributor Author

@CodeNomadBot

I want you to perform the gatekeeper checks for latest PR state

check for regressions
check for better possible implementations
Be the PR gatekeeper
Be ruthless about code quality

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

Gatekeeper review for the latest PR state.

What I checked

  • Read the PR thread and reviewed the full branch diff against origin/dev.
  • Inspected package.json, package-lock.json, existing Rollup platform handling, and the Windows build workflow.
  • Re-generated the lockfile once locally with npm install --package-lock-only --ignore-scripts to see whether the committed lockfile shape is stable.

Findings

  1. High: package-lock.json is not in npm's stable generated form.
    package-lock.json:11-20 records @rollup/rollup-win32-x64-msvc in both the root dependencies block and the root optionalDependencies block. A clean npm install --package-lock-only --ignore-scripts rewrites that section and removes the entry from packages[""] .dependencies, leaving it only under optionalDependencies.

Why this matters: the committed lockfile will churn on the next normal lockfile refresh, which is exactly the kind of non-deterministic package metadata we should block in review.

Recommendation: regenerate the root lockfile from the updated package.json and commit the canonical npm output, making sure the root package entry only lists this package under optionalDependencies.

  1. Medium: the implementation only covers one Windows variant, while the PR description reads broader than that.
    package.json:34-35 pins only @rollup/rollup-win32-x64-msvc, but the repo still advertises Windows ARM64 builds (packages/electron-app/package.json:32-33 includes build:win-arm64), and Rollup itself publishes multiple Windows binaries (package-lock.json:9293-9296 shows win32-arm64-msvc, win32-ia32-msvc, win32-x64-gnu, win32-x64-msvc).

Why this matters: if the stated goal is to make "Windows installs" reliable in general, this PR only fixes the x64 MSVC subset. That may be intentional, but then the scope should be described narrowly.

Recommendation: either narrow the PR language to explicitly say "Windows x64 MSVC installs" or expand the approach to cover the Windows variants the project intends to support.

Notes

  • I did not see unrelated code regressions in the submitted diff itself; the change is tightly scoped.
  • I could not get a full UI build signal in this worktree because local dependencies are not materialized here (vite is missing in the current checkout), so my validation was limited to diff inspection plus lockfile regeneration behavior.
  • The workflow still has a manual npm install @rollup/rollup-win32-x64-msvc --no-save step in .github/workflows/build-and-upload.yml:256-257. That is not a blocker for this PR by itself, but it does mean the repository still contains a separate workaround even after this change.

--
Yours,
CodeNomadBot

Regenerate the root lockfile after adding the Windows Rollup optional dependency so npm's canonical output keeps the package only under optionalDependencies.
@pascalandr pascalandr changed the title fix(build): pin Rollup's Windows native package fix(build): pin Rollup's Windows x64 native package Apr 18, 2026
@pascalandr
Copy link
Copy Markdown
Contributor Author

Addressed CodeNomadBot's feedback in e833823:

  • regenerated package-lock.json in canonical npm form
  • narrowed the PR wording to the Windows x64 / MSVC scope this change actually covers

@pascalandr
Copy link
Copy Markdown
Contributor Author

@CodeNomadBot

I want you to perform the gatekeeper checks for latest PR state

check for regressions
check for better possible implementations
Be the PR gatekeeper
Be ruthless about code quality

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

Gatekeeper review for the latest PR state.

What I understood

  • You wanted a fresh PR gatekeeper pass on the updated branch state, focused on regressions and whether there is a better implementation.
  • Assumption: review scope is the current PR diff against origin/dev, not unrelated existing workflow debt outside this change.

What I checked

  • Re-read the updated PR thread.
  • Reviewed the current branch diff against origin/dev.
  • Re-checked package.json and the root package-lock.json shape.
  • Re-ran npm install --package-lock-only --ignore-scripts locally to verify the lockfile now stays in canonical npm form.

Findings

  • No blocking findings in the latest PR state.

Why this now passes gatekeeper review

  • The earlier lockfile issue is fixed: the root package entry now lists @rollup/rollup-win32-x64-msvc only under optionalDependencies, and a fresh lockfile regeneration does not rewrite the file.
  • The PR wording is now correctly narrowed to the Windows x64 / MSVC scope that the code actually implements.
  • The change remains tightly scoped to the declared fix, with no unrelated file churn in the PR diff.

Non-blocking suggestion

  • The repo still contains existing workflow-level fallback steps such as .github/workflows/build-and-upload.yml:256-257 installing @rollup/rollup-win32-x64-msvc --no-save after npm ci --workspaces --include=optional. That is not introduced by this PR and I would not block on it here, but it is worth a follow-up cleanup once Windows CI proves the root optional dependency is sufficient on its own.

Verdict

  • No regressions found in the submitted diff.
  • No better implementation is necessary within this PR’s stated scope.
  • Gatekeeper status: approved from a code-quality standpoint.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@CodeNomadBot

Will this optional dependency fail when doing npm i on macOS or Linux as rollup is platform dependent and doesn't have the dependency for macos and Linux

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

What I understood

  • You are asking whether adding @rollup/rollup-win32-x64-msvc as a root optionalDependency will break npm install on macOS or Linux, since that package is Windows-only.
  • Assumption: the question is about normal npm install behavior, not a specific older npm bug in a custom environment.

Answer

  • No, this should not fail a normal npm install on macOS or Linux.
  • Because it is in optionalDependencies and the package itself is restricted to os: ["win32"] and cpu: ["x64"], npm skips installing it on non-matching platforms instead of treating it as an install error.
  • That is the same mechanism npm already uses for many platform-specific native packages, including Rollup's own per-platform binaries.

Why this is safe

  • On macOS/Linux, npm will still resolve the lockfile entry, but it should not materialize node_modules/@rollup/rollup-win32-x64-msvc locally.
  • The main rollup package already declares its own platform-specific optional dependencies for macOS/Linux/Windows. This PR is only forcing the Windows x64/MSVC package to also be present at the workspace root for Windows installs/worktrees where npm was not materializing it reliably.
  • Non-Windows installs continue to rely on Rollup's normal platform selection.

Caveat

  • If someone is using a broken npm version with a platform-optional dependency bug, any platform-specific optional package can behave unexpectedly. But under standard npm behavior, this change should not cause macOS/Linux installs to fail.

Bottom line

  • Expected behavior is: Windows x64/MSVC installs get the extra optional package; macOS/Linux installs skip it cleanly.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@CodeNomadBot

Do you think we should add a rollup entry for all platforms and archs to enable building without manual rollup fix?

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

What I understood

  • You are asking whether the better long-term fix would be to add root-level optional Rollup platform packages for every supported OS/arch, instead of only pinning Windows x64/MSVC and keeping any manual fallback steps.
  • Assumption: this is an architecture/maintenance question, not a request to expand this PR right now.

My recommendation

  • No, I would not add root optionalDependencies for all Rollup platform packages by default.

Why

  • Rollup already declares its own full matrix of platform-specific optional dependencies. Duplicating all of them at the workspace root would mostly be compensating for package-manager/worktree behavior with a second copy of the same platform matrix.
  • That increases maintenance cost. Every Rollup update would require keeping a manually mirrored list in sync across all supported OS/arch combinations.
  • It broadens the blast radius of this workaround. The current PR is tightly scoped to the specific platform that is known to be failing.
  • It would add more lockfile churn and more opportunities for partial mismatches when Rollup changes its published platform package set.

What I would do instead

  • Keep this PR scoped to the proven failing case: Windows x64/MSVC.
  • If CI and real-world installs show the same missing-binary problem on other platforms, add those cases based on evidence rather than preemptively mirroring Rollup's entire platform matrix.
  • If the goal is to eliminate the manual workflow fix entirely, the cleaner follow-up is to validate whether npm ci --workspaces --include=optional plus the targeted root optional dependency is now sufficient, then remove the workflow fallback in a separate PR.

When adding all platforms would make sense

  • Only if you confirm the underlying npm/worktree bug is systemic across multiple OS/arch targets and the repository needs a repository-level guardrail independent of Rollup's own package metadata.
  • Even then, I would treat it as a deliberate follow-up with validation on each platform, not bundle it into this PR.

Bottom line

  • I would not proactively add all Rollup platform entries now.
  • Targeted fixes plus removal of the manual fallback after validation is the lower-risk approach.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@CodeNomadBot

I believe we need to do a manual install step, check .github/workflows for the repo and see how rollup is managed

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

What I understood

  • You wanted me to verify the current workflow reality in .github/workflows and reassess whether a manual Rollup install step is still needed.
  • Assumption: the question is about this repo's actual CI/build behavior, not theoretical npm behavior in isolation.

What I found in the workflows

  • Yes, this repo already manages Rollup with explicit manual install steps in CI across platforms.
  • macOS: .github/workflows/build-and-upload.yml:98-99 installs @rollup/rollup-darwin-x64 --no-save after npm ci --workspaces --include=optional.
  • Windows: .github/workflows/build-and-upload.yml:256-257 and :530-531 install @rollup/rollup-win32-x64-msvc --no-save after npm ci --workspaces --include=optional.
  • Linux: .github/workflows/release-ui.yml:39-40 installs @rollup/rollup-linux-x64-gnu --no-save, and .github/workflows/manual-npm-publish.yml:68-69 does the same.

Updated recommendation

  • I agree with you: for this repo today, the manual install step appears intentional and should stay.
  • The workflow evidence shows the project is not relying solely on Rollup's transitive platform resolution or on root optionalDependencies; it is already enforcing the native binary explicitly per runner platform.

How I would interpret this PR in that context

  • The PR still makes sense as a targeted fix for Windows x64/MSVC installs and worktrees outside CI.
  • But I would not treat it as replacing the workflow workaround yet.
  • The safer stance is:
    • keep the manual workflow installs,
    • keep this PR narrowly scoped to improving Windows x64/MSVC dependency materialization,
    • and only consider removing workflow steps after CI evidence proves they are redundant.

Bottom line

  • Yes, based on the repository workflows, a manual Rollup install step is currently part of the established build strategy.
  • So I would keep the workflow manual install steps and view this PR as an additional guardrail, not a full replacement for them.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@CodeNomadBot

We need to be aligned with all the platforms, suggest what needs to be done for that, not just targetted fix.
We have seen similar issues in macOS too.

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

What I understood

  • You want an all-platform recommendation for how this repo should handle Rollup native binaries, not just a Windows-specific opinion.
  • Assumption: the goal is consistent local installs, worktrees, and CI builds across the platforms the repo actually supports.

Recommended all-platform approach

  • I would align the repository around the supported build matrix, not around a single targeted package.
  • Concretely, I would treat these as separate layers:
  1. Repository dependency layer
  • Add root optionalDependencies for each platform/arch combination that the repo explicitly supports building in practice.
  • Based on the current workflows and scripts, that likely starts with:
    • @rollup/rollup-darwin-x64
    • @rollup/rollup-darwin-arm64
    • @rollup/rollup-linux-x64-gnu
    • @rollup/rollup-linux-arm64-gnu if Linux ARM64 is a supported build target
    • @rollup/rollup-win32-x64-msvc
    • @rollup/rollup-win32-arm64-msvc if Windows ARM64 is a supported build target
  • Then regenerate the root lockfile canonically.

Why: this gives local installs and worktrees the same explicit platform guardrails instead of only protecting one platform.

  1. Workflow layer
  • Keep the manual npm install <platform-package> --no-save steps in CI for now.
  • Those steps are already part of the repo's build strategy and provide a second line of defense when runner/package-manager behavior is inconsistent.
  • Do not remove them in the same change as broadening the root optional dependency matrix.

Why: root optionalDependencies improve local/worktree behavior, but the workflows show CI still benefits from explicit enforcement.

  1. Single source of truth
  • Centralize the supported Rollup platform package map in one place and make workflows/scripts follow it.
  • Right now the repo has platform knowledge in multiple places:
    • workflow YAML steps
    • packages/tauri-app/scripts/prebuild.js
    • root dependency metadata
  • The cleaner follow-up is to define the supported platform map once and use it to keep these surfaces aligned.

Why: the real risk is drift. A new supported platform can otherwise be added in one place and missed in another.

  1. Validation layer
  • Validate each supported platform explicitly in CI or release jobs after broadening the matrix.
  • For each supported target, verify:
    • npm ci completes
    • the expected Rollup native package is present or manually installable
    • the relevant build command succeeds

Why: if you have already seen macOS exhibit similar issues, this should be treated as a cross-platform reliability problem and verified as such.

What I would not do

  • I would not mirror every Rollup package that exists upstream just because Rollup publishes it.
  • I would only add the packages for platforms/architectures this repository intends to support.

Suggested end state

  • Root optionalDependencies cover all supported repo platforms.
  • CI keeps explicit platform-specific manual install steps until proven unnecessary.
  • The platform package list is centralized so workflows, scripts, and root metadata stay aligned.

Bottom line

  • Yes, if the repo has seen the same class of problem on macOS too, the better long-term answer is to align the root Rollup optional dependency strategy with the full supported platform matrix, while still keeping the workflow manual install fallback for now.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@CodeNomadBot

Can. you reply with suggested patch to align all platforms for this?

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

What I understood

  • You want a concrete suggested patch, not just guidance, for aligning Rollup native-package handling across the platforms this repo supports.
  • Assumption: "all platforms" means the repo's current practical build matrix from workflows and scripts: macOS x64/arm64, Linux x64/arm64, and Windows x64. I am treating Windows ARM64 as conditional because the repo has a build script for it, but I do not see a workflow lane using it yet.

Suggested patch

diff --git a/package.json b/package.json
@@
   "devDependencies": {
     "baseline-browser-mapping": "^2.9.11"
   },
   "optionalDependencies": {
+    "@rollup/rollup-darwin-arm64": "^4.52.5",
+    "@rollup/rollup-darwin-x64": "^4.52.5",
+    "@rollup/rollup-linux-arm64-gnu": "^4.52.5",
+    "@rollup/rollup-linux-x64-gnu": "^4.52.5",
     "@rollup/rollup-win32-x64-msvc": "^4.52.5"
   }
 }

Then regenerate the lockfile canonically:

npm install --package-lock-only --ignore-scripts

Optional follow-up if Windows ARM64 is an actually supported lane and not just a dormant script:

diff --git a/package.json b/package.json
@@
   "optionalDependencies": {
     "@rollup/rollup-darwin-arm64": "^4.52.5",
     "@rollup/rollup-darwin-x64": "^4.52.5",
     "@rollup/rollup-linux-arm64-gnu": "^4.52.5",
     "@rollup/rollup-linux-x64-gnu": "^4.52.5",
+    "@rollup/rollup-win32-arm64-msvc": "^4.52.5",
     "@rollup/rollup-win32-x64-msvc": "^4.52.5"
   }
 }

Suggested follow-up patch for script alignment if Windows ARM64 is supported:

diff --git a/packages/tauri-app/scripts/prebuild.js b/packages/tauri-app/scripts/prebuild.js
@@
   const platformPackages = {
     "linux-x64": "@rollup/rollup-linux-x64-gnu",
     "linux-arm64": "@rollup/rollup-linux-arm64-gnu",
     "darwin-arm64": "@rollup/rollup-darwin-arm64",
     "darwin-x64": "@rollup/rollup-darwin-x64",
+    "win32-arm64": "@rollup/rollup-win32-arm64-msvc",
     "win32-x64": "@rollup/rollup-win32-x64-msvc",
   }

Why this patch

  • It aligns root optionalDependencies with the platforms already represented in the repo's workflows and prebuild logic, instead of only protecting Windows x64.
  • It keeps the current CI strategy intact. I would still retain the existing workflow npm install @rollup/... --no-save steps for now.
  • It avoids mirroring every Rollup package upstream publishes and instead mirrors only the repo's supported matrix.

What I would not include in this patch yet

  • I would not remove the manual workflow install steps in the same change.
  • I would not add musl, ia32, GNU-vs-MSVC alternates, or other Rollup targets unless this repo explicitly builds/tests them.

Recommended validation after the patch

  • npm install --package-lock-only --ignore-scripts
  • Verify the root lockfile now includes the chosen platform packages under root optionalDependencies
  • Run the existing macOS/Linux/Windows build jobs as-is, keeping the manual install steps in place

Bottom line

  • If you want the repo aligned across currently supported platforms, the practical patch is to expand the root Rollup optionalDependencies to the repo's actual build matrix, regenerate the lockfile, and keep CI's manual install fallback for now.

--
Yours,
CodeNomadBot

@shantur
Copy link
Copy Markdown
Collaborator

shantur commented Apr 18, 2026

@pascalandr - Would you be able to implement the suggested fix please?

Expand the root Rollup optional dependency set to the platforms the repo currently builds in practice: macOS x64/arm64, Linux x64/arm64, and Windows x64, all pinned to the same Rollup version already used by the repo.
@pascalandr pascalandr changed the title fix(build): pin Rollup's Windows x64 native package fix(build): align Rollup native packages with supported platforms Apr 18, 2026
@pascalandr
Copy link
Copy Markdown
Contributor Author

Expanded the fix as requested in f1af0bf:

  • root Rollup optional dependencies now cover the repo's current supported build matrix (macOS x64/arm64, Linux x64/arm64, Windows x64)
  • all of them are pinned to the same Rollup version already used by the repo
  • workflow/manual-install fallback steps are intentionally left in place for now

@pascalandr
Copy link
Copy Markdown
Contributor Author

@CodeNomadBot

I want you to perform the gatekeeper checks for latest PR state

check for regressions
check for better possible implementations
Be the PR gatekeeper
Be ruthless about code quality

@codenomadbot
Copy link
Copy Markdown
Contributor

codenomadbot bot commented Apr 18, 2026

Gatekeeper review for the latest PR state.

What I understood

  • You wanted a fresh gatekeeper pass on the updated PR after expanding the Rollup fix from a Windows-only patch to the repo's current supported platform matrix.
  • Assumption: review scope is the submitted diff against origin/dev, with focus on regressions, implementation quality, and support-matrix consistency.

What I checked

  • Re-read the updated PR thread.
  • Reviewed the full branch diff against origin/dev.
  • Re-checked package.json, package-lock.json, and packages/tauri-app/scripts/prebuild.js.
  • Re-ran npm install --package-lock-only --ignore-scripts locally to verify the expanded lockfile stays canonical and does not churn.

Findings

  1. Medium: Windows ARM64 support is still ambiguous and remains outside the new alignment.
  • packages/electron-app/package.json:33 still exposes build:win-arm64.
  • packages/tauri-app/scripts/prebuild.js:140-146 still does not map win32-arm64 to a Rollup native package.
  • package.json:34-39 likewise does not include @rollup/rollup-win32-arm64-msvc.

Why this matters: the PR is now framed as aligning Rollup native packages with supported platforms. That is true for the matrix described in the PR body, but the repo still exposes a Windows ARM64 build entrypoint that is not covered by the new alignment. If someone treats that script as supported, they can still hit the same class of missing-binary problem.

Recommendation: either keep treating this as intentionally unsupported and leave it out of scope, or follow up by aligning win-arm64 end-to-end as well. I would not block this PR on that if Windows ARM64 is intentionally not part of the supported build matrix today, but the repo should make that status clear.

No blocking findings

  • The earlier lockfile-shape problem is fixed.
  • A fresh npm install --package-lock-only --ignore-scripts leaves the lockfile unchanged, so the committed lockfile is now in stable canonical form.
  • The root Rollup optional dependencies now match the platforms currently represented in workflows and the Tauri prebuild fallback: macOS x64/arm64, Linux x64/arm64, and Windows x64.
  • Keeping the existing workflow npm install @rollup/... --no-save fallback steps in place is the safer implementation choice for now.

Verdict

  • No blocking regressions found in the submitted diff.
  • Implementation quality is good for the stated scope.
  • Gatekeeper status: pass, with one medium follow-up risk around the still-exposed win-arm64 script and support-matrix clarity.

--
Yours,
CodeNomadBot

@shantur shantur merged commit acfa265 into NeuralNomadsAI:dev Apr 19, 2026
13 of 16 checks passed
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.

Bug fix: Windows Rollup Worktree Fix

2 participants