Skip to content

ref: Reuse isObjectLike for object guards - #25058

Merged
msonnb merged 1 commit into
developfrom
ms/object-like-guards
Oct 5, 2026
Merged

msonnb merged 1 commit into
developfrom
ms/object-like-guards

Conversation

@msonnb

@msonnb msonnb commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Reuse the existing isObjectLike helper for repeated non-null object guards across SDK packages. It checks the same runtime condition and narrows unknown values, allowing redundant type assertions to be removed without changing behavior.

Co-Authored-By: OpenAI Codex <codex@openai.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.52 kB - -
@sentry/browser - with treeshaking flags 27.68 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.57 kB - -
@sentry/browser (incl. Tracing) 51.42 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.43 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.41 kB - -
@sentry/browser (incl. Tracing, Replay) 91.04 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.04 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.74 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.73 kB - -
@sentry/browser (incl. Feedback) 47.02 kB - -
@sentry/browser (incl. sendFeedback) 34.58 kB - -
@sentry/browser (incl. FeedbackAsync) 39.68 kB - -
@sentry/browser (incl. Metrics) 30.53 kB - -
@sentry/browser (incl. Logs) 30.81 kB - -
@sentry/browser (incl. Metrics & Logs) 31.48 kB - -
@sentry/react 31.36 kB - -
@sentry/react (incl. Tracing) 53.77 kB +0.01% +1 B 🔺
@sentry/vue 37.49 kB - -
@sentry/vue (incl. Tracing) 54.33 kB - -
@sentry/svelte 29.55 kB - -
@sentry/remix (Remix 3 client bundle) 55.76 kB - -
CDN Bundle 31.23 kB - -
CDN Bundle (incl. Tracing) 51.98 kB - -
CDN Bundle (incl. Logs, Metrics) 33.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.93 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.23 kB - -
CDN Bundle (incl. Tracing, Replay) 89.57 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.52 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.72 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.71 kB - -
CDN Bundle - uncompressed 92.15 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.48 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.73 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.44 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.37 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.92 kB - -
@sentry/nextjs (client) 56.29 kB -0.02% -10 B 🔽
@sentry/sveltekit (client) 51.83 kB - -
@sentry/core/server 40.58 kB - -
@sentry/core/browser 13.62 kB - -
@sentry/node 144.73 kB -0.01% -10 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.22 kB - -
@sentry/node - without tracing 93.3 kB -0.01% -2 B 🔽
@sentry/node - without channel injection 122.93 kB -0.02% -13 B 🔽
@sentry/aws-serverless 101.57 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 208.57 kB -0.02% -23 B 🔽
@sentry/cloudflare (withSentry) 516.73 kB -0.01% -21 B 🔽

View base workflow run

@msonnb msonnb changed the title ref: Reuse isObjectLike for object guards ref: Reuse isObjectLike for object guards Oct 5, 2026
@msonnb
msonnb marked this pull request as ready for review October 5, 2026 14:42
@msonnb
msonnb requested review from a team as code owners October 5, 2026 14:42
@msonnb
msonnb requested review from chargome, isaacs, mydea and s1gr1d and removed request for a team October 5, 2026 14:42

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 42b71f5. Configure here.

if (p === 'router' && typeof newValue === 'object' && newValue !== null) {
patchRouter(client, newValue, currentRouterPatchingNavigationSpanRef);
if (p === 'router' && isObjectLike(newValue)) {
patchRouter(client, newValue as unknown as NextRouter, currentRouterPatchingNavigationSpanRef);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommented double cast on router

Low Severity

A new as unknown as NextRouter double-cast was added without a comment explaining why a safer typing is not possible. I flagged this because the review rules require every new double-cast in SDK source to include that justification.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 42b71f5. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was any before, we keep the assumption that Next assign a NextRouter here.

@msonnb
msonnb merged commit a40375d into develop Oct 5, 2026
270 of 273 checks passed
@msonnb
msonnb deleted the ms/object-like-guards branch October 5, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants