Decision Response Assembler
Turns the answers a provider returned for a whole spec into a DecisionResponse. A provider reports each answer it read under the question name it mapped the answer to, and build applies the answer rules.
After unsafe, every question fails and the response's request failure is FailureReason.INVALID_RESPONSE.
A name received twice through any method fails the request the same way. A repeated name means the provider's answers cannot be matched to questions safely.
A name the spec does not hold is ignored and counted in the WARN line. Its siblings are kept.
A question with no answer, an answer of the wrong kind, an unreadable answer, or an outcome the question's
validaterejects fails only that question with FailureReason.INVALID_RESPONSE.The response lists the answers in spec order, whatever order they arrived in.
Outcomes pass through unchanged, so any confidence or evidence in them is what the provider reported.
When any anomaly occurs, build logs one WARN naming the service, each affected spec question with its Anomaly, and the unexpected count. Logged question names come from the spec. Received keys, ids and outcomes never appear in a log line or exception message, because a provider can be steered to echo its input there.
An assembler builds one response. It is not safe for use from several threads at once.
Types
Functions
Returns the response the recorded answers give under the answer rules.
Records a choice answer.
Records a proposition answer.
Records a rating answer.
Records an answer whose key maps to no question.
Records an answer the provider could not read, as Anomaly.UNREADABLE.
Records an answer the provider could not use, with the reason.
Records that the response envelope is corrupt, so no answer can be matched to a question. The built response fails every question.