Repository navigation
perf(packaging): prune Linear SDK source maps after packaging - #17530
Conversation
Greptile SummaryThe PR reduces packaged application size by removing JavaScript source maps specifically from the packaged
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| config/packaged-runtime-node-modules.cjs | Adds a narrowly scoped post-packaging cleanup that removes .js.map, .cjs.map, and .mjs.map files beneath the packaged Linear SDK. |
| config/scripts/packaged-linear-sdk-prune.test.mjs | Verifies direct and aggregate pruning while preserving SDK runtime exports, package metadata, non-JavaScript maps, and unrelated packages. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Electron afterPack] --> B[Aggregate runtime cleanup]
B --> C[Locate packaged @linear/sdk]
C --> D{Package exists?}
D -- No --> E[Return]
D -- Yes --> F[Walk package files]
F --> G{JavaScript source map?}
G -- Yes --> H[Remove file]
G -- No --> I[Preserve file]
Reviews (2): Last reviewed commit: "Merge branch 'main' into nwparker/pr-siz..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe packaging module adds Merge Risk: ⚪ Minimal · up to The package keeps all executable Linear SDK files and metadata while removing only unused JavaScript source maps from newly built application artifacts, reducing package size without changing runtime behavior. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the change, purpose, impact, measurements, risks, and validation. However, it omits several required template sections, including the linked issue, visual proof or an explicit N/A statement, AI disclosure, review, agent skill upstream boundary, and checklist items. Resolution Add the required template sections. Include a linked issue under "Linked Issue" using "Fixes #..."; add "N/A" with a reason under "Visual Proof"; complete or explicitly address AI Disclosure, Review, Agent skill upstream boundary, and Checklist sections; and use the required "Testing" section to list automated and manual test coverage and platforms tested.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Readiness checklist review — PASSReviewed all 8 sections. No proven P0/P1/P2 findings.
ELI5: delete debugger notes the app never reads, keep the executable SDK code and package labels. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Linear SDK source-map prune —
config/packaged-runtime-node-modules.cjsaddsprunePackagedLinearSdkSourceMaps, which recursively removes.js/.cjs/.mjssource maps undernode_modules/@linear/sdk, wires it intoprunePackagedRuntimeNodeModules(the electron-builderafterPackstep), and exports it for tests. - Focused test coverage —
config/scripts/packaged-linear-sdk-prune.test.mjsbuilds a realistic SDK fixture (CJS/ESM entries, webhooks, a non-JS.json.map, and an unrelated package's map) and asserts exact post-prune directory contents plus a runtimerequire('@linear/sdk')load check; a second case exercises the full aggregate cleanup path.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
CI status noteAll eight test shards, typecheck, package, package (Windows), guards, and both automated code reviews pass. The remaining static-analysis failure is the unchanged baseline |
…17641) `serializes FETCH_HEAD callers before they enter admission` assumed that two same-repo fetches join the FETCH_HEAD lock lane in call order. They do not. `runWithGitFetchHeadLock` first `await`s `fetchLockPath`, which walks the filesystem (`realpath`, `stat` per parent directory, `readFile` of `commondir`, `realpath` again) before it calls `runWithGitOperationLock`, and the lane is registered only after that walk resolves. For a non-existent `/repo` that is five libuv threadpool round-trips per caller. Two callers issued back to back run their chains concurrently, so lane order is threadpool completion order, not call order. When the `interactive` fetch won that race it entered the lane ahead of the `background` fetch. On the first caller's release it reached admission immediately and, being interactive, took the free network headroom slot instead of queueing, while the background fetch stayed parked on the lock. `queued` therefore settled at 0 and never reached the asserted 1. Measured inversion rate for the bare lock-path walk was 54/500 on an idle machine; the test itself failed 5/20 locally, always at the same assertion, matching the two CI failures on unrelated PRs (#17530, #17630) at the same line. Fix the premise rather than the symptom: stub only the key derivation, keeping the real FIFO `runWithGitOperationLock` that the test actually exercises, so the lane is registered synchronously with the call. Key derivation keeps its own coverage in `src/shared/git-fetch-head-lock.test.ts`. This also stops the fetch tests in this file from sharing one global `/.git/FETCH_HEAD` lane with each other and from touching the real filesystem. Verified deterministic: 40/40, then 30/30 clean runs, plus 25/25 with twelve CPU hogs and a concurrent `src/main/git/command-runner/` run saturating the box.
…tablyai#17641) `serializes FETCH_HEAD callers before they enter admission` assumed that two same-repo fetches join the FETCH_HEAD lock lane in call order. They do not. `runWithGitFetchHeadLock` first `await`s `fetchLockPath`, which walks the filesystem (`realpath`, `stat` per parent directory, `readFile` of `commondir`, `realpath` again) before it calls `runWithGitOperationLock`, and the lane is registered only after that walk resolves. For a non-existent `/repo` that is five libuv threadpool round-trips per caller. Two callers issued back to back run their chains concurrently, so lane order is threadpool completion order, not call order. When the `interactive` fetch won that race it entered the lane ahead of the `background` fetch. On the first caller's release it reached admission immediately and, being interactive, took the free network headroom slot instead of queueing, while the background fetch stayed parked on the lock. `queued` therefore settled at 0 and never reached the asserted 1. Measured inversion rate for the bare lock-path walk was 54/500 on an idle machine; the test itself failed 5/20 locally, always at the same assertion, matching the two CI failures on unrelated PRs (stablyai#17530, stablyai#17630) at the same line. Fix the premise rather than the symptom: stub only the key derivation, keeping the real FIFO `runWithGitOperationLock` that the test actually exercises, so the lane is registered synchronously with the call. Key derivation keeps its own coverage in `src/shared/git-fetch-head-lock.test.ts`. This also stops the fetch tests in this file from sharing one global `/.git/FETCH_HEAD` lane with each other and from touching the real filesystem. Verified deterministic: 40/40, then 30/30 clean runs, plus 25/25 with twelve CPU hogs and a concurrent `src/main/git/command-runner/` run saturating the box.

What this changes
After electron-builder copies the runtime closure, remove only JavaScript source-map files under
Resources/node_modules/@linear/sdk. Runtime CJS/ESM files, package metadata, exports, webhooks, and non-JavaScript maps remain untouched.ELI5
Source maps are debugger notes, not code the app runs. The Linear SDK ships several megabytes of those notes. This PR removes only those notes after packaging, leaving the executable SDK files in place.
Measurement (macOS arm64, unpacked
dist/mac-arm64/Orca.app).js.map,.cjs.map, or.mjs.mapfiles.index.mjs.map(6,819,500 B) andwebhooks-Bbhy0Mv8.mjs.map(15,029 B).Crash-report/debugability
The app’s own crash reports are unchanged. This package-level cleanup can only affect opt-in source-map remapping for Linear SDK frames; normal CJS execution and the existing
errorStack,componentStack, breadcrumb, and minidump paths do not load these files. The test preserves runtime CJS/ESM exports and explicitly leaves unrelated/non-JavaScript maps intact.Readiness checklist
Reviewed against all eight sections:
path.join; cleanup is target-independent and stays inside the packaged runtime closure.Verdict: PASS. No proven P0/P1/P2 findings. Residual risk is limited to source-map remapping for opt-in SDK debugging.
Validation
pnpm run tc:node, changed-file lint/format checks, andgit diff --checkpassed.