fix(api): platform check type switch binds the platform's checkers only
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m25s
ci / test (pull_request) Successful in 12m34s
ci / build (pull_request) Successful in 18m7s
ci / image (pull_request) Successful in 5m22s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m25s
ci / test (pull_request) Successful in 12m34s
ci / build (pull_request) Successful in 18m7s
ci / image (pull_request) Successful in 5m22s
Switching a check type off in the admin area removed it for every organization, own checkers included, and hid it from the organization's own choice. The platform switch now only keeps such monitors off the platform's regions: organizations with regions of their own still create them there (422 check_type_own_checkers_only on a platform region), and the editor marks them "own checkers only". Passive types, which no checker runs, stay switched off entirely. The organization's check types are chosen independently of the platform's: its settings list every type, and the platform switch no longer rewrites that choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
12e6de77aa
commit
bd887523de
12 files changed
+2296
-2096
No files matched your search
@@ -280,8 +280,7 @@ func (s *Server) createMonitor(c *gin.Context) {
|
||||
if !s.validateMonitor(c, &req, t) {
|
||||
return
|
||||
}
|
||||
if !s.offered(ctx, p.Org, req.Type) {
|
||||
fail(c, http.StatusUnprocessableEntity, "check_type_disabled")
|
||||
if failCheckType(c, s.checkTypeAllowed(ctx, p.Org, req.Type, "", req.Regions, nil, req.platform)) {
|
||||
return
|
||||
}
|
||||
req.Target = passiveTarget(check.Type(req.Type), req.Target)
|
||||
@@ -403,8 +402,8 @@ func (s *Server) updateMonitor(c *gin.Context) {
|
||||
if previous, err = q.MonitorRegions(ctx, id); err != nil {
|
||||
return err
|
||||
}
|
||||
if old.Type != req.Type && !s.offered(ctx, p.Org, req.Type) {
|
||||
return errCheckTypeDisabled
|
||||
if err := s.checkTypeAllowed(ctx, p.Org, req.Type, old.Type, req.Regions, previous, req.platform); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := checkRegions(s.orgLimits(ctx, p.Org), req.Regions, previous, req.platform); err != nil {
|
||||
return err
|
||||
@@ -443,8 +442,7 @@ func (s *Server) updateMonitor(c *gin.Context) {
|
||||
fail(c, http.StatusUnprocessableEntity, "invalid_alert_group")
|
||||
return
|
||||
}
|
||||
if errors.Is(err, errCheckTypeDisabled) {
|
||||
fail(c, http.StatusUnprocessableEntity, "check_type_disabled")
|
||||
if failCheckType(c, err) {
|
||||
return
|
||||
}
|
||||
if failLimit(c, err) {
|
||||
@@ -611,5 +609,3 @@ func passiveRegion(t check.Type) string {
|
||||
}
|
||||
return heartbeatRegion
|
||||
}
|
||||
|
||||
var errCheckTypeDisabled = errors.New("api: check type switched off")
|
||||
Reference in new issue
Block a user