Running the following sql against the db:
insert into approval_categories(name, abbreviated_name, position, function_name, copy_min_score, category_id) \
VALUES("Commit Ready", "CR", 2, "NoOp", "N", "COMR");
insert into approval_category_values(name, category_id, value) VALUES("Not Ready", "COMR", 0);
insert into approval_category_values(name, category_id, value) VALUES("Ready", "COMR", 1);
Gerrit should give some form of warning (log or otherwise) that it's misconfigured; specifically, that the category function (NoOp) in use is for a non-scoring category, but is used in a scoring fashion (as indicated by the position value).
In the same respect, if it was properly set as a NoBlock but the values weren't inserted, gerrit should throw a warning about it- in that situation it instead just does weird/hard to debug UI hangs. Same goes for a scoring category that has a position=-1 last I knew.
My thought as to how to do this was addition of an intermediate set of classes- specifically, all category function derivatives derive from CategoryFunction directly- both scoring, and nonscoring.
My thought is that CategoryFunction should be modified such that there is a method that states whether or not the instance is a scoring category (thus requiring values) or a non-scoring; that's enough info for gerrit during initialization/loadup of the DB to do basic validation as mentioned above.
I'd attach a patch, but my java sucks fairly badly- plus I've not yet found where gerrit actually loads up categories during initialization, just the category classes themselves.
Thoughts/comments?