Repository navigation
Conversation
size-limit report 📦Compared: ac589d1 (PR test merge using develop at 901cf40) Against: 901cf40 (develop) · base run #68191 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsAll optional checks were successful. 65 successful. See the run. Successful checks
|
…print Function fingerprints in SDK config reports hash the minified source, so a bundler renaming one helper changes them with no code change. This fingerprints a token stream instead, where renamed names, whitespace, comments, quote styles and number spellings don't matter. It isn't wired into the report yet.
Minifiers expand a renamed destructuring default like `{level='error'}` to `{level:e='error'}`, so the key is now kept for `=` the same way it is for shorthand properties.
…blocks, in function fingerprints
…regex-driven scan The hand-written tokenizer cost about 1.3KB minified and gzipped. This one is about 0.7KB: a single regex does the lexing and a short loop tracks template substitutions and whether a slash is a division. It only aims to be stable across builds made with the same minifier, so it no longer treats different quote styles, number spellings, `void 0`, `!0`, `===` or shorthand keys as equal. Tests for those are removed and the exact-output tests are rewritten for the new token format.
…ngerprints
Their source text is `{ [native code] }` with a header each engine spells differently, so the same bound callback fingerprinted differently per browser.
b540541 to
b6d5905
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b6d5905. Configure here.
| } else if (ch === '/' && token[1] && ENDS_VALUE.test(prev) && (!KEYWORDS.has(prev) || prev === 'this')) { | ||
| // A division, not a regex literal: emit the slash alone and rescan what follows. | ||
| token = ch; | ||
| TOKEN.lastIndex = match.index + 1; |
There was a problem hiding this comment.
Value keywords misread as regex
Low Severity
The slash after this is treated as division, but the other value keywords null, true, false, and undefined still take the regex path. A minifier that rewrites true / foo / bar as true/a/g therefore keeps the renamed names inside a fake regex, so the fingerprint can change when only locals were renamed.
Reviewed by Cursor Bugbot for commit b6d5905. Configure here.
| } | ||
|
|
||
| return fnv1a32(tokenize(source).join(' ')); | ||
| } |
There was a problem hiding this comment.
Feat lacks integration coverage
Low Severity
This is a feat PR and only adds unit tests (plus a TestClient assertion in reportSdkConfig.test.ts). The review rules for feat work require at least one integration or E2E test, for example covering a minified beforeSend through a real init and config payload. I flagged this because it was mentioned in the PR review guidelines.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit b6d5905. Configure here.


Minifiers rename whatever a function references from outside, this means an SDK config can report changes in callbacks that never actually changed.
Why the hash changes
The SDK config report serializes each function option as a hash of
Function.prototype.toString(). That text is not stable in a minified bundle.ships as
e=>T(e)?null:ein one build ande=>q(e)?null:ein the next.The name given to
isFilteredLogdepends on the rest of the chunk, how often other bindings are referenced, the order they are declared in, and which modules end up sharing a scope. So an unrelated change somewhere else in the app changes the callback's text and its hash.I confirmed this on the Sentry frontend. Across 8 production releases, 4 of the 5 function options had two different hashes, and every diff in the shipped text was a single renamed outside reference. I also reproduced it in a small Vite app with Oxc, esbuild and Terser, they all exhibit the same behavior.
What the fingerprint does
It scans the function text and replaces every name a minifier can rename with
_, then hashes the result. Keywords, property names (e.message), object keys, string, template, regex and number literals, and all punctuation are kept, so real edits still change the fingerprint.Whitespace and comments are dropped.
One regex does the lexing. A short loop around it tracks the two things a regex can't: open
${substitutions in templates, and whether a/is a division or the start of a regex literal.What it does not do
It only aims to be stable across builds made with the same minifier. Projects rarely switch minifiers, and a switch costs one changed fingerprint per callback, once.
An earlier version on this branch was a hand-written tokenizer that also treated different quote styles, number spellings,
void 0,!0,===versus==, and shorthand keys as equal. It was about 1.3KB minified and gzipped, which was too much for what it bought.This version is about 0.7KB. In my Vite test the larger one still gave different fingerprints for the same callback across Oxc, esbuild and Terser (they differ in
constversusletand operand order), so those extra rules did not deliver cross-minifier stability either.Results
On the Sentry frontend bundles, all 5 function options now give one fingerprint across the 8 releases.
It also absorbs a browser difference I found along the way: Safari 16.6 and older print anonymous functions as
function (with a space, which gave those clients their own hashes.Known limits
w.ADinw.AD.some(...)is a bundler-assigned name that looks like a real property. It is kept, and it can change.