Skip to content

fix(events): Debug param wasn't being passed down correctly#116152

Open
wmak wants to merge 1 commit into
masterfrom
wmak/fix/debug-param
Open

fix(events): Debug param wasn't being passed down correctly#116152
wmak wants to merge 1 commit into
masterfrom
wmak/fix/debug-param

Conversation

@wmak
Copy link
Copy Markdown
Member

@wmak wmak commented May 25, 2026

  • on tables the param wasn't being passed to the table_rpc
  • on timeseries the debug wasn't being included in the response meta

@wmak wmak requested review from a team as code owners May 25, 2026 21:25
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 25, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 11239c5. Configure here.

Comment thread src/sentry/api/endpoints/organization_events_timeseries.py
Comment on lines 430 to +431
@sentry_sdk.trace
def run_bulk_table_queries(cls, queries: list[TableQuery]) -> dict[str, EAPResponse]:
def run_bulk_table_queries(
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.

run_bulk_table_queries accepts debug but never forwards it to table_rpc or process_table_response

run_bulk_table_queries in src/sentry/snuba/rpc_dataset_common.py takes a debug: str | bool = False parameter, but neither the snuba_rpc.table_rpc([...]) call nor the per-response cls.process_table_response(...) call inside it receive debug. As a result, callers (e.g. organization_trace_meta.py, organization_ai_conversations.py) that request debug output via the bulk path get no debug_info attached to the response meta and no debug payload attached to raised exceptions, contradicting the PR's intent ("on tables the param wasn't being passed to the table_rpc"). The non-bulk _run_table_query correctly threads debug=debug into both calls, confirming the intended pattern.

Evidence
  • run_bulk_table_queries signature at line 431-432 declares debug: str | bool = False.
  • The body at line 449-451 calls snuba_rpc.table_rpc([...]) without debug=debug.
  • The subsequent dict-comprehension calls cls.process_table_response(response, request, context=process_context) without debug, so set_debug_meta (gated on if debug: at line 539) never runs for bulk results.
  • The sibling _run_table_query at lines 395 and 406 passes debug=debug to both table_rpc and process_table_response, establishing the intended contract.

Identified by Warden sentry-backend-bugs · 45U-PQ9

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.

Fix attempt detected (commit 3a35ee0)

The signature now accepts debug, but it is still not forwarded to snuba_rpc.table_rpc or cls.process_table_response, so debug_info is still not attached for bulk queries.

The original issue appears unresolved. Please review and try again.

Evaluated by Warden

- on tables the param wasn't being passed to the table_rpc
- on timeseries the debug wasn't being included in the response meta
@wmak wmak force-pushed the wmak/fix/debug-param branch from 11239c5 to 3a35ee0 Compare May 25, 2026 21:28
Comment on lines +431 to +433
def run_bulk_table_queries(
cls, queries: list[TableQuery], debug: str | bool = False
) -> dict[str, EAPResponse]:
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.

Bug: The debug parameter in run_bulk_table_queries is not used, so passing debug=True will not return any debug information as intended.
Severity: LOW

Suggested Fix

Pass the debug parameter from run_bulk_table_queries to both the snuba_rpc.table_rpc call and the cls.process_table_response call. This will ensure that when debug=True is provided, the debug information is correctly processed and included in the response, matching the behavior of the _run_table_query method.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/snuba/rpc_dataset_common.py#L431-L433

Potential issue: The `run_bulk_table_queries` method was updated to accept a `debug`
parameter, but this parameter is never used within the method's body. Specifically, it
is not passed to the `snuba_rpc.table_rpc` call or the `cls.process_table_response`
call. As a result, any caller attempting to use this feature by passing `debug=True`
will silently receive no debug information in the response, as the logic in
`process_table_response` that sets debug metadata will never be triggered. While current
callers do not use this parameter, the feature is inoperative.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant