Skip to content

Commit ed88b2e

Browse files
roggenkemperclaude
andcommitted
fix(issue-detection): Map ai_issue_detection_enabled to AIDetectedGeneralGroupType for audit log
The parent toggle had no entry in project_settings_to_group_map, causing an empty audit log message when toggled. Map it to AIDetectedGeneralGroupType so the audit log renders a meaningful description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 289ebe7 commit ed88b2e

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/sentry/audit_log/events.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,12 @@ def render(self, audit_log_entry: AuditLogEntry) -> str:
183183
project_settings_to_group_map as map,
184184
)
185185

186-
PARENT_SETTING_DESCRIPTIONS: dict[str, str] = {
187-
"ai_issue_detection_enabled": "AI issue detection",
188-
}
189-
190186
data = audit_log_entry.data
191-
items = []
192-
for key, value in data.items():
193-
action = "enable" if value else "disable"
194-
if key in map:
195-
items.append(f"to {action} detection of {map[key].description} issue")
196-
elif key in PARENT_SETTING_DESCRIPTIONS:
197-
items.append(f"to {action} {PARENT_SETTING_DESCRIPTIONS[key]}")
198-
items_string = ", ".join(items)
187+
items_string = ", ".join(
188+
f"to {'enable' if value else 'disable'} detection of {map[key].description} issue"
189+
for (key, value) in data.items()
190+
if key in map.keys()
191+
)
199192
return "edited project performance issue detector settings " + items_string
200193

201194

src/sentry/issues/endpoints/project_performance_issue_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class ConfigurableThresholds(Enum):
116116
InternalProjectOptions.FUNCTION_DURATION_REGRESSION.value: ProfileFunctionRegressionType,
117117
ConfigurableThresholds.DB_QUERY_INJECTION.value: QueryInjectionVulnerabilityGroupType,
118118
ConfigurableThresholds.WEB_VITALS.value: WebVitalsGroup,
119+
ConfigurableThresholds.AI_ISSUE_DETECTION.value: AIDetectedGeneralGroupType,
119120
ConfigurableThresholds.AI_DETECTED_HTTP.value: AIDetectedHTTPGroupType,
120121
ConfigurableThresholds.AI_DETECTED_DB.value: AIDetectedDBGroupType,
121122
ConfigurableThresholds.AI_DETECTED_RUNTIME_PERFORMANCE.value: AIDetectedRuntimePerformanceGroupType,

0 commit comments

Comments
 (0)