Skip to content

build(deps): bump sentry-go to 0.50.0 and gate on IsEnabled - #275

Merged
SyniRon merged 2 commits into
developfrom
agent/dependawalk-8f3121
Oct 16, 2026
Merged

SyniRon merged 2 commits into
developfrom
agent/dependawalk-8f3121

Conversation

@SyniRon

@SyniRon SyniRon commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

This takes the sentry-go 0.49.0 → 0.50.0 bump from Dependabot's #271 and fixes what it breaks. In 0.50.0 the hub holds a disabled no-op client where it used to hold nil. Both "is Sentry off?" guards in rest checked for nil, so they stopped firing.

 sentryMiddleware(next)
-  if CurrentHub().Client() == nil        # never true on 0.50.0
+  if !sentryCaptureEnabled()             # CurrentHub().Client().IsEnabled()
     pass through untouched
   recover panic, capture event, write 500

 FlushSentryOnShutdown()
-  if CurrentHub().Client() == nil
+  if !sentryCaptureEnabled()
     warn and skip the signal handler
   install flush-on-signal handler

Test changes:

  • Assertions on a nil client now check IsEnabled().
  • Two preconditions that only repeated the behavior assertions are gone.
  • The flush-guard test checks that a warning was logged, not its wording.
  • Two test names and the "no client" comments now talk about capture being off.

Evidence

  • Before: build(deps): bump github.com/getsentry/sentry-go from 0.49.0 to 0.50.0 #271's CI, on 0.50.0 with the nil guards. Five tests fail in rest:

    SENTRY_DSN unset, handler panics "ranks exploded"
      middleware recovers it and writes a 500
      TestSentry_NoDSNIsCompletePassThrough                      FAIL
      TestMetrics_PanickingHandlerMetersAs500AndPanicPropagates  FAIL
    FlushSentryOnShutdown() with no DSN
      installs the handler, logs nothing
      TestFlushSentryOnShutdown_NoClient_WarnsAndSkips           FAIL
    plus two SetupSentry tests asserting Client() == nil         FAIL
    

    After: the panic propagates with nothing written, and the flush guard warns and skips. go vet ./..., go test -race ./... and make test-integration against the MariaDB harness all pass locally. Changing sentryCaptureEnabled back to a nil check fails the pass-through, metrics-panic and flush-guard tests.

Merge Danger

Door: two-way

Reverting this PR restores 0.49.0 and the nil guards. There is no data or schema change.

Blast Radius: telemetry

With SENTRY_DSN set, SetupSentry still initialises an enabled client, so production takes the same capture path as before. TestSetupSentry_DSNEnablesClientWithRelease still sees exactly one event with the release tag. The no-DSN path, which local and dev runs use, is the one 0.50.0 broke, and this keeps it a pass-through. Dependabot should close #271 on its own once develop has 0.50.0.

Refs #271

This was generated by AI

sentry-go 0.50.0 binds a disabled no-op client where it used to leave
nil, so the two "Sentry is off" guards in rest compared against nil and
never fired. Without a DSN the middleware recovered panics into 500s
and FlushSentryOnShutdown installed its signal handler. Both guards now
ask Client().IsEnabled().

The tests stop asserting a nil client. SetupSentry's no-DSN and bad-DSN
tests check IsEnabled() instead. Preconditions that only duplicated the
behavior assertions are gone, and the flush-guard test checks that a
warning was logged, not its wording.

Refs #271

> *This was generated by AI*
Both guards now call sentryCaptureEnabled(), so the next SDK change to
what "off" looks like lands in one place. Two test names and the
comments that said "no client" or "client bound" now say capture is
off or on, since 0.50.0 always binds a client.

Refs #271

> *This was generated by AI*
@SyniRon
SyniRon merged commit ab73b55 into develop Oct 16, 2026
4 checks passed
@SyniRon
SyniRon deleted the agent/dependawalk-8f3121 branch October 16, 2026 17:55
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.

1 participant