Repository navigation
feat(cli,browser): maple sourcemaps inject/upload and exception debug ids - #3021
Confidence 6/10 · 1 issue to address
🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open.
1 warning −1 · 1 note · tests covered · risk medium · 3/4 new units observable −1
Adds maple sourcemaps inject/upload, a Vite plugin plus Maple.SourceMaps resource that move and upload maps, and a source-mapped stack trace on the error issue page. The CLI and SDK parts look sound; the panel's "Raised at" now names the wrong frame.
injectDirectorygives each built JS file a sha256 debug id and shifts the map's mappingsmapleSourceMaps()andMaple.SourceMapsrelocate maps out of the output and upload them- The error issue panel renders symbolicated frames with a Raw toggle
- Exception events carry
maple.exception.debug_ids
Before merge
- Secret · Create
MAPLE_SOURCEMAPS_API_KEYin the prd Infisical environment (prd only, consumerweb) and runbun run secrets:drift·packages/infra/src/secrets.ts:163 - Infra · Check every environment has what this config now expects ·
alchemy.run.ts
Findings
🟠 Warning · F6 · mappedTopFrame shows a caller under the "Raised at" label
correctness · apps/web/src/page/errors/issue/view-overview.ts:50-54
The old value, issue.topFrame, is the stack's first frame — the raise site (packages/domain/src/clickhouse/migrations/0003_error_events_label.ts:24). Arr.findFirst(stack.frames, (f) => f.in_app) skips it: an error thrown inside a dependency renders its caller as "Raised at", and the "top frame" copy button copies the caller.
Use `stack.frames[0]` for the raise site; keep the first in-app frame only for which row opens by default.
🔵 Note · F7 · A prd deploy with no commit sha uploads nothing while still matching by release
correctness · packages/infra/src/cloudflare/self-source-maps.ts:46-48
commitSha falls back to "", so release is dropped here while matchBy: "release" stays, and skipReason (packages/alchemy-maple/src/SourceMaps.ts:191) then skips every map. The deploy goes green with uploaded: 0 and only a log warning, so that build's errors stay minified.
Declare no `Maple.SourceMaps` when `release === ""`, or fail with a message naming the missing commit sha.
Production impact
Production traffic of the changed files (last 7 days)
| File | Calls/day |
|---|---|
packages/alchemy-maple/src/MapleApi.ts |
4.6k |
packages/infra/src/secrets.ts |
4.3k |
apps/web/vite.config.ts |
178 |
packages/alchemy-maple/src/Vite.ts |
77 |
What was checked
skipReasondrops index maps, maps over the cap and id-less maps without a release (SourceMaps.ts:187)- Inject writes the map before the JS, through a temp file and rename (
inject.ts:308,355) debugIdsOfrebuilds its url map only when the registry key count changes (debug-ids.ts:17)
Observability coverage: 3 of 4 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
maple sourcemaps inject/upload commands |
CLI command | no | No span or usage metric; writes to the CLI's stdout printer only, as the rest of apps/cli does |
Maple.SourceMaps provider |
deploy resource | yes | Effect.logWarning/logInfo per skipped map and per upload, failures through the resource engine (SourceMaps.ts:238, 268, 284) |
mapleSourceMaps() Vite closeBundle |
build hook | yes | this.info reports the moved/relocated counts and a failure fails the build (Vite.ts:108) |
maple.exception.debug_ids attribute |
OTel span event attribute | yes | Set on the exception event in packages/browser/src/sdk/span.ts:267 |
8e3e728 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Annotations
Check warning on line 54 in apps/web/src/page/errors/issue/view-overview.ts
maple-review-bot / Maple / review
correctness: `mappedTopFrame` shows a caller under the "Raised at" label
The old value, `issue.topFrame`, is the stack's first frame — the raise site (`packages/domain/src/clickhouse/migrations/0003_error_events_label.ts:24`). `Arr.findFirst(stack.frames, (f) => f.in_app)` skips it: an error thrown inside a dependency renders its caller as "Raised at", and the "top frame" copy button copies the caller.
Check notice on line 48 in packages/infra/src/cloudflare/self-source-maps.ts
maple-review-bot / Maple / review
correctness: A prd deploy with no commit sha uploads nothing while still matching by release
`commitSha` falls back to `""`, so `release` is dropped here while `matchBy: "release"` stays, and `skipReason` (`packages/alchemy-maple/src/SourceMaps.ts:191`) then skips every map. The deploy goes green with `uploaded: 0` and only a log warning, so that build's errors stay minified.