Background
How the autopilot currently handles scores of solutions is quite awkward. It takes a /solve response from a driver and turns it into a domain type. This struct has an optional score field which is set to None at construction. Later when the autopilot runs the winner selection logic it sets the value to Some(score). From that point onward the field is fully initialized and later read by the autopilot to ultimately store it in the DB.
This 2 phase initialization process is error prone since someone could try to read the value before it's initialized.
Ideally the code would be updates to make this value non-optional by already scoring the solution at construction of the domain type.
Background
How the autopilot currently handles scores of solutions is quite awkward. It takes a
/solveresponse from a driver and turns it into adomaintype. This struct has an optionalscorefield which is set toNoneat construction. Later when the autopilot runs the winner selection logic it sets the value toSome(score). From that point onward the field is fully initialized and later read by the autopilot to ultimately store it in the DB.This 2 phase initialization process is error prone since someone could try to read the value before it's initialized.
Ideally the code would be updates to make this value non-optional by already scoring the solution at construction of the domain type.