Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 6 tasks
marandaneto
reviewed
Oct 29, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
Automated advisory code review.
…xception option Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
turnipdabeets
approved these changes
Oct 29, 2026
turnipdabeets
left a comment
Contributor
There was a problem hiding this comment.
LGTM, the shape matches set_context_option in Python and RequestContext.Options in Go. One non-blocking suggestion inline.
…le default Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
💡 Motivation and Context
RequestContextsets default properties for every event in a request, but not capture options. The other v1 server SDKs let a request context set options too (posthog-pythonset_context_option, posthog-goRequestContext.Options, posthog-node contextoptions), so a request can, for example, turn oncookieless_modefor all its events.Changes
RequestContext::option(key, value)sets a capture option for every event in the context, including exceptions fromexception_optionsor the scoped context.null. An option the event sets wins, as with properties. For exceptions, the last value set for a key decides.PostHogLayerkeeps the options of aRequestContextthe application puts in the request extensions, as it keeps its identity and properties.process_person_profilereplaces thefalsethatEvent::new_anonsets for a personless event, so the personless default is the lowest layer, as in posthog-python and posthog-go.💚 How did you test it?
test_request_context: the explicit-context test covers a filled option, an event option that wins, and anullevent option the context fills; the scoped test checks the option on queued, batch and exception events on the wire. Both fail without the change.exception_optionskeeps the caller's options and fills only unset ones, including a key set and then cleared withnull; it fails without the change.test_tower: an application context option reaches the handler's events; it fails without the change.test_request_context: a contextprocess_person_profile: truereaches a personless event, and an event's ownfalsestill wins; it fails without the change.cargo test --all-features(618 passed; 619 with fix!: fill a request context $set key by key and let the context beat flag-event defaults #316) and--no-default-features --features error-tracking,tls(479 passed),cargo clippy --tests -- -D warnings(with and withoutmcp),cargo fmt -- --check,scripts/check-public-api.sh.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Generated with Claude Code