Skip to content

fix: auto-convert boolean integers to strings in tag conditions#7682

Closed
kylemumma wants to merge 5 commits intomasterfrom
fix-boolean-tag-validation
Closed

fix: auto-convert boolean integers to strings in tag conditions#7682
kylemumma wants to merge 5 commits intomasterfrom
fix-boolean-tag-validation

Conversation

@kylemumma
Copy link
Member

@kylemumma kylemumma commented Jan 28, 2026

dont review, this is for an experiment

Superpowers Generate

Summary

Fixes validation error when boolean fields (0/1) are used in tag conditions by auto-converting integer literals to strings in TagConditionValidator.

Problem

Issue SNUBA-9VC reported validation failures like:

Validation failed for entity search_issues: invalid tag condition on 'tags[stack.in_app]': 1 must be a string

This occurs when boolean search filters (like error.main_thread:1) are:

  1. Parsed with integer values (0 or 1)
  2. Classified as tags (when not in entity schema)
  3. Sent to Snuba with integer literals in tag conditions

Since tags are always strings in ClickHouse, the TagConditionValidator rejected these integer values.

Solution

Modified TagConditionValidator to automatically convert integer literals 0 and 1 to their string equivalents "0" and "1" when they appear in tag conditions. This handles both:

  • Single value comparisons: tags[error.main_thread] = 1tags[error.main_thread] = "1"
  • Array comparisons: tags[field] IN [0, 1]tags[field] IN ["0", "1"]

Non-boolean integers (like 419) still fail validation as expected.

Testing

  • Added unit tests for boolean integer conversion in tag conditions
  • Added integration tests with search_issues entity
  • Verified no regressions in existing validator tests

Fixes SNUBA-9VC

🤖 Generated with Claude Code

Claude Code added 5 commits January 28, 2026 12:04
Boolean search filters (like error.main_thread) are parsed with integer
values (0 or 1) but can be classified as tags when not in entity schema.
Since tags are always strings in ClickHouse, we now auto-convert integer
literals 0 and 1 to '0' and '1' in tag conditions.

This allows queries like 'error.main_thread:1' to work correctly even
when the field is treated as a tag.

Fixes SNUBA-9VC
Verify that the TagConditionValidator fix works correctly with the
search_issues entity for real-world scenarios like error.main_thread
and stack.in_app.

Refs SNUBA-9VC
@kylemumma kylemumma requested a review from a team as a code owner January 28, 2026 20:21
@kylemumma kylemumma marked this pull request as draft January 28, 2026 20:23
@kylemumma kylemumma closed this Feb 2, 2026
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.

1 participant