fix(alerts): remove dead ACKNOWLEDGED enum SQL + TODO comments
Remove SET state='ACKNOWLEDGED' from ack() and the ACKNOWLEDGED predicate from findOpenForRule — both would error after V17. The final ack() + open-rule semantics (idempotent guards, deleted_at) are owned by Task 5; this is just the minimum to stop runtime SQL errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -87,7 +87,8 @@ public class PostgresAlertInstanceRepository implements AlertInstanceRepository
|
||||
var list = jdbc.query("""
|
||||
SELECT * FROM alert_instances
|
||||
WHERE rule_id = ?
|
||||
AND state IN ('PENDING','FIRING','ACKNOWLEDGED')
|
||||
AND state IN ('PENDING','FIRING')
|
||||
AND deleted_at IS NULL
|
||||
LIMIT 1
|
||||
""", rowMapper(), ruleId);
|
||||
return list.isEmpty() ? Optional.empty() : Optional.of(list.get(0));
|
||||
@@ -158,9 +159,8 @@ public class PostgresAlertInstanceRepository implements AlertInstanceRepository
|
||||
public void ack(UUID id, String userId, Instant when) {
|
||||
jdbc.update("""
|
||||
UPDATE alert_instances
|
||||
SET state = 'ACKNOWLEDGED'::alert_state_enum,
|
||||
acked_at = ?, acked_by = ?
|
||||
WHERE id = ?
|
||||
SET acked_at = ?, acked_by = ?
|
||||
WHERE id = ? AND acked_at IS NULL AND deleted_at IS NULL
|
||||
""", Timestamp.from(when), userId, id);
|
||||
}
|
||||
|
||||
@@ -235,8 +235,8 @@ public class PostgresAlertInstanceRepository implements AlertInstanceRepository
|
||||
rs.getString("acked_by"),
|
||||
resolvedAt == null ? null : resolvedAt.toInstant(),
|
||||
lastNotifiedAt == null ? null : lastNotifiedAt.toInstant(),
|
||||
null, // readAt — TODO Task 4: read from DB column
|
||||
null, // deletedAt — TODO Task 4: read from DB column
|
||||
null,
|
||||
null,
|
||||
rs.getBoolean("silenced"),
|
||||
currentValue,
|
||||
threshold,
|
||||
|
||||
Reference in New Issue
Block a user