Skip to content

Commit

Permalink
🧹 Add action the risk factor checksum (#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym authored Jan 22, 2025
1 parent 712a577 commit df2c4b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions policy/risk_factor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (r *RiskFactor) RefreshMRN(ownerMRN string) error {
func (r *RiskFactor) ExecutionChecksum(ctx context.Context, conf mqlc.CompilerConfig) (checksums.Fast, error) {
c := checksums.New.
AddUint(uint64(r.Scope)).
AddUint(uint64(r.Action)).
Add(strconv.FormatFloat(float64(r.GetMagnitude().GetValue()), 'f', -1, 64))

if r.GetMagnitude().GetIsToxic() {
Expand Down
5 changes: 5 additions & 0 deletions policy/risk_factor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func TestRiskFactor_Checksums(t *testing.T) {
rf.Magnitude.Value = 0.7
return rf
},
// 6
func(rf RiskFactor) RiskFactor {
rf.Action = explorer.Action_DEACTIVATE
return rf
},
}

for i := range executionChanges {
Expand Down

0 comments on commit df2c4b7

Please sign in to comment.