Repository navigation
Conversation
gricha
force-pushed
the
ref/typing-shared-principal
branch
from
November 1, 2026 04:24
e468a0c to
6365812
Compare
gricha
added a commit
that referenced
this pull request
Nov 1, 2026
The SeerAgentClient change from #129413: read the caller's user id with acting_user_id instead of request.user.id, so a service account gets None instead of a 403 from the ServiceAccountId guard.
gricha
force-pushed
the
ref/typing-shared-principal
branch
from
November 2, 2026 19:55
6365812 to
246502d
Compare
gricha
marked this pull request as ready for review
November 2, 2026 20:06
Feature gates, Seer agent access, demo/staff checks, team lookup and activity serializers now take a RequestPrincipal. Most only pass the caller to features.has() or serialize(), so this is type-only. The rest read the user id through acting_user_id()/has_user(): users, agents and token callers get the same values, and a service account gets no user instead of a ServiceAccountId.
gricha
force-pushed
the
ref/typing-shared-principal
branch
from
November 2, 2026 22:08
246502d to
1e83cd4
Compare
azulus
approved these changes
Nov 2, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The helpers that endpoints hand
request.userto now take aRequestPrincipal: feature gates (get_excluded_detector_types,has_investigations_access,should_serve_action_log_activity), Seer agent access (SeerAgentClient,has_seer_agent_access_with_detail,collect_user_org_context,commit_author_for_user),is_demo_user,has_staff_option,TeamManager.get_for_userand the group activity serializers.features.has()orserialize(), or already checkhas_user(): type-only.SeerAgentClientreads the user id once throughacting_user_id()instead of sixhasattr(self.user, "id")checks.is_demo_user,collect_user_org_contextandcommit_author_for_useruseacting_user_id()/has_user().Users, agents and token callers get the same values as before. A service account now gets no user (no
user_idon its Seer runs, org context without personal teams) instead of aServiceAccountIdthat 403s when used as an int.Without it, #129402's mypy check would flag 14 more files.