Skip to content

Commit 9af4d00

Browse files
roggenkemperclaude
andcommitted
feat(issue-detection): Check per-group-type settings before creating issues
Add GROUP_TYPE_TO_SETTING mapping and check the project's performance issue settings for the specific group type (e.g., ai_detected_http_enabled) before producing an issue occurrence. This allows users to disable specific AI detection categories while keeping others enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d1f4f28 commit 9af4d00

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/sentry/tasks/llm_issue_detection/detection.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ def get_base_platform(platform: str | None) -> str | None:
168168
"Deprecation Warning": AIDetectedCodeHealthGroupType,
169169
}
170170

171+
GROUP_TYPE_TO_SETTING: dict[type[GroupType], str] = {
172+
AIDetectedHTTPGroupType: "ai_detected_http_enabled",
173+
AIDetectedDBGroupType: "ai_detected_db_enabled",
174+
AIDetectedRuntimePerformanceGroupType: "ai_detected_runtime_performance_enabled",
175+
AIDetectedSecurityGroupType: "ai_detected_security_enabled",
176+
AIDetectedCodeHealthGroupType: "ai_detected_code_health_enabled",
177+
AIDetectedGeneralGroupType: "ai_detected_general_enabled",
178+
}
179+
171180

172181
def get_group_type_for_title(title: str) -> type[GroupType]:
173182
return TITLE_TO_GROUP_TYPE.get(title, AIDetectedGeneralGroupType)
@@ -180,6 +189,13 @@ def create_issue_occurrence_from_detection(
180189
"""
181190
Create and produce an IssueOccurrence from an LLM-detected issue.
182191
"""
192+
group_type = get_group_type_for_title(detected_issue.title)
193+
setting_key = GROUP_TYPE_TO_SETTING.get(group_type)
194+
if setting_key:
195+
perf_settings = project.get_option("sentry:performance_issue_settings")
196+
if not perf_settings.get(setting_key, True):
197+
return
198+
183199
event_id = uuid4().hex
184200
occurrence_id = uuid4().hex
185201
detection_time = datetime.now(UTC)

0 commit comments

Comments
 (0)