feat(scopes): add clients to scopes#2114
Conversation
8c35756 to
e607cfd
Compare
e607cfd to
15faea1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| return $mergedScope; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
mergeScopes drops global client
High Severity
Scope::mergeScopes clones the isolation scope and merges tags and other fields, but keeps the isolation scope’s bound client unchanged. After a normal init($client), the global scope holds the real client while the isolation scope still has a default NoOpClient, so a merged capture scope reports a no-op client even though SentrySdk::getClient() would return the global client.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| $hubClient = $client ?? new NoOpClient(); | ||
|
|
||
| if ($client !== null) { | ||
| self::getGlobalScope()->setClient($client); |
There was a problem hiding this comment.
Re-init leaves stale global client
Medium Severity
Calling SentrySdk::init() without a client creates a hub with NoOpClient but does not update the process-global scope’s client when one was set by an earlier init($client). SentrySdk::getClient() then keeps returning the previous real client while the current hub uses a no-op client.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| return $client; | ||
| } | ||
|
|
||
| return self::getGlobalScope()->getClient(); |
There was a problem hiding this comment.
bindClient ignores global scope
Medium Severity
Hub::bindClient updates only the hub stack layer. It does not update the process-global scope client, while SentrySdk::getClient() resolves the client from isolation and global scopes. After SentrySdk::init()->bindClient($client), the hub sends with the bound client but SentrySdk::getClient() still returns the global scope’s default NoOpClient.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| return $mergedScope; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
mergeScopes drops global client
High Severity
Scope::mergeScopes clones the isolation scope and merges tags and other fields, but keeps the isolation scope’s bound client unchanged. After a normal init($client), the global scope holds the real client while the isolation scope still has a default NoOpClient, so a merged capture scope reports a no-op client even though SentrySdk::getClient() would return the global client.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| $hubClient = $client ?? new NoOpClient(); | ||
|
|
||
| if ($client !== null) { | ||
| self::getGlobalScope()->setClient($client); |
There was a problem hiding this comment.
Re-init leaves stale global client
Medium Severity
Calling SentrySdk::init() without a client creates a hub with NoOpClient but does not update the process-global scope’s client when one was set by an earlier init($client). SentrySdk::getClient() then keeps returning the previous real client while the current hub uses a no-op client.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c86807c. Configure here.
| return $client; | ||
| } | ||
|
|
||
| return self::getGlobalScope()->getClient(); |
There was a problem hiding this comment.
bindClient ignores global scope
Medium Severity
Hub::bindClient updates only the hub stack layer. It does not update the process-global scope client, while SentrySdk::getClient() resolves the client from isolation and global scopes. After SentrySdk::init()->bindClient($client), the hub sends with the bound client but SentrySdk::getClient() still returns the global scope’s default NoOpClient.
Reviewed by Cursor Bugbot for commit c86807c. Configure here.


No description provided.