Skip to content

Commit

Permalink
report disabled score type
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym committed Dec 2, 2024
1 parent 1bc0910 commit 7f5dc55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions policy/executor/internal/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,17 @@ func (nodeData *ReportingJobNodeData) score() (*policy.Score, error) {
} else {
s = proto.Clone(c.score).(*policy.Score)
s.QrId = nodeData.queryID
if s.Type == policy.ScoreType_Result {
if c.impact.GetScoring() == explorer.ScoringSystem_DISABLED {
s.Type = policy.ScoreType_Disabled
} else if s.Type == policy.ScoreType_Result {
// We cant just forward the score if impact is set and we have a result.
// We still need to apply impact to the score
if c.impact != nil && c.impact.Value != nil {
floor := 100 - uint32(c.impact.Value.Value)
if floor > s.Value {
s.Value = floor
if c.impact != nil {
if c.impact.Value != nil {
floor := 100 - uint32(c.impact.Value.Value)
if floor > s.Value {
s.Value = floor
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion policy/resolved_policy_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ func (b *resolvedPolicyBuilder) addQuery(query *explorer.Mquery) (string, bool)
// Add node for query
b.addNode(&rpBuilderGenericQueryNode{queryMrn: query.Mrn, selectedCodeId: b.disabledQuery.CodeId, queryType: queryType})
// Add edge from execution query to query
b.addEdge(b.disabledQuery.CodeId, query.Mrn, &explorer.Impact{Scoring: explorer.ScoringSystem_IGNORE_SCORE})
b.addEdge(b.disabledQuery.CodeId, query.Mrn, &explorer.Impact{Scoring: explorer.ScoringSystem_DISABLED})

Check failure on line 874 in policy/resolved_policy_builder.go

View workflow job for this annotation

GitHub Actions / go-bench

undefined: explorer.ScoringSystem_DISABLED

Check failure on line 874 in policy/resolved_policy_builder.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: explorer.ScoringSystem_DISABLED) (typecheck)

Check failure on line 874 in policy/resolved_policy_builder.go

View workflow job for this annotation

GitHub Actions / go-test

undefined: explorer.ScoringSystem_DISABLED

Check failure on line 874 in policy/resolved_policy_builder.go

View workflow job for this annotation

GitHub Actions / go-test

undefined: explorer.ScoringSystem_DISABLED
return b.disabledQuery.CodeId, true
}

Expand Down

0 comments on commit 7f5dc55

Please sign in to comment.