fix: ensure that weighted mappings don't exceed 100#247
Conversation
Signed-off-by: Alberto Ricart <alberto@synadia.com>
|
Claude finished @aricart's task in 1m 11s —— View job PR Review
SummaryThis PR fixes a real integer overflow bug in The additional per-entry guard ( ObservationsMinor: Double errors for individual weights > 100 When a single // v2/account_claims.go:159
if e.GetWeight() > 100 {
vr.AddError(...)
// consider: continue
}
Tests are thorough: The three new tests cover:
VerdictThe fix is correct and well-tested. The double-error scenario for individual weights > 100 is the only thing worth a second look, but it's not a bug. |
| for _, e := range wm { | ||
| e.Subject.Validate(vr) | ||
| if e.GetWeight() > 100 { | ||
| vr.AddError("Mapping %q has a weight %d that exceeds 100", ubFrom, e.GetWeight()) |
There was a problem hiding this comment.
Is it expected to continue or break here?
There was a problem hiding this comment.
continue - we want to get all the errors we can
There was a problem hiding this comment.
Looks like continue is missing then, we just fall through.
There was a problem hiding this comment.
no, one is validating the size of the mapping, the other is an agregagate for cluster (multiple errors can be generated)
No description provided.