Registry Mirror
Skip to content

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Every server update downloads the whole Linux archive, and it had grown to about 218 MB. Close to 40 MB of that was files nothing in T3 Code can load. This change stops shipping them, which brings the archive down to about 179 MB (18% smaller) and changes nothing the app does.

  • wholeCjkFontsOnlyPlugin in apps/web/vite.config.ts (added for the main build and for worker builds): @betteroffice/fonts-cjk lists each Noto CJK face twice, as a whole .otf.zst and as about 130 progressive slices, roughly 27 MB each way. The Office previews only ever load whole faces through loadBundledFontBytes, so the plugin removes the slice entries from the package's URL map and Vite stops emitting them.
  • dropUnreferencedAssetsPlugin: Vite emits every WASM file that library code mentions, even after tree-shaking has removed the code that uses it. That shipped the Office lean pptx engine, the pptx and xlsx preflight modules and the metafile SVG engine. The plugin deletes hashed assets whose names appear in no emitted file. Unhashed assets such as the PDF.js decoders are left alone because they are looked up by name.
  • resolveFffNativeDependencies stages only @ff-labs/fff-bin-linux-*-gnu. Linux builds link glibc and the npm launcher already refuses musl hosts, so the musl binary could never load.

Fixes #46386

Reproduction on main

Commit origin/main 18757df. The server update path (apps/server/src/cloud/pinnedRuntime.ts, downloadArchive -> fetchNamedReleaseAsset) fetches the whole -linux-x64.tar.gz release asset, checks its SHA-256 against SHA256SUMS, then extracts it. There is no delta or partial path. I did not drive a real server update. I measured the artifacts that path downloads. (1) Sizes: I listed every linux-x64.tar.gz asset across 376 releases through the GitHub REST releases API. They were 64 MB through 20260921.2071, 72 MB on 0926, 86-88 MB on 1004, 93-94 MB on 1012-1024, 122 MB on 20261027.3748, 147-149 MB on 1106-1111, 182-187 MB on 1114-1126 (v0.1.10 and v0.1.13 stable are 182 and 185 MB), and 217 MB on 20261129.5438 through 20261130.5508. This matches the reporter's figures. (2) Download time: I fetched each archive 5 times with curl from github.com/pingdotgg/t3code/releases/download on this VM. 5508 (217,734,024 B): 0.760, 0.603, 0.582, 0.591, 0.552 s. Median 0.591 s, spread 0.55-0.76. 2071 (64,406,229 B): 2.80 (cold), 0.235, 0.283, 0.247, 0.265 s. Median 0.265 s. Throughput is about 370 MB/s on this VM, so the time is set by size alone. At the reporter's 7-12 MB/s, 218 MB takes 18-31 s and 64 MB takes 5-9 s, which matches their 31.7 s download_archive span against 1.2 s for install_archive. (3) Contents: I extracted both archives. Unpacked, 2071 is 206 MB (t3 binary 155, client 35, node_modules 17). 5508 is 517 MB (t3 167, client 192, node_modules 158). In 5508's client/assets: .wasm 63 MB raw (docx_edit_bg 23.2 MB, docx_parse_bg 9.8 MB, pptx_wasm 6.9 MB and pptx_wasm_lean 6.4 MB, xlsx_wasm 6.7 MB and xlsx_wasm_lean 5.8 MB). .zst 62 MB (Noto CJK otf.zst: SerifSC 8.7, SansSC 6.4, SansTC 4.5, JP 3.6, KR 3.4). heic-to ships twice (two 3.0 MB chunks with different hashes). Device .glb models about 12 MB. In node_modules: @transcribe-cpp 64 MB (linux-x64-cpu-vulkan/libggml-vulkan.so alone is 44 MB), @cursor sdk 38 MB, and @FF-Labs 22 MB with both fff-bin-linux-x64-gnu and fff-bin-linux-x64-musl. Both full and lean pptx/xlsx WASM are referenced: lean from spreadsheet.worker, full from the spreadsheet and presentation workers.

Evidence

Being captured: before and after in the real app. This section is filled in before the pull request can merge.

Tests

  • vp build in apps/web: succeeds. Emitted CJK slice files went from 648 to 0, the five whole .otf.zst faces remain, and the fonts-cjk URL map in the built chunk lists only those five
  • vp test run --project browser src/components/files/office/fonts.browser.test.ts src/components/files/office/slide-fonts.browser.test.ts src/components/files/office/word-document.browser.test.ts: 8 passed (includes loading Noto Sans JP whole for Yu Gothic, MS Gothic and the Japanese fallback)
  • vp test run scripts/build-desktop-artifact.test.ts scripts/build-cli-archive.test.ts: 60 passed (earlier pass, code unchanged since)
  • vp run check:changed: format, lint, knip, typecheck (2 packages) and tests all pass
  • Repacked the published 5508 linux-x64 archive with and without the payloads this branch drops: 217,791,722 B → 179,446,400 B

Not in this change

  • xlsx ships its lean WASM (5.8 MB raw) although nothing passes png: false to initWasm; dropping it means rewriting minified library code, which is better done upstream in @betteroffice/xlsx.
  • The whole CJK faces (26.7 MB) are used by the Office previews; loading them from a CDN or on demand from elsewhere would change offline behaviour.
  • transcribe-cpp's 44 MB libggml-vulkan.so is the GPU dictation backend; dropping it gives up a feature.
  • heic-to is bundled twice (main thread and the image decode worker); sharing it means restructuring that code.
  • Unused docxWorker-*.js and docx_query wasm (1.6 MB) are still emitted, apparently outside the main bundle the asset plugin sees.
  • @cursor/sdk ships both cjs and esm builds plus a bundled copy (22 MB); trimming it means patching a vendor package.
  • Making updates really fast regardless of size would take a delta or content-addressed update channel in cloud.pinned_runtime.download_archive, which is a redesign.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 30, 2026 23:21
The web build emitted every WASM asset referenced by library code before
tree-shaking, so the Office lean pptx engine, both preflight modules and
the metafile SVG engine shipped although no output file can load them.
A build plugin now removes hashed assets that no emitted file names.

Linux builds link glibc and the npm launcher already refuses musl hosts,
so staging fff's musl binary next to the gnu one only added weight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@betteroffice/fonts-cjk lists every CJK face both as one whole file and
as progressive slices, about 27 MB each. The Office previews load faces
whole through loadBundledFontBytes and never build a sliced provider,
so the slices were never fetched but still shipped in every server
update archive. Drop the slice entries from the package's URL map so
Vite stops emitting them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 30, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 30, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9be338f

Macroscope's review found this PR approvable — This trims unused build assets, duplicate CJK font slices, and musl binaries from release archives while retaining the existing loading paths. The changes introduce no product-default change or persistent-data operation.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The web build removes unreferenced emitted assets and progressive CJK font slices. Desktop dependency resolution now selects Linux GNU native packages without adding musl packages.

Changes: Web build assets

Layer / File(s) Summary
Remove unreferenced emitted assets
apps/web/vite.config.ts
A post-build plugin repeatedly removes unreferenced emitted .wasm, .js, and .mjs assets and their source maps.
Filter CJK font slices
apps/web/vite.config.ts
A transform removes progressive CJK font-slice entries and warns if it finds none. The config registers the transform and applies it to worker builds.

Linux native package selection

Layer / File(s) Summary
Select Linux GNU packages
scripts/build-desktop-artifact.ts, scripts/build-desktop-artifact.test.ts
Linux dependency resolution now selects GNU packages only. The Linux x64 expectation names the GNU package.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other · Severity of issue fixed: Medium

Suggested reviewers: yash-singh1

Merge Risk: Minimal · up to 9be33

This change shrinks the Linux server archive by dropping assets that the build output does not reference and by staging only the glibc native binaries. No concrete behavior regression was identified in the changed code, so merge risk is minimal. The author should still finish the real-app verification that was left pending.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(release): drop unloadable WASM and musl fff from server archives" matches the main change. The PR removes unreferenced WASM assets, progressive CJK font slices, and musl fff binaries fr…
Description check Passed The description follows the template and covers Problem, Change, Scope, and Verification. The Problem section states the 218 MB archive size and download-time impact. The Change section explains the t…
Linked Issues check Passed [#46386] The issue reports that the Linux x64 server archive grew from 64 MB to 218 MB and that each server update downloads the whole archive. It lists ideas for maintainers to weigh (dedupe full and…
Out of Scope Changes check Passed All changes support the archive-size objective of #46386. The two Vite plugins in apps/web/vite.config.ts reduce emitted payloads in the web client assets that the issue measured, and the CJK transfor…
Full details: Title check

Explanation

The title "fix(release): drop unloadable WASM and musl fff from server archives" matches the main change. The PR removes unreferenced WASM assets, progressive CJK font slices, and musl fff binaries from the Linux server archive. The title is specific, uses a conventional commit prefix, and does not cover every detail, which is acceptable.

Full details: Description check

Explanation

The description follows the template and covers Problem, Change, Scope, and Verification. The Problem section states the 218 MB archive size and download-time impact. The Change section explains the three plugins and the fff dependency change. The Scope section links issue #46386 and explains the payload-removal approach. The Verification section lists build, browser test, script test, and check results, plus archive size measurements. Two items remain open: the Evidence section says before/after capture is still in progress, and the template asks for before/after screenshots only for UI changes, which this PR does not make. The description is detailed and mostly complete, so it passes.

Full details: Linked Issues check

Explanation

[#46386] The issue reports that the Linux x64 server archive grew from 64 MB to 218 MB and that each server update downloads the whole archive. It lists ideas for maintainers to weigh (dedupe full and lean WASM, load fonts and WASM on demand, serve a delta). It does not require one approach or define acceptance tests. The PR implements three archive-size reductions in the Linux server archive path: (1) wholeCjkFontsOnlyPlugin in apps/web/vite.config.ts removes the 648 progressive CJK slice entries from the @betteroffice/fonts-cjk URL map, while the five whole faces stay for Office previews; (2) dropUnreferencedAssetsPlugin removes hashed WASM and JS assets that no emitted file names, which addresses unused full and lean WASM; (3) resolveFffNativeDependencies in scripts/build-desktop-artifact.ts stages only the glibc @ff-labs/fff-bin package, which removes the duplicate musl binary. The author reports the archive falls from 217,791,722 B to 179,446,400 B (about 18%). Deferred items (delta updates, on-demand fonts, heic-to duplication, libggml-vulkan.so, lean xlsx WASM) are not acceptance requirements. The real-app before and after evidence is pending. That is a verification gap, not a coding requirement. The musl-refusal rationale in the PR description was not verified by this review, and the size result is the author's measurement, not a re-run here.

Full details: Out of Scope Changes check

Explanation

All changes support the archive-size objective of #46386. The two Vite plugins in apps/web/vite.config.ts reduce emitted payloads in the web client assets that the issue measured, and the CJK transform is also applied to worker builds for the same font payload. The resolveFffNativeDependencies change in scripts/build-desktop-artifact.ts removes the musl @ff-labs/fff-bin package from the Linux merged stage. The one-line expectation change in scripts/build-desktop-artifact.test.ts supports that behavior. The summary states that macOS and Windows dependency selection is unchanged. No unrelated feature, refactor, or documentation change appears. This assessment relies on the summary and PR description. The claim that dropped hashed assets are never loaded by a computed name was not independently verified here.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 823229f and 9be338f.

Files selected for processing: 2

  • apps/web/vite.config.ts
  • scripts/build-desktop-artifact.test.ts
Files with no reviewable changes: 1

  • scripts/build-desktop-artifact.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member Author

The automated pipeline stopped on this pull request and will not merge it:

the capture step could not show the problem on the base commit, so there is nothing to prove fixed.

Built web with vp run --filter @t3tools/web build; built server with node apps/server/scripts/cli.ts build-exe and build; packaged with node scripts/build-cli-archive.ts --platform linux --arch x64 --version 0.1.13. Measured archive bytes and SHA-256, seven alternating tar -xzf runs per side, and executable version. Started each extracted t3 serve with isolated fresh state and requested / plus entry assets. Base archive: 217265385 bytes; head: 178832824 bytes (38432561 bytes / 17.7% smaller). Extraction base median 2.742923 s, range 2.511991–3.212316; head median 2.467109 s, range 2.286416–2.789673. Median improvement 0.275814 s is smaller than base spread 0.700325 s and head spread 0.503257 s. Both CLIs printed t3 v0.1.13; both servers returned HTTP 200 for HTML and entry assets. The reported update download was not driven.

It stays open for a person to finish or close.

@macroscopeapp
macroscopeapp Bot dismissed their stale review December 3, 2026 17:50

Dismissing prior approval to re-evaluate 9be338f

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Dec 3, 2026
@Yash-Singh1
Yash-Singh1 merged commit 9d6d77e into main Dec 3, 2026
38 checks passed
@Yash-Singh1
Yash-Singh1 deleted the factory/issue-46386 branch December 3, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server update archive grew from 64 MB to 218 MB in ten weeks, and each server update downloads all of it

2 participants