Skip to content

chore(seer-activity): Remove unused flag#119081

Draft
leeandher wants to merge 1 commit into
masterfrom
leanderrodrigues/iswf-2738-clean-up-feature-flags-and-dead-code-rm
Draft

chore(seer-activity): Remove unused flag#119081
leeandher wants to merge 1 commit into
masterfrom
leanderrodrigues/iswf-2738-clean-up-feature-flags-and-dead-code-rm

Conversation

@leeandher

Copy link
Copy Markdown
Member

@linear-code

linear-code Bot commented Jul 6, 2026

Copy link
Copy Markdown

ISWF-2738

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 6, 2026
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable seer activities to be evaluated in workflow engine
manager.add("organizations:workflow-engine-evaluate-seer-activities", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable our logs product (known internally as ourlogs) in UI and backend

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 feature flag organizations:workflow-engine-evaluate-seer-activities is being de-registered while still being used in multiple production code paths, which will cause silent functional regressions.
Severity: HIGH

Suggested Fix

Ensure that the dependent pull request which removes all usages of the organizations:workflow-engine-evaluate-seer-activities feature flag is merged before this pull request. This will prevent a state where the flag is de-registered but still referenced in active code.

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/features/temporary.py#L402

Potential issue: This pull request removes the registration for the feature flag
`organizations:workflow-engine-evaluate-seer-activities`. However, this flag is still
actively used in four production code paths. The `features.has()` check for an
unregistered flag will silently return `False` instead of raising an error. This will
cause silent functional regressions by disabling Seer activity processing across all
dependent code paths, such as skipping seer activity handlers, falling back to different
notification logic, and filtering out `SEER_ACTIVITY_TRIGGER` conditions from API
results.

Also affects:

  • src/sentry/workflow_engine/handlers/workflow/workflow_activity_handlers.py:63
  • src/sentry/notifications/notification_action/utils.py:59
  • src/sentry/notifications/notification_action/action_handler_registry/webhook_handler.py:66
  • src/sentry/workflow_engine/endpoints/organization_data_condition_index.py:71

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

@cursor cursor Bot left a comment

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.

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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d2f7264. Configure here.

manager.add("organizations:workflow-engine-issue-alert-endpoints-put", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable metric detector limits by plan type
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable seer activities to be evaluated in workflow engine

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.

Flag removal disables seer paths

Medium Severity

Removing registration for organizations:workflow-engine-evaluate-seer-activities while production code still gates seer-activity workflow handling, notifications, and the data-condition index on features.has for that name makes those checks always evaluate false once the flag is unregistered. Tests that enable the flag via Feature or with_feature also fail because the test helper requires a registered feature.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d2f7264. Configure here.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 8be2f19 in this run:

tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py::SeerActivityHandlerTest::test_falls_back_to_issue_stream_detectorlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
src/sentry/features/manager.py:219: in _get_feature_class
    return self._feature_registry[name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   KeyError: 'organizations:workflow-engine-evaluate-seer-activities'

During handling of the above exception, another exception occurred:
src/sentry/testutils/helpers/features.py:72: in features_override
    feature = features.get(name, None)
              ^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:229: in get
    cls = self._get_feature_class(name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:221: in _get_feature_class
    raise FeatureNotRegistered(name)
E   sentry.features.exceptions.FeatureNotRegistered: The "organizations:workflow-engine-evaluate-seer-activities" feature has not been registered. Ensure that a feature has been added to sentry.features.default_manager

During handling of the above exception, another exception occurred:
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py:119: in test_falls_back_to_issue_stream_detector
    seer_activity_handler(self.group, self.activity, None)
src/sentry/workflow_engine/handlers/workflow/workflow_activity_handlers.py:62: in seer_activity_handler
    if not features.has(
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1167: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1171: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1232: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/testutils/helpers/features.py:74: in features_override
    raise ValueError("Unregistered feature flag: %s", repr(name))
E   ValueError: ('Unregistered feature flag: %s', "'organizations:workflow-engine-evaluate-seer-activities'")
tests/sentry/workflow_engine/endpoints/test_organization_data_condition_index.py::OrganizationDataConditionIndexBaseTest::test_seer_activity_trigger_shown_with_featurelog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/workflow_engine/endpoints/test_organization_data_condition_index.py:156: in test_seer_activity_trigger_shown_with_feature
    response = self.get_success_response(
src/sentry/testutils/cases.py:627: in get_success_response
    assert_status_code(response, status_code)
src/sentry/testutils/asserts.py:46: in assert_status_code
    assert minimum <= response.status_code < maximum, response
E   AssertionError: <Response status_code=500, "application/json">
E   assert 500 < 201
E    +  where 500 = <Response status_code=500, "application/json">.status_code
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py::SeerActivityHandlerTest::test_all_supported_activity_types_dispatchlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
src/sentry/features/manager.py:219: in _get_feature_class
    return self._feature_registry[name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   KeyError: 'organizations:workflow-engine-evaluate-seer-activities'

During handling of the above exception, another exception occurred:
src/sentry/testutils/helpers/features.py:72: in features_override
    feature = features.get(name, None)
              ^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:229: in get
    cls = self._get_feature_class(name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:221: in _get_feature_class
    raise FeatureNotRegistered(name)
E   sentry.features.exceptions.FeatureNotRegistered: The "organizations:workflow-engine-evaluate-seer-activities" feature has not been registered. Ensure that a feature has been added to sentry.features.default_manager

During handling of the above exception, another exception occurred:
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py:52: in test_all_supported_activity_types_dispatch
    seer_activity_handler(self.group, activity, None)
src/sentry/workflow_engine/handlers/workflow/workflow_activity_handlers.py:62: in seer_activity_handler
    if not features.has(
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1167: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1171: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1232: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/testutils/helpers/features.py:74: in features_override
    raise ValueError("Unregistered feature flag: %s", repr(name))
E   ValueError: ('Unregistered feature flag: %s', "'organizations:workflow-engine-evaluate-seer-activities'")
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py::SeerActivityHandlerTest::test_skips_when_no_detectorlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
src/sentry/features/manager.py:219: in _get_feature_class
    return self._feature_registry[name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   KeyError: 'organizations:workflow-engine-evaluate-seer-activities'

During handling of the above exception, another exception occurred:
src/sentry/testutils/helpers/features.py:72: in features_override
    feature = features.get(name, None)
              ^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:229: in get
    cls = self._get_feature_class(name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:221: in _get_feature_class
    raise FeatureNotRegistered(name)
E   sentry.features.exceptions.FeatureNotRegistered: The "organizations:workflow-engine-evaluate-seer-activities" feature has not been registered. Ensure that a feature has been added to sentry.features.default_manager

During handling of the above exception, another exception occurred:
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py:85: in test_skips_when_no_detector
    seer_activity_handler(self.group, self.activity, None)
src/sentry/workflow_engine/handlers/workflow/workflow_activity_handlers.py:62: in seer_activity_handler
    if not features.has(
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1167: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1171: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1232: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/testutils/helpers/features.py:74: in features_override
    raise ValueError("Unregistered feature flag: %s", repr(name))
E   ValueError: ('Unregistered feature flag: %s', "'organizations:workflow-engine-evaluate-seer-activities'")
tests/sentry/notifications/notification_action/test_activity_handler.py::TestExecuteViaGroupTypeRegistryActivityPath::test_option_enabled_uses_registrylog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/test_activity_handler.py:118: in test_option_enabled_uses_registry
    mock_execute.assert_called_once_with(invocation=invocation)
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:988: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'execute_via_activity_type_registry' to be called once. Called 0 times.
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py::SeerActivityHandlerTest::test_uses_group_detectorlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
src/sentry/features/manager.py:219: in _get_feature_class
    return self._feature_registry[name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   KeyError: 'organizations:workflow-engine-evaluate-seer-activities'

During handling of the above exception, another exception occurred:
src/sentry/testutils/helpers/features.py:72: in features_override
    feature = features.get(name, None)
              ^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:229: in get
    cls = self._get_feature_class(name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/features/manager.py:221: in _get_feature_class
    raise FeatureNotRegistered(name)
E   sentry.features.exceptions.FeatureNotRegistered: The "organizations:workflow-engine-evaluate-seer-activities" feature has not been registered. Ensure that a feature has been added to sentry.features.default_manager

During handling of the above exception, another exception occurred:
tests/sentry/workflow_engine/handlers/workflow/test_workflow_activity_handlers.py:99: in test_uses_group_detector
    seer_activity_handler(self.group, self.activity, None)
src/sentry/workflow_engine/handlers/workflow/workflow_activity_handlers.py:62: in seer_activity_handler
    if not features.has(
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1167: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1171: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:1232: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/testutils/helpers/features.py:74: in features_override
    raise ValueError("Unregistered feature flag: %s", repr(name))
E   ValueError: ('Unregistered feature flag: %s', "'organizations:workflow-engine-evaluate-seer-activities'")

@leeandher leeandher marked this pull request as draft July 6, 2026 20:59
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