Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: refactor risk evaluator (#9415)

Danny Xu8d5d6c756868
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 2cc3686e67..1e47839868 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -524,29 +524,18 @@ func getDatabaseGeneralIssueRisk(ctx context.Context, s *store.Store, licenseSer
}]; ok {
for _, result := range run.Result.Results {
report := result.GetSqlSummaryReport()
+ // If the sheet exceeds common.MaxSheetCheckSize, the report is nil and the affected_rows will be math.MaxInt32.
if report == nil {
continue
}
args["affected_rows"] = report.AffectedRows
for _, statementType := range report.StatementTypes {
args["sql_type"] = statementType
- res, _, err := prg.Eval(args)
- if err != nil {
- return 0, err
- }
- val, err := res.ConvertToNative(reflect.TypeOf(false))
- if err != nil {
- return 0, errors.Wrap(err, "expect bool result")
- }
- if boolVal, ok := val.(bool); ok && boolVal {
- return risk.Level, nil
- }
}
+ break
}
}
- args["sql_type"] = "UNKNOWN"
- args["affected_rows"] = math.MaxInt32
res, _, err := prg.Eval(args)
if err != nil {
return 0, err