Skip to content

feat: add noop client implementation - #1365

Open
giortzisg wants to merge 1 commit into
masterfrom
scopes/noop-client
Open

feat: add noop client implementation#1365
giortzisg wants to merge 1 commit into
masterfrom
scopes/noop-client

Conversation

@giortzisg

@giortzisg giortzisg commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

This adds the Client interface and noop and default client implementations for the SDK. This better aligns the behavior with the current client spec and removes the need to always nil check any client.

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@giortzisg
giortzisg changed the base branch from feat/scopes to master July 20, 2026 08:33
@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

GO-153

@giortzisg
giortzisg marked this pull request as ready for review July 20, 2026 11:24
Comment thread httpclient/sentryhttpclient.go Outdated
@giortzisg
giortzisg changed the base branch from master to feat/scopes July 21, 2026 12:36
@giortzisg
giortzisg force-pushed the scopes/noop-client branch from 4337b6c to 415d82c Compare July 23, 2026 08:45
Comment thread client.go Outdated
@giortzisg
giortzisg force-pushed the scopes/noop-client branch from 415d82c to 18b7a4a Compare July 30, 2026 20:45
Comment thread client_api.go Outdated
@giortzisg
giortzisg changed the base branch from feat/scopes to master August 10, 2026 11:30
@giortzisg
giortzisg force-pushed the scopes/noop-client branch 2 times, most recently from 59c6bdc to 095e3a7 Compare August 10, 2026 11:57
Comment thread client_api.go Outdated
Comment thread hub.go
func (hub *Hub) CaptureCheckIn(checkIn *CheckIn, monitorConfig *MonitorConfig) *EventID {
client, scope := hub.Client(), hub.Scope()
if client == nil {
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check-in returns ID when disabled

Medium Severity

CaptureCheckIn no longer returns nil when no real client is bound. The hub-level client == nil guard was removed, but Client.CaptureCheckIn never checks IsEnabled() and still returns a check-in ID after CaptureEvent discards the event. Callers that treat a non-nil ID as a successful capture will think the check-in was recorded when the noop client dropped it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7ecc977. Configure here.

This PR changes the client boundaries so that we always return a non nil
client.

@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 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

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 8fc2ecf. Configure here.

Comment thread client.go
// the utility methods like CaptureException. The return value is the
// event ID. In case Sentry is disabled or event was dropped, the return value will be nil.
func (client *Client) CaptureEvent(event *Event, hint *EventHint, scope EventModifier) *EventID {
if !client.IsEnabled() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check-in succeeds on disabled client

Medium Severity

CaptureCheckIn still builds a check-in and returns its ID after the hub nil-client guard was removed. CaptureEvent now drops the payload when the client is disabled, so callers get a non-nil ID even though nothing was captured. Cron flows that treat a returned ID as success will look healthy while monitors never receive the check-in.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8fc2ecf. Configure here.

Comment thread client.go
func (client *Client) Recover(err any, hint *EventHint, scope EventModifier) *EventID {
if !client.IsEnabled() {
return nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Disabled Recover skips panic recovery

Medium Severity

Recover returns immediately when the client is disabled, before calling recover(). Direct use as a panic handler with a noop client therefore leaves the original panic unrecovered. RecoverWithContext does not have this early return, so the two APIs now behave inconsistently for disabled clients.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8fc2ecf. Configure here.

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.

Finalize noop client prerequisite

2 participants