Skip to content

ref(analytics): Transform analytics events for TET-832 #95212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

constantinius
Copy link
Contributor

  • Transform event classes to use @analytics.eventclass decorator
  • Transform analytics.record calls to use event class instances
  • Update imports as needed

Closes TET-832

- Transform event classes to use @analytics.eventclass decorator
- Transform analytics.record calls to use event class instances
- Update imports as needed

Closes TET-832
@constantinius constantinius requested review from a team as code owners July 10, 2025 09:15
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 10, 2025
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.

Bug: Event Parameter Mismatch Causes Error

The analytics.record calls in create_comment.py and update_comment.py incorrectly pass a user_id parameter to IntegrationIssueCommentsSyncedEvent. This event class does not define a user_id field (only provider, id, and organization_id), which causes a TypeError when the event is instantiated. The previous analytics.record method would have ignored this extra parameter.

src/sentry/integrations/tasks/create_comment.py#L70-L78

note.save()
analytics.record(
IntegrationIssueCommentsSyncedEvent(
provider=installation.model.provider,
id=installation.model.id,
organization_id=external_issue.organization_id,
user_id=user_id,
)
)

src/sentry/integrations/tasks/update_comment.py#L70-L78

installation.update_comment(external_issue.key, user_id, note)
analytics.record(
IntegrationIssueCommentsSyncedEvent(
provider=installation.model.provider,
id=installation.model.id,
organization_id=external_issue.organization_id,
user_id=user_id,
)
)

Fix in CursorFix in Web


Bug: Discord Integration Status Type Error

Type mismatch in the DiscordIntegrationStatus event: the status field is defined as str but receives a Mapping[str, object], which can cause runtime errors.

src/sentry/integrations/discord/webhooks/message_component.py#L244-L251

if self.group:
analytics.record(
DiscordIntegrationStatus(
organization_id=self.group.organization.id,
user_id=self.user.id,
status=data,
)
)

src/sentry/integrations/discord/analytics.py#L42-L47

@analytics.eventclass("integrations.discord.status")
class DiscordIntegrationStatus(analytics.Event):
organization_id: str
user_id: str
status: str

Fix in CursorFix in Web


Bug: Undefined Parameter Causes Runtime Error

The GroupSimilarIssuesEmbeddingsCountEvent is instantiated with a hash parameter (hash=latest_event.get_primary_hash()) that is not defined in its class definition in src/sentry/api/analytics.py. This will cause a runtime error.

src/sentry/issues/endpoints/group_similar_issues_embeddings.py#L126-L142

analytics.record(
GroupSimilarIssuesEmbeddingsCountEvent(
organization_id=group.organization.id,
project_id=group.project.id,
group_id=group.id,
hash=latest_event.get_primary_hash(),
count_over_threshold=len(
[
result.stacktrace_distance
for result in results
if result.stacktrace_distance <= 0.01
]
),
user_id=request.user.id,
)
)

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link

codecov bot commented Jul 10, 2025

❌ 17695 Tests Failed:

Tests completed Failed Passed Skipped
27144 17695 9449 273
View the top 3 failed test(s) by shortest run time
tests.sentry.workflow_engine.migrations.test_0070_migrate_remaining_anomaly_detection_alerts.MigrateAnomalyDetectionAlertsTest::test_create_snoozed
Stack Traces | 0.006s run time
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint#x1B[0m
#x1B[1m#x1B[31mE   DETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".#x1B[0m
#x1B[1m#x1B[31mE   HINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.#x1B[0m

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:74: in handle
    connection.ops.execute_sql_flush(sql_list)
#x1B[1m#x1B[31m.venv/lib/python3.13.../backends/base/operations.py#x1B[0m:473: in execute_sql_flush
    cursor.execute(sql)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:122: in execute
    return super().execute(sql, params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../site-packages/sentry_sdk/utils.py#x1B[0m:1809: in runner
    return original_function(*args, **kwargs)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:79: in execute
    return self._execute_with_wrappers(
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:92: in _execute_with_wrappers
    return executor(sql, params, many, context)
#x1B[1m#x1B[.../sentry/testutils/hybrid_cloud.py#x1B[0m:133: in __call__
    return execute(*params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:100: in _execute
    with self.db.wrap_database_errors:
#x1B[1m#x1B[31m.venv/lib/python3.13.../django/db/utils.py#x1B[0m:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   django.db.utils.NotSupportedError: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[.../sentry/testutils/cases.py#x1B[0m:396: in _post_teardown
    super()._post_teardown()
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/__init__.py#x1B[0m:194: in call_command
    return command.execute(*args, **defaults)
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/base.py#x1B[0m:460: in execute
    output = self.handle(*args, **options)
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:76: in handle
    raise CommandError(
#x1B[1m#x1B[31mE   django.core.management.base.CommandError: Database test_region couldn't be flushed. Possible reasons:#x1B[0m
#x1B[1m#x1B[31mE     * The database isn't running or isn't configured correctly.#x1B[0m
#x1B[1m#x1B[31mE     * At least one of the expected database tables doesn't exist.#x1B[0m
#x1B[1m#x1B[31mE     * The SQL was invalid.#x1B[0m
#x1B[1m#x1B[31mE   Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.#x1B[0m
tests.sentry.workflow_engine.migrations.test_0070_migrate_remaining_anomaly_detection_alerts.MigrateAnomalyDetectionAlertsTest::test_skip_correctly_dual_written_rule
Stack Traces | 0.006s run time
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint#x1B[0m
#x1B[1m#x1B[31mE   DETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".#x1B[0m
#x1B[1m#x1B[31mE   HINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.#x1B[0m

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:74: in handle
    connection.ops.execute_sql_flush(sql_list)
#x1B[1m#x1B[31m.venv/lib/python3.13.../backends/base/operations.py#x1B[0m:473: in execute_sql_flush
    cursor.execute(sql)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:122: in execute
    return super().execute(sql, params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../site-packages/sentry_sdk/utils.py#x1B[0m:1809: in runner
    return original_function(*args, **kwargs)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:79: in execute
    return self._execute_with_wrappers(
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:92: in _execute_with_wrappers
    return executor(sql, params, many, context)
#x1B[1m#x1B[.../sentry/testutils/hybrid_cloud.py#x1B[0m:133: in __call__
    return execute(*params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:100: in _execute
    with self.db.wrap_database_errors:
#x1B[1m#x1B[31m.venv/lib/python3.13.../django/db/utils.py#x1B[0m:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   django.db.utils.NotSupportedError: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[.../sentry/testutils/cases.py#x1B[0m:396: in _post_teardown
    super()._post_teardown()
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/__init__.py#x1B[0m:194: in call_command
    return command.execute(*args, **defaults)
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/base.py#x1B[0m:460: in execute
    output = self.handle(*args, **options)
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:76: in handle
    raise CommandError(
#x1B[1m#x1B[31mE   django.core.management.base.CommandError: Database test_region couldn't be flushed. Possible reasons:#x1B[0m
#x1B[1m#x1B[31mE     * The database isn't running or isn't configured correctly.#x1B[0m
#x1B[1m#x1B[31mE     * At least one of the expected database tables doesn't exist.#x1B[0m
#x1B[1m#x1B[31mE     * The SQL was invalid.#x1B[0m
#x1B[1m#x1B[31mE   Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.#x1B[0m
tests.sentry.workflow_engine.migrations.test_0071_migrate_remaining_metric_alerts.MigrateMetricAlertsTest::test_simple_trigger
Stack Traces | 0.006s run time
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint#x1B[0m
#x1B[1m#x1B[31mE   DETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".#x1B[0m
#x1B[1m#x1B[31mE   HINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.#x1B[0m

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   psycopg2.errors.FeatureNotSupported: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:74: in handle
    connection.ops.execute_sql_flush(sql_list)
#x1B[1m#x1B[31m.venv/lib/python3.13.../backends/base/operations.py#x1B[0m:473: in execute_sql_flush
    cursor.execute(sql)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:122: in execute
    return super().execute(sql, params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../site-packages/sentry_sdk/utils.py#x1B[0m:1809: in runner
    return original_function(*args, **kwargs)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:79: in execute
    return self._execute_with_wrappers(
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:92: in _execute_with_wrappers
    return executor(sql, params, many, context)
#x1B[1m#x1B[.../sentry/testutils/hybrid_cloud.py#x1B[0m:133: in __call__
    return execute(*params)
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:100: in _execute
    with self.db.wrap_database_errors:
#x1B[1m#x1B[31m.venv/lib/python3.13.../django/db/utils.py#x1B[0m:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
#x1B[1m#x1B[31m.venv/lib/python3.13.../db/backends/utils.py#x1B[0m:103: in _execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:77: in inner
    raise_the_exception(self.db, e)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:75: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:18: in inner
    return func(self, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:93: in inner
    raise type(e)(f"{e!r}\nSQL: {sql}").with_traceback(e.__traceback__)
#x1B[1m#x1B[.../db/postgres/decorators.py#x1B[0m:91: in inner
    return func(self, sql, *args, **kwargs)
#x1B[1m#x1B[.../db/postgres/base.py#x1B[0m:85: in execute
    return self.cursor.execute(sql)
#x1B[1m#x1B[31mE   django.db.utils.NotSupportedError: FeatureNotSupported('cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table "workflow_engine_actiongroupstatus" references "workflow_engine_action".\nHINT:  Truncate table "workflow_engine_actiongroupstatus" at the same time, or use TRUNCATE ... CASCADE.\n')#x1B[0m
#x1B[1m#x1B[31mE   SQL: TRUNCATE "explore_exploresavedquery", "sentry_dashboardproject", "sentry_organizationmember_teams", "sentry_pull_request", "sentry_promptsactivity", "sentry_exporteddata", "sentry_servicehookproject", "sentry_exporteddatablob", "sentry_dashboardwidgetquery", "sentry_recentsearch", "sentry_relocation", "workflow_engine_alertruleworkflow", "sentry_organizationoptions", "sentry_fileblobowner", "sentry_incidenttrigger", "sentry_notificationaction", "sentry_organizationaccessrequest", "sentry_notificationmessage", "sentry_regiontombstone", "workflow_engine_incidentgroupopenperiod", "sentry_customdynamicsamplingrule", "sentry_groupsearchviewlastvisited", "sentry_grouphash", "sentry_dashboardpermissionsteam", "sentry_regionimportchunk", "sentry_projectplatform", "explore_exploresavedquerylastvisited", "sentry_groupemailthread", "sentry_alertruletriggeraction", "uptime_uptimesubscription", "sentry_externalactor", "sentry_proguardartifactrelease", "sentry_alertruleprojects", "sentry_releasecommit", "sentry_projectartifactbundle", "sentry_environment", "sentry_projecttemplateoption", "sentry_discoversavedqueryproject", "sentry_stringindexer", "hybridcloud_apikeyreplica", "sentry_projectcounter", "flags_webhooksigningsecret", "sentry_dashboardpermissions", "sentry_snubaquery", "sentry_groupredirect", "sentry_projectkey", "sentry_relocationvalidation", "sentry_projectteam", "sentry_environmentrelease", "workflow_engine_action", "workflow_engine_workflow", "sentry_groupseen", "workflow_engine_dataconditiongroup", "workflow_engine_actionalertruletriggeraction", "sentry_projecttemplate", "sentry_alertrule", "fixtures_bitfieldtestmodel", "sentry_environmentproject", "sentry_projectsdk", "flags_audit_log", "sentry_relayusage", "sentry_projectownership", "sentry_dashboardwidget", "sentry_groupowner", "sentry_projectdsymfile", "workflow_engine_dataconditionalertruletrigger", "sentry_deletedorganization", "sentry_regionrelocationtransfer", "fixtures_callabledefaultmodel", "sentry_release_project", "fixtures_bitfieldtestmodelwithdefaultsaskeynames", "sentry_commit", "sentry_projecttransactionthreshold", "sentry_groupinbox", "sentry_dashboardfavoriteuser", "sentry_grouplink", "sentry_release", "sentry_relocationvalidationattempt", "sentry_commitfilechange", "sentry_featureadoption", "sentry_organizationonboardingtask", "fixtures_regionmodel", "sentry_customdynamicsamplingruleproject", "sentry_rollbackorganization", "workflow_engine_workflowactiongroupstatus", "explore_exploresavedquerystarred", "sentry_file", "sentry_debugidartifactbundle", "sentry_authidentityreplica", "fixtures_blankjsonfieldtestmodel", "sentry_performanceteamkeytransaction", "sentry_team", "sentry_projectbookmark", "sentry_controlimportchunkreplica", "sentry_groupshare", "sentry_incident", "sentry_userreport", "sentry_rulesnooze", "insights_starred_segments", "sentry_groupsearchviewstarred", "sentry_releaseactivity", "sentry_relay", "workflow_engine_detectorworkflow", "sentry_groupbookmark", "sentry_savedsearch", "sentry_artifactbundleindex", "sentry_option", "sentry_groupmeta", "sentry_releaseheadcommit", "sentry_projectcodeowners", "fixtures_donothingintegrationmodel", "sentry_discoversavedquery", "fixtures_jsonfieldwithdefaulttestmodel", "feedback_feedback", "workflow_engine_datacondition", "sentry_releaseartifactbundle", "sentry_dashboardtombstone", "sentry_rule", "sentry_dashboard", "sentry_groupedmessage", "workflow_engine_detector", "sentry_groupcommitresolution", "fixtures_jsonfieldtestmodel", "sentry_regionscheduleddeletion", "workflow_engine_datasourcedetector", "sentry_projectoptions", "sentry_servicehook", "sentry_notificationactionproject", "sentry_repositoryprojectpathconfig", "sentry_groupsearchview", "sentry_regionoutbox", "sentry_relocationfile", "hybridcloud_organizationslugreservationreplica", "fixtures_modelonmonolith", "sentry_alertruleactivity", "sentry_perfstringindexer", "sentry_releasethreshold", "hybridcloud_apitokenreplica", "sentry_ruleactivity", "tempest_tempestcredentials", "sentry_incidentactivity", "sentry_projectredirect", "sentry_groupresolution", "sentry_deletedteam", "nodestore_node", "workflow_engine_workflowfirehistory", "sentry_pullrequest_comment", "sentry_organizationmember", "sentry_groupsubscription", "sentry_fileblobindex", "sentry_grouprelease", "workflow_engine_detectorstate", "sentry_releasefile", "sentry_groupsnooze", "sentry_pullrequest_commit", "sentry_grouphashmetadata", "workflow_engine_datasource", "sentry_distribution", "sentry_deploy", "sentry_artifactbundle", "sentry_deletedproject", "sentry_regressiongroup", "uptime_uptimesubscriptionregion", "sentry_eventattachment", "uptime_projectuptimesubscription", "workflow_engine_alertruledetector", "sentry_platformexternalissue", "hybridcloud_orgauthtokenreplica", "sentry_organizationavatar", "sentry_authproviderreplica", "sentry_repository", "sentry_organizationmemberinvite", "sentry_sentryshot", "sentry_querysubscription", "sentry_neglectedrule", "sentry_groupopenperiod", "sentry_groupenvironment", "sentry_grouptombstone", "sentry_latestrelease", "sentry_preprodartifactsizemetrics", "sentry_commitauthor", "sentry_groupsearchviewproject", "sentry_groupasignee", "sentry_projecttransactionthresholdoverride", "workflow_engine_workflowdataconditiongroup", "sentry_grouphistory", "sentry_incidentproject", "sentry_externalissue", "sentry_snubaqueryeventtype", "sentry_preprodbuildconfiguration", "fixtures_cachemodel", "sentry_datasecrecywaiver", "sentry_organization", "sentry_grouprulestatus", "explore_exploresavedqueryproject", "fixtures_mockmodel", "sentry_rulefirehistory", "sentry_preprodartifact", "workflow_engine_dataconditiongroupaction", "sentry_project", "hybridcloud_regioncacheversion", "sentry_releaseprojectenvironment", "fixtures_jsonwritingpicklemodel", "replays_replayrecordingsegment", "sentry_activity", "sentry_dashboardwidgetqueryondemand", "sentry_fileblob", "sentry_alertruletrigger", "replays_replaydeletionjob", "sentry_rollbackuser";#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[.../sentry/testutils/cases.py#x1B[0m:396: in _post_teardown
    super()._post_teardown()
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/__init__.py#x1B[0m:194: in call_command
    return command.execute(*args, **defaults)
#x1B[1m#x1B[31m.venv/lib/python3.13.../core/management/base.py#x1B[0m:460: in execute
    output = self.handle(*args, **options)
#x1B[1m#x1B[31m.venv/lib/python3.13.../management/commands/flush.py#x1B[0m:76: in handle
    raise CommandError(
#x1B[1m#x1B[31mE   django.core.management.base.CommandError: Database test_region couldn't be flushed. Possible reasons:#x1B[0m
#x1B[1m#x1B[31mE     * The database isn't running or isn't configured correctly.#x1B[0m
#x1B[1m#x1B[31mE     * At least one of the expected database tables doesn't exist.#x1B[0m
#x1B[1m#x1B[31mE     * The SQL was invalid.#x1B[0m
#x1B[1m#x1B[31mE   Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

DiscordIntegrationStatus(
organization_id=self.group.organization.id,
user_id=self.user.id,
status=data,
Copy link
Member

Choose a reason for hiding this comment

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

is this right? status should be a string right, but data is a dict?

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.

2 participants