Skip to content

feat: add user resolver - #2396

Merged
Litarnus merged 3 commits into
masterfrom
scope-user-resolver
Nov 19, 2026
Merged

Litarnus merged 3 commits into
masterfrom
scope-user-resolver

Conversation

@Litarnus

Copy link
Copy Markdown
Collaborator

Adds a user resolver callback which can provide user information lazily. When it's defined, it will call the resolver every time getUser is called. Setting data explicitly through setUser will take precedence and the resolver will only be used to fill the remaining fields.

The reason for adding this is that symfony provides a lazy firewall by default and trying to obtain user data will start the session, even if nothing else would have started it. By setting the provider we can start getting user data once it's available and will not start the session by accident.

@Litarnus
Litarnus requested review from a team and stayallive as code owners November 18, 2026 22:34
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

decision-model-linter

sdk

src/State/Scope.php

  • error ungatedAutomaticPii = TRUE (0.79): Automatic collection of personal data must be off unless send_default_pii is on, or must go through DataCollectionPolicy when data_collection is set. Gate this collection on one of them.

decision-model-linter: 1 call on 1 file, 2,332 input tokens, $0.000098, model typesafe/jev-1.13-20260917

The Trigger: Override Decision Model Lint label keeps these errors from failing the check.

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mergeable: 1 non-blocking issue.

Comment thread src/State/Scope.php Resolved

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mergeable: 2 non-blocking issues.

Comment thread src/State/Scope.php Resolved
Comment thread src/State/Scope.php Resolved

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mergeable: 2 non-blocking issues.

Comment thread src/State/Scope.php Resolved
Comment thread src/State/Scope.php Resolved

@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 bddd838. Configure here.

Comment thread src/State/Scope.php Resolved

@stayallive stayallive left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cool!

@Litarnus
Litarnus merged commit 7bb8ff4 into master Nov 19, 2026
61 of 62 checks passed
@Litarnus
Litarnus deleted the scope-user-resolver branch November 19, 2026 09:56
Litarnus pushed a commit to getsentry/sentry-docs that referenced this pull request Nov 19, 2026
<!-- Keep the urgency section so automation can prioritize this PR. You
may delete other sections you don't need. -->

## DESCRIBE YOUR PR

Documents `Scope::setUserResolver()` from getsentry/sentry-php#2396 on
the PHP and Symfony Users page. It isn't released yet, so the version
note says "newer than 4.37.1"; swap in the exact version once it ships.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)

<!-- junior-request-attribution:start -->
via [automation
`evt_37e02acfecbc9f3cec3ed56026fa8080`](https://junior-prod.sentry.dev/automations/evt_37e02acfecbc9f3cec3ed56026fa8080)
· Run ID `dispatch_8043c195d63b94f694d705950b210c12`.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_8043c195d63b94f694d705950b210c12
-->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_8043c195d63b94f694d705950b210c12)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_8043c195d63b94f694d705950b210c12/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants