Repository navigation
chore(lint): Require a DEBUG_BUILD gate on debug logs in browser-facing code - #26861
Merged
Merged
Conversation
4 of 13 tasks
Contributor
size-limit report 📦Compared: e65348c (PR test merge using develop at b06ca66) Against: b06ca66 (develop) · base run #67921 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 4 not successful, 79 successful. See the run.
Successful checks
|
…ng code Adds `sdk/no-unguarded-debug-logs`, which flags `debug.log` / `debug.warn` / `debug.error` calls without a `DEBUG_BUILD` gate in `core` and browser-facing packages, and gates the existing hits. Part of #26852 Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
feat/lint-unguarded-debug-logs
branch
from
November 25, 2026 13:01
ee1cbf3 to
de2fb9c
Compare
mydea
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
sdk/no-unguarded-debug-logs, which flagsdebug.log/debug.warn/debug.errorcalls without aDEBUG_BUILDgate incoreand in the browser-facing packages fromno-unguarded-span-apis(that map now lives in a sharedutils/browser-facing.js). Currentdevelophas 13 hits. The 6 in browser-reachable code now useDEBUG_BUILD && debug.x(...).logIgnoredSpangets a disable comment because both of its callers already gate it. The 6 intunnelForward.tsandflushIfServerless.tsget a file-level disable because those files are server-only, so their logging stays as it is.Why
Without the gate, the message strings ship in production bundles. This moves the Bugbot rule into Oxlint.
The rule accepts
if (DEBUG_BUILD) { ... },DEBUG_BUILD ? ... : ..., and an earlyif (!DEBUG_BUILD) return;as gates, not just the short-circuit form. Minifiers remove all of them the same way, so requiring&&would rewrite the existingif (DEBUG_BUILD)blocks (19 in browser-facing code) without saving bytes. The early-return form is whydsn.tsandlogSpans.tsfrom the original scan don't count as hits. The Bugbot debug rule is removed, including its preference for the short-circuit form, since minifiers drop both forms the same way.All of
core/srcis in scope because the rule can't tell which core files reach a browser bundle. Server-only core files opt out explicitly.Part of #26852
via @mydea.
--
View Session [Sentry]