feat: add scope context API - #1371
Conversation
0bb8a70 to
8ce983c
Compare
8ce983c to
3ce9717
Compare
| } | ||
|
|
||
| // WithScope is a shorthand for CurrentHub().WithScope. | ||
| func WithScope(f func(scope *Scope)) { |
There was a problem hiding this comment.
why are only these methods removed here and not the others? can you add a short summary of the breaking changes in the PR description?
There was a problem hiding this comment.
+1, please also adjust the PR title to feat! so that Craft identifies this as a breaking change
There was a problem hiding this comment.
Didn't remove the rest because of test usage. Functionality of the scope propagation on ctx isn't finalized on this PR so can't really swap, but it's a fair argument. I'll re-add this and remove everything with all Hub functionality on the final PR to only have public API breaking changes under a single part of the stack.
szokeasaurusrex
left a comment
There was a problem hiding this comment.
lgtm! Left a few minor comments and a question
| boundClient: scope.boundClient, | ||
| eventProcessors: scope.eventProcessors[:len(scope.eventProcessors):len(scope.eventProcessors)], | ||
| scopeData: data.clone(), |
There was a problem hiding this comment.
[question] does the reordering of scopeData after eventProcessors change the code's behavior? Or is it simply a formatting change?
I am just trying to understand why this change is being made here.
There was a problem hiding this comment.
Doesn't affect code behavior. This diff is just adding scope.boundClient.
| // Clearing or cloning the scope only affects the underlying data. To set a new | ||
| // client or event processor, SetClient or AddEventProcessor should be used. |
There was a problem hiding this comment.
l: I find this paragraph to be slightly unclear. What is meant by the "underlying data" in this context?
There was a problem hiding this comment.
It's everything under scopeData, which is essentially all the data set by the user. Not really sure how to call this.
| } | ||
|
|
||
| // WithScope is a shorthand for CurrentHub().WithScope. | ||
| func WithScope(f func(scope *Scope)) { |
There was a problem hiding this comment.
+1, please also adjust the PR title to feat! so that Craft identifies this as a breaking change
3ce9717 to
24cbd32
Compare
1ba25e1 to
5ebf737
Compare
5ebf737 to
14a0bf8
Compare
14a0bf8 to
01f70b4
Compare
01f70b4 to
a32c046
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a32c046. Configure here.
a32c046 to
7c286e0
Compare
7c286e0 to
e747b11
Compare
e747b11 to
38e8186
Compare
38e8186 to
1b1b8fa
Compare
1b1b8fa to
098dc3a
Compare
098dc3a to
d43e721
Compare

Description
Adds the new scope context API.
Issues
context.Context#1367Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)