Skip to content

fix: ship Windows app code in asar to fit legacy Squirrel path limits - #55

Merged
gitcommit90 merged 1 commit into
mainfrom
fix/windows-asar-packaging
Aug 2, 2026
Merged

fix: ship Windows app code in asar to fit legacy Squirrel path limits#55
gitcommit90 merged 1 commit into
mainfrom
fix/windows-asar-packaging

Conversation

@gitcommit90

@gitcommit90 gitcommit90 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Problem

0.0.36 Windows packaging fails during Squirrel releasify with PathTooLongException. Legacy Squirrel expands every package file through 260-character .NET path APIs — during releasify, and again on every end-user machine during install/update under %LOCALAPPDATA%. The deepest loose dependency paths (nested OpenTelemetry copies under spectrum-ts, 166 characters relative) exceed the budget once Squirrel adds its staging prefixes. The drive-root scratch directory cannot fix this because Squirrel extracts into its own temp tree.

Fix

  • Windows packages ship application code inside app.asar: legacy Squirrel now handles ~600 short paths instead of ~30,000 deeply nested loose files, at build time and at end-user install/update time.
  • Unpacked beside the archive (real files for external consumers): scripts/, container/, deploy/, public/, desktop/, node_modules/node-pty, and all *.node natives.
  • The desktop shell translates HELM_APP_ROOT, the working directory, and the Squirrel uninstall helper to the unpacked tree (Python, PowerShell, WSL, and plain-Node consumers keep reading real disk), while the server is imported from inside the archive so dependency resolution stays there.
  • The photon sidecar runs as a plain Node child process and cannot open asar archives; npm run build now produces a self-contained bundle (build:sidecar) which packaged builds start from the unpacked tree.
  • macOS, Linux, and development startup paths are unchanged.

Release 0.0.37: version, changelog, and local/1helm-channel-machine:0.0.37 pins.

Verification

  • npm run ci (typecheck, build, full suite): 118 tests, 0 failures.
  • New regression test: asar packaging contract plus a live sidecar-bundle build that must load with no module-resolution errors from a foreign directory.
  • Empirical probe: packaged the real app for Linux with the identical asar configuration — 581 unpacked files, longest relative path 118 characters, and the packaged app booted headless and served /api/setup/status.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved Windows packaging with more reliable application archives, external assets, native modules, and Photon sidecar handling.
    • Added improved startup support for packaged and unpackaged desktop environments.
  • Bug Fixes

    • Fixed Windows uninstall cleanup and runtime path handling.
    • Updated the default channel machine image to version 0.0.37.
  • Documentation

    • Added release notes for version 0.0.37.
    • Updated the documented default machine image version.

Squirrel 1.x expands every package file through 260-character .NET path
APIs, during releasify and again on end-user machines under
%LOCALAPPDATA%. Loose node_modules paths (deepest: nested OpenTelemetry
copies under spectrum-ts at 166 characters) exceed that budget, so
0.0.36 Windows packaging failed with PathTooLongException.

Windows packages now ship application code inside app.asar (a few
hundred short paths instead of tens of thousands of loose files) and
unpack only what must exist on real disk: scripts, container image,
deploy config, public assets, the desktop directory, node-pty, and
native modules. The desktop shell translates HELM_APP_ROOT, the working
directory, and the Squirrel uninstall helper to the unpacked tree so
Python, PowerShell, WSL, and plain-Node consumers keep reading real
files, while the server itself is imported from inside the archive so
dependency resolution stays there. The photon sidecar, a plain Node
child process that cannot open asar archives, is bundled self-contained
during npm run build and started from the unpacked tree in packaged
builds. macOS, Linux, and development startup paths are unchanged.

Verified by packaging the real app for Linux with the identical asar
configuration: 581 unpacked files with a longest relative path of 118
characters, and the packaged app booted and served /api/setup/status.

Release 0.0.37: version, changelog, and channel-machine pins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 287a9ed5-87dc-49bd-8386-95478197d827

📥 Commits

Reviewing files that changed from the base of the PR and between 3b7ebd7 and 9d08b6c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • .gitignore
  • CHANGELOG.md
  • README.md
  • desktop/main.cjs
  • package.json
  • scripts/package-windows.cjs
  • src/server/channel-computers.ts
  • src/server/db.ts
  • src/server/photon.ts
  • test/channel-computers.mjs
  • test/desktop.mjs

📝 Walkthrough

Walkthrough

Version 0.0.37 packages the Windows desktop application as app.asar, keeps selected runtime assets unpacked, bundles Photon separately, resolves packaged paths, and updates channel-machine image references and release documentation.

Changes

Windows asar packaging and Photon sidecar

Layer / File(s) Summary
Build and validate the packaged application
package.json, scripts/package-windows.cjs, test/desktop.mjs, .gitignore
The build creates the Photon sidecar bundle. Windows packaging uses app.asar and unpacks native modules and selected runtime directories. Integration tests validate the packaged layout and sidecar startup.
Resolve packaged runtime paths
desktop/main.cjs, src/server/photon.ts
Desktop startup maps archived paths to app.asar.unpacked for external processes. Photon selects an environment override, the source module, or the unpacked bundle based on the runtime path.
Update release and image contracts
package.json, src/server/channel-computers.ts, src/server/db.ts, test/channel-computers.mjs, README.md, CHANGELOG.md
Version, documentation, changelog entries, and default channel-machine image references now use 0.0.37.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Build as package.json
  participant Packager as scripts/package-windows.cjs
  participant Electron as Electron
  participant Runtime as desktop/main.cjs
  participant Photon as src/server/photon.ts
  Build->>Packager: Build Photon sidecar bundle
  Packager->>Electron: Create app.asar and app.asar.unpacked
  Electron->>Runtime: Start packaged application
  Runtime->>Runtime: Map external paths to app.asar.unpacked
  Runtime->>Photon: Start Photon connector
  Photon->>Photon: Select bundled sidecar path
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main Windows packaging change and its purpose.
Description check ✅ Passed The description clearly explains the problem, fix, release updates, and verification results, despite omitting some template checkboxes.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-asar-packaging

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

@gitcommit90
gitcommit90 merged commit 83f2a2c into main Aug 2, 2026
6 checks passed
@gitcommit90
gitcommit90 deleted the fix/windows-asar-packaging branch August 2, 2026 03:24
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