Skip to content

feat(data-collection): Change stack_frame_variables to KeyValueCollection - #3066

Open
sl0thentr0py wants to merge 1 commit into
masterfrom
neel/data-collection/frame-vars
Open

feat(data-collection): Change stack_frame_variables to KeyValueCollection#3066
sl0thentr0py wants to merge 1 commit into
masterfrom
neel/data-collection/frame-vars

Conversation

@sl0thentr0py

@sl0thentr0py sl0thentr0py commented Aug 28, 2026

Copy link
Copy Markdown
Member

Issues

@linear-code

linear-code Bot commented Aug 28, 2026

Copy link
Copy Markdown

RUBY-201

Comment on lines 146 to 151
data_collection.graphql.variables = false
data_collection.database_query_data = false
data_collection.queues = false
data_collection.stack_frame_variables = configuration.include_local_variables
data_collection.frame_context_lines = configuration.context_lines
data_collection
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Setting config.include_local_variables = true before config.send_default_pii causes the local variable setting to be silently ignored due to the order of operations during initialization.
Severity: MEDIUM

Suggested Fix

Reinstate the logic in the DataCollection.backfill method to propagate the value from the deprecated configuration.include_local_variables setting to the new data_collection.stack_frame_variables instance variable. This ensures that the setting is preserved regardless of the configuration order. Also, add a test case that covers setting both include_local_variables and send_default_pii in the same configuration block to prevent regressions.

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: sentry-ruby/lib/sentry/data_collection.rb#L146-L151

Potential issue: When a user sets `config.include_local_variables = true` before
`config.send_default_pii` in the `Sentry.init` block, the setting for local variables is
lost. This happens because the setter for `send_default_pii` calls
`DataCollection.backfill`, which creates a new `DataCollection` instance. The new code
removed a line that previously propagated the `include_local_variables` value to this
new instance. As a result, `stack_frame_variables` defaults to `:off`, and no local
variables are captured, silently ignoring the user's explicit configuration.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 69a2c7f. Configure here.

data_collection.graphql.variables = false
data_collection.database_query_data = false
data_collection.queues = false
data_collection.stack_frame_variables = configuration.include_local_variables

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backfill drops local variables setting

Medium Severity

Setting include_local_variables no longer survives a later send_default_pii= assignment. backfill replaces data_collection without copying that flag, so collect_stack_frame_variables? stays off and local variables are not captured.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 69a2c7f. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data-collection: Gate frame vars

1 participant