A tax-filing web app ships weekly; how would you keep its source maps private yet map every report to the right build, and group reports into issues that survive a release?
answer
- maps can carry the original source
- release id baked in at build
- upload before the deploy goes live
- keep maps while old tabs run
- fingerprint names, not line numbers
basics
~20 sBake a release id into each build and stamp it on every report; upload that build's maps privately, keyed by release, before the deploy goes live. Group by error type, normalised message and top symbolicated in-app frames.
solid answer
~50 sSource maps can embed the original source, so publishing them beside the bundles publishes the app's code; they go to the error service only. CI bakes a release id (commit hash plus build number) into the bundle, and every report carries it. The same CI job uploads that build's maps, keyed by release and file path, and the deploy that makes the bundles live waits for the upload to succeed, so the first hour of reports is readable. Maps stay until no tab can still be running that release. Grouping uses a fingerprint of error type, the message with numbers and identifiers normalised away, and the top few in-app frames' original function and file names. Minified names, line and column numbers and bundle hashes change every release, so a fingerprint built on them splits one bug into a new issue each week; the release is an attribute of the issue, not part of its identity.
code
pseudocode · 9 linesfingerprint(report):
maps = mapsFor(report.release) # uploaded by CI before the deploy
frames = symbolicate(report.stack, maps)
inApp = first 4 of frames where frame.file starts with 'src/'
if report.kind == 'chunk-load': return hash('chunk-load')
if report.message == 'Script error.': return hash('muted', report.scriptOrigin)
return hash(report.type,
normalise(report.message), # digits and ids -> placeholders
[f.function + '@' + f.file for f in inApp])go deeper
Recall that a source map links minified code back to original files and can contain the original source, which is why it should not be public.
Explain the pipeline order: release id baked in, every report tagged, maps uploaded per release before the deploy, and why a report needs its release to be mapped.
Show grouping judgement: a fingerprint of type, normalised message and symbolicated in-app frames, explicit rules for muted and chunk-load reports, and map retention that matches long-lived tabs.
Decide who owns fingerprint overrides and map retention across teams, and how much deploy delay the upload gate may add before teams route around it.
## Why the maps stay private A **source map** is a file that maps positions in a minified, bundled script back to the original source files. The format lets a map carry a `sourcesContent` list holding the original source text itself, so a map published next to a bundle hands anyone the app's readable code: validation rules, internal endpoint paths, comments, feature names not yet launched. For a tax-filing app that is a gift to anyone probing its forms. So the built files point browsers at no public map, and the maps never reach the public static domain. Which kind of map the build emits, and how a file references one, is the build-tools question's subject; this pipeline only needs the maps to exist as build artifacts and to reach the error service. ## The per-release pipeline 1. **Name the release.** CI computes one release id per build (for example the commit hash plus a build number) and bakes it into the bundle as a constant. 2. **Stamp every report.** The reporter adds `release` to each envelope, so the service knows which build produced the stack. 3. **Upload before going live.** The same CI job uploads that build's maps to the error service, keyed by release and by each bundle's path. The deploy step that publishes the bundles waits until the upload succeeds. Reports that arrive before their maps cannot be symbolicated on arrival (turned back into original function and file names), and they get grouped by minified frames into duplicate issues, in the very hour the team most needs a clear picture. 4. **Keep maps while the release can still run.** Tax returns are long-lived tabs: a user may keep a half-finished return open for days, so reports tagged with last month's release keep arriving. Retain maps for every release that could still be running (say, the last several releases or ninety days), then delete them. Matching a report to its build is then a lookup: the release id selects the set of maps, the frame's file path selects the map within it. Content-hashed file names help, but the release id is what lets the service say "first seen in this release" and compare one release with the last when two are live at once. ## Grouping that survives a release **Grouping** turns thousands of reports into a few issues a person can own. The rule that decides it, the **fingerprint**, must be stable for one bug and different for two bugs. | Ingredient | Use it | Leave it out | |---|---|---| | Error type | `TypeError`, `RangeError`, a custom error name | | | Message | normalised: digits, identifiers and quoted values replaced by placeholders | the raw text, which varies per user, may hold personal data, and is worded differently by different browsers | | Frames | the top three to five **in-app** frames, as original function name plus original file | minified names, line and column numbers, the bundle's hash, vendor and extension frames | | Release | stored on the issue as first-seen and last-seen | inside the fingerprint, where it would open a new issue every week | Some failures need explicit rules because they have no useful stack: - **Muted `Script error.` reports** group by the script's origin into one low-priority issue. - **Chunk-load failures** group into one issue whatever the chunk name, because the chunk's hash changes every release but the cause, a stale tab after a deploy, does not. ## Too coarse versus too fine A fingerprint built on the message alone merges unrelated bugs that share a generic message; one built on line numbers splits a single bug every release and makes every Monday look like a fresh regression. The useful middle is symbolicated in-app frames: names developers wrote, which survive minification changes. Teams should be able to override a fingerprint for a known case, and should review the largest issues after each release to catch a merge that hides two causes. ## What to say in the round The answer that lands connects the pieces: private maps because of what they contain, a release id that ties a report to its build, an upload that gates the deploy, retention that matches how long tabs live, and a fingerprint of names rather than positions so the release comparison the team relies on actually works.
- What goes wrong if the map upload runs after the deploy instead of before it?Reports from the new release arrive while the service has no maps for it. Their frames stay minified, so the fingerprint is built from names and positions that differ from the symbolicated ones, and the first hour of a release, when regressions show, lands in duplicate, unreadable issues. Making the deploy wait for a successful upload costs seconds and removes that window.
- Two releases are live at once because older tabs keep running; how does the dashboard stay honest?Every report carries its release, so each issue records which releases it appears in and counts per release. The team compares the new release's error rate with the previous release's over the same period, instead of reading one blended total. Long-lived tabs on old releases then show up as a tail that fades, not as noise inside the new release's numbers.
- Publishing source maps beside the bundles is harmless because the code is minified anyway.
- Use the top frame's line and column as the issue fingerprint.
- Delete a release's source maps as soon as the next release ships.
- Group reports by the raw error message, since it is the most readable signal.
- Put the release id into the fingerprint so each release's errors stay separate.