GeezerVison is showing github.com — perf(web): avoid downloading the HEIC decoder twice by voltcrash · Pull Request #30831 · pingdotgg/t3code
Conversation
voltcrash
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Previewing and attaching HEIC images downloads two near-identical decoder payloads. Emit the self-contained CSP decoder once and lazily import that asset from both environments. Preview encoding stays in its worker; attachment JPEG quality and all source/dimension limits stay unchanged.
Production builds reduce decoder JS from 5,991,454 to 2,995,463 bytes (gzip: 1,468,502 → 734,154). Chromium requested the decoder only once in either workflow order. Actual built attachment preparation and preview worker outputs were byte-identical across three public HEIC fixtures, including transparency. With CSP applied to worker responses too, baseline preview failed and this branch passed without enabling unsafe-eval. This suggests a desktop preview fix; Electron itself has not been tested.
Bundle, network, fixture hashes, and reproduction script.
Validation: vp run check:changed --concurrency 1 passes, including 19 attachment tests; focused AttachmentFilePreview.browser.test.tsx -t WhiteIsZero passes. Production builds pass on Linux ARM64.
Parent integrated verification on Linux ARM64 used the built-in Browser panel against an isolated vp run dev --no-seed server and a disposable project with a free Replay turn. HEIC file preview rendered a complete 64 × 64 PNG; uploading the alpha, colors, and example HEIC fixtures produced loaded thumbnails named heic-alpha.jpg, heic-colors.jpg, and heic-example.jpg. Exercised attachment then preview and preview then attachment. This checks dev-mode client wiring; the production/network and byte-equivalence evidence above remains separate.
Limits: the bitmap path may add one temporary RGBA frame (~128 MB at the existing 32 MP cap). Native Electron and a physically remote client remain untested; no full-app memory/startup savings are claimed.
Submitted under the small, focused obvious-bug exception for the demonstrated avoidable duplicate payload; no upstream maintainer approval is claimed.
Reviewed with review-loop: 1 round with Claude Opus 5.5 on xhigh. Reviewer verdict: approved.
Created with GPT-6.1 Sol in the Codex harness.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — The change shares one HEIC decoder asset while retaining image limits and output formats. It also adds @vite-ignore in heicDecoder.ts, suppressing Vite’s dynamic-import analysis warning and requiring human review of that exception.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resume to resume automatic reviews.
@coderabbitai review to trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
HEIC conversion now loads the decoder through a shared helper. The image decode worker draws decoded bitmaps to a canvas, closes them in a finally block, and returns PNG blobs. The browser test dependency list no longer includes heic-to/csp.
Changes: HEIC Conversion
| Layer / File(s) |
Summary |
Shared decoder loading apps/web/src/lib/heicDecoder.ts, apps/web/src/lib/imageCompression.ts, apps/web/src/lib/imageCompression.test.ts, apps/web/vite.config.ts |
Adds loadHeicDecoder() and uses it in image compression. The test mocks the local helper. The browser test dependency list removes heic-to/csp. |
Worker bitmap conversion apps/web/src/components/files/imageDecode.worker.ts |
The worker loads the decoder through the helper, draws the decoded bitmap to a canvas, closes it in a finally block, and returns a PNG blob. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related PRs
Suggested reviewers: yash-singh1, maria-rcks
Merge Risk: Minimal · up to 7fe7c
-
This change shares one HEIC decoder asset between preview and attachment conversion to avoid a duplicate download. No concrete defect was found, and the main residual gap is the lack of a dedicated repository HEIF/CSP regression test. Merge risk is minimal.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title "perf(web): avoid downloading the HEIC decoder twice" matches the main change. The diff makes preview and attachment paths share one self-contained HEIC decoder asset via loadHeicDecoder, re… |
| Description check |
 |
The description follows the template sections. Problem: duplicate HEIC decoder payloads. Change: one CSP decoder asset lazily imported from both environments. Scope: an obvious-bug exception is claime… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title "perf(web): avoid downloading the HEIC decoder twice" matches the main change. The diff makes preview and attachment paths share one self-contained HEIC decoder asset via loadHeicDecoder, removing a duplicate download. It uses a conventional commit prefix and plain language.
Full details: Description check
-
Explanation
The description follows the template sections. Problem: duplicate HEIC decoder payloads. Change: one CSP decoder asset lazily imported from both environments. Scope: an obvious-bug exception is claimed with no upstream approval, and the reason is stated. Verification: detailed tests, byte-equivalence, bundle size, and browser checks are reported, plus untested areas (native Electron, remote clients, memory). The description is mostly complete. Some points rely on external evidence and a reviewer-loop note that is not template content.
Finishing Touches
-
Generate unit tests (beta)
-
- 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 7ba2894 and 7fe7c88.
Files selected for processing: 3
-
apps/web/src/components/files/imageDecode.worker.ts
apps/web/src/lib/imageCompression.ts
apps/web/vite.config.ts
Files with no reviewable changes: 1
-
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
maria-rcks
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Takeover update
- merged
main at 17a6a01d84 into the head with a merge commit (1da281b8d1). one conflict in apps/web/src/lib/imageCompression.ts: fix(web): preserve previews during attachment preparation #33949 moved heic conversion into convertHeicImage. kept main's version and pointed its heic-to/csp fallback at loadHeicDecoder(), so both paths still share one decoder asset. no other code changes.
- blacksmith:
vp run check:changed passed (format, lint, knip, typecheck, tests, react compiler). imageCompression.test.ts 20/20. vp build for apps/web emits one heic-to-*.js asset.
- coderabbit's heif/csp browser-test request stays out of scope: this pr changes no csp policy, and the linked reproduction covers the worker path.
- not re-verified in a browser after the merge. the earlier verification below covers the pre-merge head.
Note Written by gpt-6.1-sol on behalf of Maria
Verified in a real dev environment
verified unchanged head 0e93739584d58b382c63e63463e16d8d16a56c55 on linux with repo playwright and /usr/bin/google-chrome.
- reproduced duplicate decoder downloads on
github/main at 9e85538535c8553901351112ab02dd1dd62db5ee in a separate worktree before exercising this head. ran vp i and background dev servers sequentially with isolated state.
- created the project and threads through the app against a real git repository. opened the original 1280 × 854 heic from a real codex response link, uploaded the same photograph through the composer, and sent the converted jpeg to codex
gpt-6.1-sol. the provider correctly described the riverside houses and church tower on both main and this head.
- exercised preview then attachment and attachment then preview. decoded preview pixels have the same sha256 on both:
7f8f77c3e33f64338ebea81ce0102de5a0cf132061bef3176cad0373d7bada3b.
- neighboring behavior passed: png file preview and attachment intake, attachment removal, preview zoom/fit, and a subsequent text-only codex turn.
- built both web clients through blacksmith and served each build through its actual running t3 server. repeated both workflow orders on the pr build, including another real image turn. network observations show one decoder transfer and cache reuse, rather than two distinct decoder transfers.
production browser network transcript, with response transfer bytes including headers:
main: preview -> attachment
14:45:13.822 heic-to-VOBAXtBH.js 200 decoded=2996227 transferred=681190
14:45:14.092 heic-to-DeD09f__.js 200 decoded=2995227 transferred=680459
pr: preview -> attachment
14:43:30.284 heic-to-Cb5hlEoT.js 200 decoded=2995463 transferred=680474
14:43:30.572 heic-to-Cb5hlEoT.js 200 decoded=2995463 transferred=0
pr: attachment -> preview
14:46:19.229 heic-to-Cb5hlEoT.js 200 decoded=2995463 transferred=680474
14:46:20.748 heic-to-Cb5hlEoT.js 200 decoded=2995463 transferred=0
blacksmith: vp run check:changed 8b44f42b14c8e273156474a924ccf29680dd7857 --concurrency 1
pass: format, lint, both knip passes, affected typechecks, 19 imageCompression tests, 3 react compiler cases
main, original file preview and converted attachment:

pr, the same photograph and workflow:

Not verified
native electron, ios/android, macos/windows, physically remote clients, and strict worker csp were not exercised. this pass used one real heic photograph; transparency, multi-frame inputs, and large-image memory behavior were not measured. no startup or memory improvement is claimed. no code changes were needed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional comments: 1
-
apps/web/src/lib/imageCompression.ts: 1
-
512-512: Trivial · Functional Correctness · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Test the real decoder fallback in a browser.
imageCompression.test.ts mocks loadHeicDecoder, so it cannot detect a failed asset import or a missing heicTo export. Either failure makes fallback attachments unreadable. Add a browser test that forces the native decode fallback and converts a HEIC fixture using the real loader.
As per coding guidelines, “Test behavior that can break, such as … external-format parsing.”
Source: Coding guidelines
Review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between ec7855f0c635c23d53c49dad58e2c9a5949a21f3 and 1da281b8d1ca7ae0359dada96045ee69375e1ba5.
Files selected for processing: 1
-
apps/web/src/lib/imageCompression.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
- Permanent blocker: a Linux ARM64 execution environment is required for the requested platform-matched comparison; this VM is Linux x86_64 and accessing another machine is prohibited.
- Base slowness, head improvement beyond run-to-run spread, decoder transfers, production bundle sizes, and equivalent image outputs were not measured. Both verdict flags are false because no qualifying comparison ran.
It stays open for a person to finish or close.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.
See the conflict window.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|