Closed Bug 1283568 Opened 10 years ago Closed 6 years ago

footgun protection against undefined behaviour when multiple rules have the same priority

Categories

(Release Engineering Graveyard :: Applications: Balrog (backend), defect, P3)

defect

Tracking

(Not tracked)

RESOLVED MOVED

People

(Reporter: bhearsum, Unassigned)

Details

(Whiteboard: [lang=python][ready])

Right now, if an update query matches multiple rules with the same priority, it's not possible to guarantee that a certain one is chosen. This is undefined behaviour and can lead to lots of confusion. We should do _something_ to make this less of a footgun. In the past we've talked about possibly choosing the "most matching" rule (that would be, the one with the most specificity, ie: one that requires build_target+channel is more matching than one that requires just channel). Another idea could be to just disallow rules with the same priority. Or maybe disallow rules with the same priority when product is the same.
Priority: -- → P3
Whiteboard: [lang=python][ready]
I would vote for attacking this with admin code. I.e. block the creation of a change or a scheduled change if the to-be-updated rule ends up matching another existing rule. If we start with adding the business logic code in the POST, we can slowly untangle it from there: 1) Make the UI nice and explain what's wrong 2) Revising old bad rules that have, unfortunately, ended up as duplicates.
(In reply to Ben Hearsum (:bhearsum) from comment #0) ...snip... > > Another idea could be to just disallow rules with the same priority. Or > maybe disallow rules with the same priority when product is the same. Isn't the product+channel always a parameter you can count on? If so, the business logic could be quite simple in the validation code: SELECT id FROM rules WHERE priority=:priority AND product=:product AND channel=:channel AND id != :this_id
(In reply to Peter Bengtsson [:peterbe] from comment #2) > (In reply to Ben Hearsum (:bhearsum) from comment #0) > ...snip... > > > > Another idea could be to just disallow rules with the same priority. Or > > maybe disallow rules with the same priority when product is the same. > > Isn't the product+channel always a parameter you can count on? Technically no, but in practice it's always set (and I'd like to enforce that at some point, too).
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → MOVED
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.