Skip to content

fix(sourcemaps): split web into eager chunks under the map cap, skip maps with no sources - #3031

Merged
Makisuo merged 1 commit into
mainfrom
t3/check-source-map-enw
Nov 24, 2026
Merged

Makisuo merged 1 commit into
mainfrom
t3/check-source-map-enw

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Why

Source maps are not working in prod yet:

  • Every prd deploy that builds web since the upload key landed (e21dbd, 9cdaa4, US and EU) ends red. The web-sourcemaps resource fails on a 400 SourceMapInvalidError: the prebuilt elk worker's map lists no sources, which the server refuses. The Workers still deploy, but the run fails.
  • The index chunk's map is 37.5 MiB, over the 10 MiB upload cap, so it is skipped. That is the chunk most dashboard stacks point at, so every prd symbolication so far ended missing_map.

What

  • apps/web/vite.config.ts: eager code-split groups (vendor, kit, app), up to 2.5 MB each. Nothing is lazy-loaded; every chunk is a modulepreload.
    • entriesAware keeps boot off the app's chunks, so the early Clerk start still loads only a 10 KB shared chunk.
    • strictExecutionOrder keeps module init order across the chunks. Without it the app threw j is not a function at startup.
  • Uploader: a map with no mappings string or no sources is skipped with a warning, like the oversized and index maps already are, instead of failing the deploy.

Evidence

Local production build of apps/web:

before after
Largest map 37.5 MiB (index) 4.4 MiB (elk, unchanged)
Maps over 10 MiB 1 0
JS files / modulepreload links 52 / 23 98 / 61
Total JS, gzip 4.64 MiB 4.71 MiB

Load A/B: both builds served over local HTTP/2 with gzip, headless Chromium, external requests blocked, interleaved runs, median of 9. "Mounted" is when the boot shell is replaced by the sign-in page.

profile build cold mounted warm mounted
no throttle before 822 ms 611 ms
no throttle after 570 ms 252 ms
4G + 4x CPU before 5983 ms 5053 ms
4G + 4x CPU after 5558 ms 4293 ms
  • The new uploader test fails without the fix and passes with it.
  • tsrs typecheck (web, alchemy-maple) and the effect oxlint config are clean.

Still to check

The real upload and symbolication happen on the next prd deploy. This PR has no preview:web label: previews have no upload key and do not upload. After merge, check the deploy log for Uploaded N source map(s) and the StackSymbolicator.symbolicate spans for maple.stack.status.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Devin Review

Summary by CodeRabbit

  • Improvements
    • Production build output is now organized more consistently, with execution order preserved.
    • Source maps that contain no source files are skipped during processing, helping prevent issues with bundled worker assets.
    • Existing build manifest generation remains enabled.

…maps with no sources

The web index chunk's map was 37.5 MiB, over the 10 MiB upload cap, so the main bundle never
symbolicated. Eager code-split groups (vendor, kit, app; up to 2.5 MB each, entry aware, strict
execution order) keep every map under 4.5 MiB with nothing lazy-loaded.

A prebuilt worker's map lists no sources; the server refused it and failed every prd deploy that
built web. The uploader now skips such maps with a warning.
@maple-review-bot

maple-review-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 8/10 · likely safe to merge. The uploader skip is pinned by a test and matches the server's rule; the bundle-layout change and the CLI copy of the rule are only covered by hand.
1 warning −1 · tests partial −1 · risk medium

Eager chunk splitting keeps every apps/web source map under the 10 MiB cap, and the deploy uploader now skips maps with no sources instead of failing on the server's 400. The uploader change is tested; the new bundle layout is verified by hand only.

  • Web build splits into eager vendor/kit/app chunks capped at 2.5 MB
  • strictExecutionOrder keeps module init order across the new chunks
  • SourceMaps skips a map with no mappings string or no sources
  • mapsNoSources exported from @maple/sourcemaps for callers to share

Before merge

  • Manual · Watch the next prd deploy log for Uploaded N source map(s) and maple.stack.status on StackSymbolicator.symbolicate spans

Findings

🟠 Warning · F1 · New no-sources skip missing from maple sourcemaps upload

maintainability · packages/sourcemaps/src/inject.ts:170-178

The upload rule now exists in two copies and only this PR's copy learned it. apps/cli/src/core/sourcemaps-upload.ts:174 still checks just isIndexMap, so the CLI keeps posting the elk worker's source-less map, the server's 400 becomes SourceMapUploadError, and the command exits ${n} source map upload(s) failed (apps/cli/src/commands/sourcemaps.ts:129).

Import `mapsNoSources` in `apps/cli/src/core/sourcemaps-upload.ts` and return a `skipped` outcome with the same reason beside its `isIndexMap` check, with a test case for a `sources: []` map.
🤖 Prompt to fix this finding with an AI agent
Findings from an automated review of commit 352d7cac9a18aaf1dbc7752a6fe91d93febd5e7c. Verify each one against the current code before changing anything, fix only those that still apply, and keep each fix to the lines it names.

---

F1 · Warning · maintainability · packages/sourcemaps/src/inject.ts:170-178
New no-sources skip missing from `maple sourcemaps upload`
The upload rule now exists in two copies and only this PR's copy learned it. `apps/cli/src/core/sourcemaps-upload.ts:174` still checks just `isIndexMap`, so the CLI keeps posting the elk worker's source-less map, the server's 400 becomes `SourceMapUploadError`, and the command exits `${n} source map upload(s) failed` (`apps/cli/src/commands/sourcemaps.ts:129`).
Suggested fix: Import `mapsNoSources` in `apps/cli/src/core/sourcemaps-upload.ts` and return a `skipped` outcome with the same reason beside its `isIndexMap` check, with a test case for a `sources: []` map.

352d7ca · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Vite build configuration now defines output splitting groups. Source-map processing now skips maps with no sources, using a new helper and an added test fixture.

Changes: Web Build Output

Layer / File(s) Summary
Rolldown output splitting
apps/web/vite.config.ts
The build config sets strict execution order and entry-aware splitting groups for vendor, kit, and app modules. Each group has a 2,500,000-byte maximum. The manifest setting remains enabled.

Source Map Filtering

Layer / File(s) Summary
Detect and skip maps without sources
packages/sourcemaps/src/inject.ts, packages/alchemy-maple/src/SourceMaps.ts, packages/alchemy-maple/test/source-maps.test.ts
mapsNoSources checks plain-map fields and returns false for invalid JSON or index maps. skipReason uses the helper and decodes map bytes once. The test fixture adds a map with an empty sources array.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Possibly related PRs

  • MapleTechLabs/maple#3020: Adds source-map upload and symbolication behavior that shares the uploaded-map data contract with these source-map changes.
Merge Risk: Minimal · up to 352d7

The change splits web build output into smaller chunks so source maps fit under the upload cap. It also makes the uploader skip empty maps with a warning instead of failing the deploy. No concrete merge-blocking risk was found. Check the next production deploy log to confirm that maps upload.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes in the PR: splitting the web bundle into eager chunks under the source-map size cap, and skipping source maps that have no sources. The raw summary covers both the…
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.
Full details: Title check

Explanation

The title names the two main changes in the PR: splitting the web bundle into eager chunks under the source-map size cap, and skipping source maps that have no sources. The raw summary covers both the vite.config.ts chunking change and the SourceMaps.ts/mapsNoSources skip logic, so the title matches the main changeset. The title is long (89 characters, 15 words) but it is specific and not vague.

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

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e0b55ea-31e3-4b97-97ac-e17388cda0e2
Commits

Reviewing files that changed from the base of the PR and between 7ef357a and 352d7ca.

Files selected for processing: 4

  • apps/web/vite.config.ts
  • packages/alchemy-maple/src/SourceMaps.ts
  • packages/alchemy-maple/test/source-maps.test.ts
  • packages/sourcemaps/src/inject.ts

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

@Makisuo Makisuo added the preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md label Nov 24, 2026
@Makisuo
Makisuo deployed to preview-tinybird November 24, 2026 23:35 — with GitHub Actions Active

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@maple-review-bot maple-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 inline note from Maple's review. The score and summary are in the review comment above.

* Whether a plain map has no `mappings` string or no sources, which the server refuses. A prebuilt
* worker's map can list none.
*/
export const mapsNoSources = (mapText: string): boolean =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

New no-sources skip missing from maple sourcemaps upload

F1 · Warning · maintainability

The upload rule now exists in two copies and only this PR's copy learned it. apps/cli/src/core/sourcemaps-upload.ts:174 still checks just isIndexMap, so the CLI keeps posting the elk worker's source-less map, the server's 400 becomes SourceMapUploadError, and the command exits ${n} source map upload(s) failed (apps/cli/src/commands/sourcemaps.ts:129).

Import `mapsNoSources` in `apps/cli/src/core/sourcemaps-upload.ts` and return a `skipped` outcome with the same reason beside its `isIndexMap` check, with a test case for a `sources: []` map.
🤖 Prompt to fix with an AI agent
In `packages/sourcemaps/src/inject.ts:170-178`: New no-sources skip missing from `maple sourcemaps upload`.

The upload rule now exists in two copies and only this PR's copy learned it. `apps/cli/src/core/sourcemaps-upload.ts:174` still checks just `isIndexMap`, so the CLI keeps posting the elk worker's source-less map, the server's 400 becomes `SourceMapUploadError`, and the command exits `${n} source map upload(s) failed` (`apps/cli/src/commands/sourcemaps.ts:129`).

Suggested fix: Import `mapsNoSources` in `apps/cli/src/core/sourcemaps-upload.ts` and return a `skipped` outcome with the same reason beside its `isIndexMap` check, with a test case for a `sources: []` map.

Verify the problem exists at that location before changing it, and keep the fix to those lines.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🍁 Maple PR preview

Note

Preview resources were removed when the preview label came off.

Final commit 352d7ca · View workflow run

@Makisuo Makisuo removed the preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md label Nov 24, 2026
@Makisuo
Makisuo deployed to pr-preview November 24, 2026 23:42 — with GitHub Actions Active
@Makisuo
Makisuo deployed to preview-tinybird November 24, 2026 23:42 — with GitHub Actions Active
@Makisuo
Makisuo merged commit 7e47d28 into main Nov 24, 2026
56 of 57 checks passed
@Makisuo
Makisuo deleted the t3/check-source-map-enw branch November 24, 2026 23:46
@maple-review-bot

Copy link
Copy Markdown

Merged with 1 step from "Before merge" still open. If it is done, tick it on the review comment; if not, now is the time.

  • Manual · Watch the next prd deploy log for Uploaded N source map(s) and maple.stack.status on StackSymbolicator.symbolicate spans

This branch was successfully deployed

2 active deployments
pr-preview — 352d7cac Deployed Nov 24, 2026 by Makisuo via deploy-pr-preview #15208
preview-tinybird — 352d7cac Deployed Nov 24, 2026 by Makisuo via branch #4828
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