Skip to content

feat(alerts): Add pure Detector/Workflow version of OrganizationCombinedRuleIndexEndpoint#110700

Draft
kcons wants to merge 1 commit intomasterfrom
kcons/combinedplz
Draft

feat(alerts): Add pure Detector/Workflow version of OrganizationCombinedRuleIndexEndpoint#110700
kcons wants to merge 1 commit intomasterfrom
kcons/combinedplz

Conversation

@kcons
Copy link
Member

@kcons kcons commented Mar 13, 2026

Not quite happy with the import cycle issues, and concerned about performance especially in sorting and filtering cases.

Fixes ISWF-2189.

@linear-code
Copy link

linear-code bot commented Mar 13, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 13, 2026
uptime_rules = uptime_rules.filter(name__icontains=name)
crons_rules = crons_rules.filter(name__icontains=name)

if not features.has("organizations:performance-view", organization):
Copy link
Contributor

Choose a reason for hiding this comment

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

Invalid dataset parameter causes uncaught ValueError

The code at line 424 converts user-provided dataset query parameters directly to Dataset enum objects with Dataset(d) without validation. If a user provides an invalid dataset value (e.g., ?dataset=invalid), Python's Enum constructor raises a ValueError which is uncaught, resulting in a 500 error instead of a proper 400 Bad Request response.

Verification

Verified by reading the Dataset enum definition in src/sentry/snuba/dataset.py which shows it's a standard Python Enum. Enum(value) raises ValueError for invalid values. Compared to legacy path at line 655 which uses raw strings without enum conversion. The datasets variable comes directly from request.GET.getlist('dataset', []) at line 587 with no validation.

Also found at 1 additional location
  • src/sentry/incidents/endpoints/organization_alert_rule_index.py:600-600

Identified by Warden sentry-backend-bugs · UJP-SDW

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Backend Test Failures

Failures on dbbaadd in this run:

tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py::AlertRuleDetailsGetEndpointTest::test_workflow_engine_serializerlog
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:321: in test_workflow_engine_serializer
    assert resp.data["id"] == str(self.alert_rule.id)
E   TypeError: 'NoneType' object is not subscriptable
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py::AlertRuleDetailsGetEndpointTest::test_non_dual_written_detector_serializationlog
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:940: in test_non_dual_written_detector_serialization
    assert resp.data["id"] == str(fake_id)
E   TypeError: 'NoneType' object is not subscriptable
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py::AlertRuleDetailsGetEndpointTest::test_workflow_engine_serializer_anomaly_detectionlog
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:450: in test_workflow_engine_serializer_anomaly_detection
    assert new_data["status"] == AlertRuleStatus.PENDING.value
E   TypeError: 'NoneType' object is not subscriptable
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py::AlertRuleDetailsGetEndpointTest::test_workflow_engine_serializer_matches_old_serializerlog
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:342: in test_workflow_engine_serializer_matches_old_serializer
    self.assert_alert_detail_results_match(old_data, new_data)
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:240: in assert_alert_detail_results_match
    if field not in new_data:
E   TypeError: argument of type 'NoneType' is not iterable
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py::AlertRuleDetailsGetEndpointTest::test_workflow_engine_serializer_snoozed_alert_rulelog
tests/sentry/incidents/endpoints/test_organization_alert_rule_details.py:377: in test_workflow_engine_serializer_snoozed_alert_rule
    assert new_data["snooze"] is True
E   TypeError: 'NoneType' object is not subscriptable

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