Skip to content

Commit ed101c1

Browse files
huyenthanh09claude
andcommitted
feat(gooddata-eval): opt-in alert checks for no-alert, anomaly and setup turns
- `Expect alert: false`: the request names nothing the workspace can monitor; the run passes only if no alert is proposed or created over the whole (shortened) budget, and the simulated user declines every substitute. Published as `alert_not_proposed` - `Sensitivity`, `Trigger interval`, `Date dataset`: scored as `alert_sensitivity_correct` (missing = the tool's MEDIUM default), `alert_trigger_interval_correct` and `alert_date_dataset_correct` - `Comparison.compare_metric_id`: metric-to-metric comparison, checked inside `comparison_correct` - `setup_turns`: sent first in the same conversation, not scored; a broken setup stream still has its created alerts cleaned up - Each new key is validated before any request and scored only when the item states it; `ALERT_CONDITIONAL_SCORES` lists the names - The simulated user is told the stated anomaly settings, and that a comparison's relative date filter is its period, not a time window - Detail and failure message are built from the checks that ran jira: QA-30232 risk: low Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ab912fe commit ed101c1

4 files changed

Lines changed: 688 additions & 51 deletions

File tree

‎packages/gooddata-eval/src/gooddata_eval/core/agentic/_catalog.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from dataclasses import dataclass, field
55
from enum import Enum
6+
from typing import Any
67

78

89
class AnomalyDetectionGranularity(str, Enum):
@@ -73,6 +74,16 @@ class CatalogMetricAlert:
7374
"""Alert name the user asked for; ``None`` means unasserted."""
7475
dashboard_id: str | None = None
7576
"""Dashboard the alert must be bound to; ``None`` means unasserted."""
77+
expect_alert: bool = True
78+
"""``False``: the request names nothing the alert can monitor, so no alert may be proposed or created."""
79+
sensitivity: str | None = None
80+
"""ANOMALY sensitivity (LOW/MEDIUM/HIGH); ``None`` means unasserted."""
81+
trigger_interval: str | None = None
82+
"""Interval of a ONCE_PER_INTERVAL trigger (DAY/WEEK/MONTH/QUARTER/YEAR); ``None`` means unasserted."""
83+
date_dataset_id: str | None = None
84+
"""Date dataset an ANOMALY alert detects on; ``None`` means unasserted."""
85+
setup_turns: tuple[str, ...] = ()
86+
"""Messages sent in the same conversation before the question, not scored."""
7687

7788
@classmethod
7889
def from_dict(cls, d: dict) -> CatalogMetricAlert:
@@ -96,4 +107,27 @@ def from_dict(cls, d: dict) -> CatalogMetricAlert:
96107
comparison=d.get("comparison"),
97108
title=d.get("title"),
98109
dashboard_id=d.get("dashboard_id"),
110+
# Only an explicit false marks a no-alert item; an absent or null value is an alert item.
111+
expect_alert=d.get("expect_alert") is not False,
112+
# Upper-cased as the alert checks compare them.
113+
sensitivity=_upper_or_none(d.get("sensitivity")),
114+
trigger_interval=_upper_or_none(d.get("trigger_interval")),
115+
date_dataset_id=d.get("date_dataset_id"),
116+
setup_turns=_setup_turns(d.get("setup_turns")),
99117
)
118+
119+
120+
def _upper_or_none(value: Any) -> str | None:
121+
"""A stated enum value, upper-cased; ``None`` when absent, blank or not a string."""
122+
if not isinstance(value, str):
123+
return None
124+
return value.strip().upper() or None
125+
126+
127+
def _setup_turns(value: Any) -> tuple[str, ...]:
128+
"""Setup turns as a tuple; raises on anything but a list of strings, so a bare string is not split."""
129+
if value is None:
130+
return ()
131+
if not isinstance(value, list) or not all(isinstance(turn, str) for turn in value):
132+
raise ValueError(f"setup_turns must be a list of strings, got {value!r}")
133+
return tuple(value)

0 commit comments

Comments
 (0)