Skip to content

Backend: add AnonymousUID to Actor struct

Warren Gifford requested to merge cc/anonymous-uid-actor into main

Created by: camdencheek

There are a few places (feature flags, event logging) where we are forced to propagate a handle to a HTTP request because we need the AnonymousUID cookie value if it exists. Since the AnonymousUID is used to identify the current actor (even (and especially) when that actor is unauthenticated), I think it makes sense to propagate through our backend as part of the actor struct.

This PR adds AnonymousUID to the Actor struct. The presense of AnonymousUID does not change the value of IsAuthenticated(), nor is it guaranteed to exist for an unauthenticated actor. However, when it does exist, it can act as a semi-stable identifier for the current actor, which is useful for things like random-but-stable feature flags or for identifying unauthenticated user sessions in event logs.

Test plan

Added a test that AnonymousUID is propagated over internal APIs. Also added tests that it works and that it doesn't override an existing authenticated actor.

Merge request reports

Loading