Skip to content

Comments

feat(search_issues): Add flags field to search_issues dataset#7757

Open
sentry[bot] wants to merge 1 commit intomasterfrom
seer/feat-search-issues-flags
Open

feat(search_issues): Add flags field to search_issues dataset#7757
sentry[bot] wants to merge 1 commit intomasterfrom
seer/feat-search-issues-flags

Conversation

@sentry
Copy link
Contributor

@sentry sentry bot commented Feb 21, 2026

Fixes SNUBA-9VD. The issue was that: search_issues entity lacks flags_key mapping, causing Snuba query validation failure.

  • Added 'flags' and '_flags_hash_map' columns to the 'search_issues' entity and storage schemas.
  • Implemented data extraction and processing for the new 'flags' field in the 'search_issues_processor'.
  • Configured mappers and optimizers for 'flags' in the 'search_issues' dataset.

This fix was generated by Seer in Sentry, triggered by pierre.massat@sentry.io. 👁️ Run ID: 10536125

Not quite right? Click here to continue debugging with Seer.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@sentry sentry bot requested review from a team as code owners February 21, 2026 21:15
Comment on lines +163 to +173
self, event_data: IssueEventData, processed: MutableMapping[str, Any]
) -> None:
existing_flags = event_data.get("flags", None)
flags: Mapping[str, Any] = _as_dict_safe(cast(Dict[str, Any], existing_flags))
if not existing_flags:
processed["flags.key"], processed["flags.value"] = [], []
else:
processed["flags.key"], processed["flags.value"] = extract_nested(
flags, lambda s: _unicodify(s) or None
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug: The PR adds logic to process flags for search issues but is missing the required ClickHouse migration to add the flags and _flags_hash_map columns to the table.
Severity: CRITICAL

Suggested Fix

Add a new database migration for the search_issues storage. This migration should add the flags nested column and the _flags_hash_map materialized column with the FLAGS_HASH_MAP_COLUMN expression to the ClickHouse table schema.

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: snuba/datasets/processors/search_issues_processor.py#L162-L173

Potential issue: The `_process_flags` method populates `flags.key` and `flags.value` for
search issues. However, the pull request is missing a corresponding database migration
to add the necessary columns to the `search_issues` ClickHouse table. Without the
migration, the `flags` nested column and the `_flags_hash_map` materialized column will
not exist. This will cause any attempt to insert an event with flags to fail due to a
column mismatch error, breaking data ingestion for those events.

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

Copy link

@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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

else:
processed["flags.key"], processed["flags.value"] = extract_nested(
flags, lambda s: _unicodify(s) or None
)
Copy link

Choose a reason for hiding this comment

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

Flags extracted from wrong location with wrong format

High Severity

The _process_flags method reads flags from event_data["flags"] as a flat dict, but Sentry's event payload stores feature flags inside data.contexts.flags.values as a list of {"flag": "name", "result": value} objects. This is confirmed by the Rust errors processor and its tests in test_errors_processor.py. Since there's no flags key at the top level of event data, event_data.get("flags", None) will always return None, and flags.key/flags.value will always be empty lists — making the flags feature silently non-functional for search issues.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

0 participants