Skip to content

fix(todesktop): trim appFiles to stop re-uploading raw source - #1443

Open
claude[bot] wants to merge 1 commit into
mainfrom
fix/todesktop-bundle-size
Open

fix(todesktop): trim appFiles to stop re-uploading raw source#1443
claude[bot] wants to merge 1 commit into
mainfrom
fix/todesktop-bundle-size

Conversation

@claude

@claude claude Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Requested by James Kwon · Slack thread

Summary

The last two ToDesktop releases (v1.0.40-rc.1, v1.0.40) failed at the "Build with ToDesktop" step. James's read was right: it's the app-size check, not something else — confirmed via check-runs annotations (Process completed with exit code 1 on that step) and by reproducing the CLI's exact size-check logic and message locally.

Root cause: todesktop.json's appFiles is ["**", ...] with only 3 narrow exclusions, so it re-uploads almost the entire repo — including the ~23 MB src/ tree — instead of just what the packaged app needs. src/renderer/public/install-showcase-scene/ alone (~10 MB of .webm assets added in #1426, "live output showcase during the install wait") gets uploaded twice: once as source under src/, and again as the copy electron-vite writes to out/renderer/ at build time. That, plus e2e/, docs/, and various dev-only config files that ToDesktop's remote build never reads, pushed the uploaded archive to ~46.2 MB against a 30 MB uploadSizeLimit.

#1437 already merged raising uploadSizeLimit 30 → 60 MB as an immediate unblock (confirmed: merged 2026-08-21T18:30Z, after both failing runs — v1.0.40-rc.1 ran 08-20T05:17Z, v1.0.40 ran 08-21T04:30Z — so neither failing run had it, and no tag has been re-cut since). That PR's own description flagged trimming appFiles as the "follow-up optimization" over just raising the cap, per its "Alternative" note.

Changes

  • todesktop.json: add exclusions to appFiles mirroring electron-builder.yml's already-proven-safe files list — src/**, e2e/**, docs/**, reference/**, .vscode/**, and the dev-only config files (playwright.config.ts, eslint.config.ts, electron.vite.config.*, vitest.*, tsconfig*.json, lint/format/env files, *.wsb). None of these are referenced by scripts/afterPack.mjs, scripts/todesktop-beforeBuild.cjs, or scripts/postinstall.mjs — ToDesktop's remote build only needs the pre-built out/, package.json, lib/, resources/, assets/, and locales/.

This is the root-cause trim rather than relying solely on the raised cap — it also restores headroom for the next asset-heavy feature instead of spending it all on removable dev files.

Verification

  • Confirmed the failure mode from check-runs annotations on the failing commit (Process completed with exit code 1 on "Build with ToDesktop") and by extracting the ToDesktop CLI's own size-check source (@todesktop/cli dist/cli.js): it zips appFiles and errors with Your app is larger than {uploadSizeLimit}MB when the total exceeds it — this matches chore: raise todesktop uploadSizeLimit to 60 MB #1437's description and James's number exactly (30 MB limit, ~46.2 MB actual).
  • Confirmed bootstrap-python/ (fetched fresh per-platform by ToDesktop's own beforeBuild hook, see scripts/todesktop-beforeBuild.cjs) is not part of the size-limited upload — it's excluded from appFiles and fetched separately on ToDesktop's build servers, so it's not a contributor here.
  • Ran todesktop build --config=todesktop.json --dry-run --files locally (@todesktop/cli@1.28.0, with stub out/main/index.js and bootstrap-python/* placeholders to satisfy path validation, since a full pnpm install couldn't complete in this sandbox — see caveat below):
    • Before this change: appFiles-selected archive = 947 files, 27 MB (19.3 MB compressed).
    • After this change: appFiles-selected archive = 93 files, 4.32 MB (2.54 MB compressed) — and the dry-run file listing confirms src/, e2e/, docs/, tsconfig*, eslint.config.ts, etc. no longer appear.
    • The real build additionally includes the compiled out/ bundle (a few MB of JS + the 12 MB public/ copy, which I could not produce here — see caveat), so the real uploaded size will land higher than 4.32 MB, but the ~23 MB removed from src/ alone is more than enough to bring the true ~46.2 MB upload back under the original 30 MB cap, well within the new 60 MB one.
  • npx prettier --check todesktop.json passes (matches this repo's format:check), and the file is valid JSON per the @todesktop/cli schema (no validation errors in the dry run).

Caveat: I could not run a full pnpm install / pnpm run build in this sandbox — pnpm install --frozen-lockfile fails fetching an unrelated transitive dependency (@electron/rebuild's @electron/node-gyp git tarball) that this sandbox's egress policy blocks, unrelated to this change. I was not able to get a real end-to-end todesktop build --dry-run number including the actual compiled out/ directory, or re-run CI on this branch. The before/after appFiles-only comparison above (27 MB → 4.32 MB) is real and reproducible, but the final total including out/ is an estimate, not a measured number.

The last two ToDesktop releases (v1.0.40-rc.1, v1.0.40) failed at the
"Build with ToDesktop" step because the uploaded app source archive
exceeded the CLI's uploadSizeLimit (30 MB at the time; ~46.2 MB
actual). #1437 already raised the limit to 60 MB as an immediate
unblock, but the upload was oversized to begin with because
todesktop.json's appFiles (`["**", ...]`) uploads almost the entire
repo, unlike electron-builder.yml's `files` list (which already
excludes src/, docs/, tsconfig, eslint/prettier config, etc. for the
same app).

Notably src/ alone is ~23 MB and includes src/renderer/public, whose
~10 MB of install-showcase-scene .webm assets (added in #1426) get
uploaded twice: once as source under src/, and again as the built
copy under out/renderer/ that electron-vite produces. None of src/,
e2e/, docs/, or the various dev-only config files are read by
ToDesktop's remote build (confirmed against scripts/afterPack.mjs,
scripts/todesktop-beforeBuild.cjs, and postinstall.mjs) — only the
pre-built out/ plus package.json, lib/, resources/, assets/, and
locales/ are needed.

Mirrors electron-builder.yml's proven-safe exclusions onto
todesktop.json's appFiles. Verified with
`todesktop build --dry-run --files` (via @todesktop/cli@1.28.0):
the appFiles-selected archive drops from 27 MB to 4.32 MB before
factoring in the real out/ build (which was stubbed for the dry
run), consistent with bringing the true ~46.2 MB upload back under
the original 30 MB limit with room to spare — on top of the 60 MB
headroom #1437 already added.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VfNkVLBPdy9Vj3oiRqorC
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