ref(seer): Add viewer_context passthrough to all Seer API wrappers#109697
Merged
ref(seer): Add viewer_context passthrough to all Seer API wrappers#109697
Conversation
Propagate the optional `viewer_context: SeerViewerContext | None` kwarg through all 51 wrapper functions that call `make_signed_seer_api_request`. This enables callers to pass organization and user context which gets HMAC-signed into `X-Viewer-Context` headers for Seer access control. No call sites are changed yet — all new params default to `None`.
gricha
approved these changes
Mar 2, 2026
This was referenced Mar 2, 2026
azulus
added a commit
that referenced
this pull request
Mar 3, 2026
Pass `SeerViewerContext` to all Seer API wrapper call sites in the replays module. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates the replays module call sites: - **Endpoint** (`project_replay_summary`): Pass both `organization_id` and `user_id` to start/state requests - **Delete usecase** (`delete.py`): Pass `organization_id` only (background task, no user context) No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 3, 2026
…09719) Pass `SeerViewerContext` through similarity/grouping code to all Seer call sites. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR threads it through `get_similarity_data_from_seer()` and updates all callers: - **Endpoint** (`group_similar_issues_embeddings`): Pass both `organization_id` and `user_id` - **Grouping ingest** (`seer.py`): Pass `organization_id` only from `event.project` (no user in ingest context) No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
…109718) Pass `SeerViewerContext` through breakpoint detection to all call sites. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR threads it through `detect_breakpoints()` and updates all callers: - **Endpoints** (`organization_events_trends_v2`, `organization_profiling_functions`): Pass both `organization_id` and `user_id` - **Statistical detector tasks**: Pass `organization_id` only (background task, no user) - Uses `functools.partial` for `ThreadPoolExecutor.map` compatibility in trends endpoint No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
…tes (#109720) Pass `SeerViewerContext` to all Seer API wrapper call sites in anomaly detection. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR constructs context at each call site from available org data: - `get_anomaly_data.py`: From `subscription.project.organization_id` - `store_data.py`: From `alert_rule.organization.id` - `store_data_workflow_engine.py`: From `project.organization.id` - `delete_rule.py`: From `organization.id` - `get_historical_anomalies.py`: From `organization_id` parameter All are background/task contexts with org only (no user). No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
) Pass `SeerViewerContext` to all Seer API wrapper call sites in the feedback module. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates the call sites in the feedback module to construct and pass `SeerViewerContext` from available org/user data: - **Endpoints** (`organization_feedback_categories`, `organization_feedback_summary`): Pass both `organization_id` and `user_id` - **Ingest** (`create_feedback`): Pass `organization_id` only (no user in ingest context) - **Intermediate functions** (`spam_detection`, `label_generation`, `title_generation`): Thread `viewer_context` parameter through to underlying API calls No behavior change — `viewer_context` defaults to `None` which preserves the existing behavior of not sending the header. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
) Pass `SeerViewerContext` to all Seer API wrapper call sites in the explorer module. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates the explorer module call sites: - **SeerExplorerClient**: Builds context from `self.organization` and `self.user` in `__init__`, passes to `start_run`, `continue_run`, `get_runs`, `push_changes` - **Service map utils** (`_send_to_seer`): Pass `organization_id` only (no user available) No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
…109717) Pass `SeerViewerContext` to the Seer API call site in the code review webhook task. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates `process_github_webhook_event()` to extract `sentry_organization_id` from the tags dict and construct a `SeerViewerContext` when available. No behavior change — if tags are missing or don't contain the org ID, `viewer_context` remains `None`. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
#109721) Pass `SeerViewerContext` to Seer API call sites in LLM issue detection and event manager. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates two call sites: - **LLM issue detection task**: Constructs context from `organization_id` already in scope - **Event manager severity scoring**: Constructs context from `event.project.organization_id` (already loaded, no extra DB query) Both are background contexts with org only (no user). No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
Pass `SeerViewerContext` to all Seer API wrapper call sites in the autofix module. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates autofix call sites: - **`_call_autofix()`**: Pass `organization_id` + `user_id` (when not anonymous) - **`update_autofix()`**: Pass `organization_id` only - **`utils.py`** (`get_autofix_state`, `bulk_get/set_project_preferences`): Pass `organization_id` only - **`issue_summary.py`** (`_call_seer`, `_generate_fixability_score`): Pass `organization_id` from group - **`project_seer_preferences` endpoint**: Pass both `organization_id` and `user_id` - **`tasks/seer.py`** (`cleanup_seer_repository_preferences`): Pass `organization_id` only - **Skipped**: `_fetch_user_preference` (only has `project_id`, no org context) No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
) Pass `SeerViewerContext` to Seer API wrapper call sites in various Seer endpoint modules. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates 8 files: - `compare.py` + `organization_trace_item_attributes_ranked.py`: Compare distributions - `issue_view_title_generate.py`: Title generation from query - `search_agent_state.py`, `search_agent_start.py`: Search agent endpoints - `trace_explorer_ai_query.py`, `trace_explorer_ai_translate_agentic.py`, `trace_explorer_ai_setup.py`: Trace explorer AI endpoints All are API endpoints with both `organization_id` and `user_id` available. Intermediate functions thread `viewer_context` through to the underlying wrapper calls. No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
azulus
added a commit
that referenced
this pull request
Mar 4, 2026
…#109724) Pass `SeerViewerContext` to Seer API wrapper call sites in background tasks and utility modules. PR #109697 added an optional `viewer_context` parameter to all Seer API wrapper functions. This PR updates: - **`context_engine_index.py`**: Pass `organization_id` from `org_id` param - **`seer_explorer_index.py`**: Pass `organization_id` from project tuples - **`trace_summary.py`**: Pass `organization_id` + optional `user_id` (when user is not None/anonymous) - **`supergroups.py`**: Pass `organization_id` from param - **Skipped**: `seer_models.py` (no auth), `uptime/seer_assertions.py` (no context) No behavior change — `viewer_context` defaults to `None` which preserves existing behavior. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
viewer_context: SeerViewerContext | Nonekwarg through all 51 wrapper functions across 15 files that callmake_signed_seer_api_request()X-Viewer-Context/X-Viewer-Context-Signatureheaders for Seer access controlNone— no call sites are changed yetBuilds on #109626 which added
viewer_contextsupport tomake_signed_seer_api_request().Test plan
None), so existing behavior is unchanged