Repository navigation
feat(web): source-mapped stack trace on the error issue page - #3022
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
Devin Review found 2 potential issues.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
… unmapped files in the page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…m a mapped top frame; reset rows on a new stack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
…erently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Maple review note (a re-symbolicated stack with the same text keeps stale rows): fixed in a6d2c73. The rows now reset when the mapped stack changes as well as the raw text, for example after a map is uploaded between loads. The scene test "a different stack arriving resets the rows the reader flipped" covers it. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Maple review note F3 (a long frame function name is clipped): fixed in 19a9787. The function name now wraps ( |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…s own maps on deploy (#3028) * feat(alchemy): Vite source map plugin, Maple.SourceMaps resource, web uploads its maps - @maple/sourcemaps: the inject core moved out of the CLI (debug ids, prepend with the map shift, x_maple_shifted, safe paths, failed-write convergence), Bun-free, plus relocating maps out of a build with a manifest. The CLI re-exports it unchanged. - @maple-dev/alchemy/vite: mapleSourceMaps() turns on hidden maps, injects debug ids into the client output and moves the maps to .maple/sourcemaps/<outDir> with maple-sourcemaps.json. - Maple.SourceMaps uploads a map directory through POST /v2/source_maps (debug id, else service + release), re-uploading only when a digest of the maps changes; delete keeps the maps. - web builds with the plugin and the prd deploy uploads its maps as maple-web at VITE_COMMIT_SHA, through the new prd-only MAPLE_SOURCEMAPS_API_KEY (a no-op without it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(alchemy): safe map relocation, multi-output builds, release-matched uploads - A maps dir that is, holds or sits inside a build output is refused before any file is touched, and only the files the previous manifest listed are removed, never the whole dir. - The Vite plugin collects every output a build writes and relocates them once in closeBundle, under one manifest. - Maple.SourceMaps takes `matchBy: "release"`: uploads without debug ids (query and map body), so each release keeps its own map; web's dogfood uses it, as its telemetry sends no debug ids. - A deploy whose build was skipped logs that no maps were found; the README and plugin docs cover the first-upload timing and the one-release cached-chunk transition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… ids (#3021) * feat(cli,browser): maple sourcemaps inject/upload and exception debug ids Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): debug ids over JS and map, register before app code, safe map paths - The debug id hashes the JS file and its map (without its own debug id fields), so identical JS with another map gets another id; ids from existing comments or registrations are kept. - The registration snippet goes on a new first line and the map's mappings shift one line, so a throw during evaluation still reports the id; shebangs, directive prologues, index maps and shared maps keep the append. - A map shared by several JS files never gets an id; it is uploaded once per file with that file's id and path. - `upload` reads the release from the build directory's git checkout and fails when every map was skipped. - A map outside the build directory (.., absolute or symlink) or one that is not a version 3 JSON object is skipped with a warning and never rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): skip source maps over 10 MiB, the server's new upload cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): skip index source maps at upload, which the server now refuses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(browser): count registered debug ids before building entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): read a file's directive prologue without a backtracking pattern Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): write the map before the JS, move it once, take the size cap from the domain - inject writes the map atomically (temp file + rename) before the JS, and marks a map it moved (`x_maple_shifted`), so a failed write converges on the next run and never moves it twice; a registered file whose map lacks its id is repaired. - The upload size cap is `SOURCE_MAP_MAX_BYTES` from the domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cli): use effect String helpers in the inject failure test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cli): run command-level tests in the CLI test task Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): source-mapped stack trace on the error issue page (#3022) * feat(web): source-mapped stack trace on the error issue page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): use Arr.findFirst for the mapped top frame Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): say a file did not map rather than that no map exists, list unmapped files in the page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): highlight stack frame code with Pierre; Raised at only from a mapped top frame; reset rows on a new stack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): reset stack rows when the same stack comes back mapped differently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(views): let a long frame function name wrap instead of clipping Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(alchemy): Vite plugin and Maple.SourceMaps resource, upload web's own maps on deploy (#3028) * feat(alchemy): Vite source map plugin, Maple.SourceMaps resource, web uploads its maps - @maple/sourcemaps: the inject core moved out of the CLI (debug ids, prepend with the map shift, x_maple_shifted, safe paths, failed-write convergence), Bun-free, plus relocating maps out of a build with a manifest. The CLI re-exports it unchanged. - @maple-dev/alchemy/vite: mapleSourceMaps() turns on hidden maps, injects debug ids into the client output and moves the maps to .maple/sourcemaps/<outDir> with maple-sourcemaps.json. - Maple.SourceMaps uploads a map directory through POST /v2/source_maps (debug id, else service + release), re-uploading only when a digest of the maps changes; delete keeps the maps. - web builds with the plugin and the prd deploy uploads its maps as maple-web at VITE_COMMIT_SHA, through the new prd-only MAPLE_SOURCEMAPS_API_KEY (a no-op without it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(alchemy): safe map relocation, multi-output builds, release-matched uploads - A maps dir that is, holds or sits inside a build output is refused before any file is touched, and only the files the previous manifest listed are removed, never the whole dir. - The Vite plugin collects every output a build writes and relocates them once in closeBundle, under one manifest. - Maple.SourceMaps takes `matchBy: "release"`: uploads without debug ids (query and map body), so each release keeps its own map; web's dogfood uses it, as its telemetry sends no debug ids. - A deploy whose build was skipped logs that no maps were found; the README and plugin docs cover the first-upload timing and the one-release cached-chunk transition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…, mapped issue stacks, grouping on mapped frames, Alchemy upload (#3020) * feat(errors): JavaScript source maps: upload API, symbolicated issue stacks, grouping on mapped frames Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(browser): stamp the OTLP goldens with the current SDK version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): keep debug-id builds apart, safer grouping keys, validated uploads, race-free retention - A debug-id upload replaces only its debug id; the release-path unique index now covers id-less maps only (new migration). Release fallback prefers the id-less map, else the newest. - An unnamed mapped frame keys on its file plus its source line text; with neither, the raw key. - Whether the org has maps joins the key digest, so a first upload re-keys once; samples with debug ids wait for their map before the org has any. - Uploads need a non-empty sources array (or a valid index map, now parsed flat). - Retention claims rows atomically against last use, then deletes objects. - Only maps that resolved a frame are marked used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(errors): a failed has-maps lookup re-keys nothing When whether the org has source maps cannot be read, the tick treats it as unknown: a stored key under either maps bit stays current, and never-keyed hashes key on the rules digest as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): review round: pending maps keep stored keys, path-filtered release lookup, 10 MiB cap - A stored key whose map is pending keeps its key, as one whose lookup failed does; a resolved dependency frame no longer ends the app map's grace. - Release candidates are filtered to the frame URLs' path suffixes in SQL before the limit; stored paths match literally (an encoded `#` in a file name). - Uploads are capped at 10 MiB, the size symbolication loads; one stack loads at most 64 MiB of parsed maps by estimate; the per-isolate touch history is bounded. - Retention allows the one-day touch throttle on top of 90 days. - Frames: a short sourcesContent keeps the position, locationless frames are out of app, a zero line stays raw, the map's ignoreList marks frames out of app, and `function_from_map` records whether a name came from the map (grouping uses it instead of comparing names). - Why-grouped shows mapped frames only when they produced the stored key. - Release key bytes are bounded to fit the index entry; v2 docs state the slash boundary, the debug-id replacement rule and the 10 MiB limit. - Tests: the URL miss cache is exercised past the org cache; concurrency tests wait on signals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(ios): regenerate the OpenAPI spec for function_from_map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): refuse index maps, id-less release maps first, fair key ordering past the cap - Uploads with any `sections` field get a 400 ("Index source maps are not supported; emit a regular map"); symbolication parses plain maps only (no FlattenMap). - The release fallback reads a path's id-less maps apart from its debug-id builds, so thousands of builds cannot push the id-less map out of the limit. - Past the per-tick cap: hashes held past their grace window go first, then first sightings, then held hashes in an order that rotates each minute, so a ready hash is not stuck behind a held prefix (mapless orgs included). - Source-line keys collapse formatting whitespace but keep it inside string literals. - Frame rules classify a mapped frame by its generated frame as well as its mapped location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): linear stack parsing, throw-site grace, safer re-keys, nullable trace ids - The JS stack parser splits lines by index instead of backtracking patterns and skips lines over 2,000 chars (CodeQL polynomial regex alerts); Promise combinator frames are kept as naming boundaries. - An unmapped throw site waits for its map even when a caller mapped, and never keys on its callers alone; a stored key is kept when the mapped stack gives no identity to key on. - Past the per-tick cap, expired holds take at most half the slots, rotated, so hashes that never find a span cannot block new ones. - Source-line keys trim only the ends; inner whitespace is part of the code. - A matched map whose object is gone counts as a failed read; a URL with a recorded debug id is looked up whatever its extension; ignore lists must be arrays of source indexes. - The latest-stack query returns trace and span ids as plain strings; an empty one skips the span read. Documented: a map uploaded after the grace window does not re-key a stored raw key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(sourcemaps): one map lookup per URL per errors tick, keep an oversized map cached alone - The tick's samples share a lookup memo: a frame URL's match is read once per tick, not per sample. It lives only for the batch, and a map that cannot be read is dropped from it, so a replaced map is looked up afresh. - A map whose parse estimate exceeds the cache budget is kept as the only cached entry, so it parses once per isolate instead of once per stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): rules changes re-key raw keys, frame rules pick the throw site, nested evals - The keep-the-stored-key vetoes only protect a stored source-mapped key; a raw key re-keys on a rules change, and waits on a pending or failed lookup only when the rules are unchanged. - Org frame rules (on the generated frame) decide the throw site and the map wait, before the path heuristic. - A first-map wait needs a debug id recorded for one of the stack's own app frames. - symbolicateStack counts a debug-id `blob:` frame as one a map could resolve. - Nested V8 eval origins read their innermost location; hostile-line fixtures stay under the cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sourcemaps): header lines with `@` are not frames, stale keys keep a share, budget counts taken maps - `fn@location` is not read when the text before `@` holds `: ` (a message header). - Past the per-tick cap, stale keys get up to a quarter of the slots and first sightings rotate, so a storm of new hashes does not stall re-keying after a rules change or a first upload. - The per-stack map budget sums only the maps taken, so one left out does not crowd out a later small one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): show a too-large source map's size in the 413 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(db): regenerate the source maps migration after main's newest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(errors): name the source-mapped type + first function rule apart from mapped frames "Why grouped" said "Same source-mapped frames" for a message-less error keyed on its type and first mapped function. That branch now reports `source-mapped-function` ("Same type, first source-mapped function"). The rule is part of the hashed key input, so it still hashes as `source-mapped`: no stored key changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(cli,browser): maple sourcemaps inject/upload and exception debug ids (#3021) * feat(cli,browser): maple sourcemaps inject/upload and exception debug ids Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): debug ids over JS and map, register before app code, safe map paths - The debug id hashes the JS file and its map (without its own debug id fields), so identical JS with another map gets another id; ids from existing comments or registrations are kept. - The registration snippet goes on a new first line and the map's mappings shift one line, so a throw during evaluation still reports the id; shebangs, directive prologues, index maps and shared maps keep the append. - A map shared by several JS files never gets an id; it is uploaded once per file with that file's id and path. - `upload` reads the release from the build directory's git checkout and fails when every map was skipped. - A map outside the build directory (.., absolute or symlink) or one that is not a version 3 JSON object is skipped with a warning and never rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): skip source maps over 10 MiB, the server's new upload cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): skip index source maps at upload, which the server now refuses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(browser): count registered debug ids before building entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): read a file's directive prologue without a backtracking pattern Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): write the map before the JS, move it once, take the size cap from the domain - inject writes the map atomically (temp file + rename) before the JS, and marks a map it moved (`x_maple_shifted`), so a failed write converges on the next run and never moves it twice; a registered file whose map lacks its id is repaired. - The upload size cap is `SOURCE_MAP_MAX_BYTES` from the domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cli): use effect String helpers in the inject failure test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(cli): run command-level tests in the CLI test task Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): source-mapped stack trace on the error issue page (#3022) * feat(web): source-mapped stack trace on the error issue page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): use Arr.findFirst for the mapped top frame Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): say a file did not map rather than that no map exists, list unmapped files in the page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): highlight stack frame code with Pierre; Raised at only from a mapped top frame; reset rows on a new stack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): reset stack rows when the same stack comes back mapped differently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(views): let a long frame function name wrap instead of clipping Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(alchemy): Vite plugin and Maple.SourceMaps resource, upload web's own maps on deploy (#3028) * feat(alchemy): Vite source map plugin, Maple.SourceMaps resource, web uploads its maps - @maple/sourcemaps: the inject core moved out of the CLI (debug ids, prepend with the map shift, x_maple_shifted, safe paths, failed-write convergence), Bun-free, plus relocating maps out of a build with a manifest. The CLI re-exports it unchanged. - @maple-dev/alchemy/vite: mapleSourceMaps() turns on hidden maps, injects debug ids into the client output and moves the maps to .maple/sourcemaps/<outDir> with maple-sourcemaps.json. - Maple.SourceMaps uploads a map directory through POST /v2/source_maps (debug id, else service + release), re-uploading only when a digest of the maps changes; delete keeps the maps. - web builds with the plugin and the prd deploy uploads its maps as maple-web at VITE_COMMIT_SHA, through the new prd-only MAPLE_SOURCEMAPS_API_KEY (a no-op without it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(alchemy): safe map relocation, multi-output builds, release-matched uploads - A maps dir that is, holds or sits inside a build output is refused before any file is touched, and only the files the previous manifest listed are removed, never the whole dir. - The Vite plugin collects every output a build writes and relocates them once in closeBundle, under one manifest. - Maple.SourceMaps takes `matchBy: "release"`: uploads without debug ids (query and map body), so each release keeps its own map; web's dogfood uses it, as its telemetry sends no debug ids. - A deploy whose build was skipped logs that no maps were found; the README and plugin docs cover the first-upload timing and the one-release cached-chunk transition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Maple review🟢 Confidence 9/10 · safe to merge. The upload/inject paths are single-sourced, bounded and pinned by new unit and scene tests; only the Adds the source-map pipeline (shared
Before merge
|
|
Merged with 3 steps from "Before merge" still open. If they are done, tick them on the review comment; if not, now is the time.
|
Maple: after this shipped✅ Shipped clean. Nothing this change touches got worse in the hour after it deployed. Deployed at 2026-11-24 15:20 UTC as
Details are in Maple. A public repository's comment names no service, operation or error. |
Third of three stacked PRs for JavaScript source maps: #3020 (backend and API), then #3021 (CLI and browser SDK), then this one.
What changed
stackFrameList(packages/views/src/ui/stack-frames.ts).@pierre/highlightsvia@maple/views/lib/highlight), using the language of the frame's file and the shared--sh-*theme in both light and dark.aria-expanded.resolved/partial: a "Stack trace" bar with a "Source mapped" badge (or "Partly source mapped", whose tooltip lists the files with no map) and a "Raw" toggle back to the minified text.missing_map: keeps the raw view, with a quiet hint naming the file with no map andmaple sourcemaps upload.not_applicable/ no stack: unchanged.disclosure-strip.tsgives the raw text block asmonospaceBlock, used by both the disclosure and the Raw view./lab/error-issue?stack=raw|resolved|partial|missing_map.Screenshots
With Pierre highlighting (lab, light and dark):
Earlier screenshots below are from the real local end-to-end run, before highlighting landed.
Before (today, every stack is raw text):
After, a real issue on a local stack. A minified Vite app ran in Chrome, and its maps were uploaded with
maple sourcemaps upload:Raw toggle:
After the map was deleted (real stack, next request):
Lab states, partly mapped and library frames expanded:
Verification
stack-trace.scene.test.tsalso covers "Raised at" keeping the reported frame when the top app frame didn't map, and a different stack resetting flipped rows. It covers library frames expanding, a second app frame expanding, the Raw toggle both ways, the missing-map hint, and the null stack keeping today's view. All 58 tests undersrc/page/errors/issue/pass, and so do the lab registry tests.bun typecheck(all 60 tasks),bun run lint(core + foldkit),oxfmt --check,ui:patterns:checkandui:indexare clean on the full stack.docs.test.tsrejects links to pages that don't exist, so a source maps docs page is a follow-up.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.