feedback
Use feedbackHasErrors to decide whether another attempt is needed and renderFeedback to give the findings to that attempt. mergeFeedback and flattenFeedback preserve failures. failOpenFeedback discards failures when the caller deliberately allows an unavailable review.
Types
Feedback
One review or verification finding. error marks a blocking problem. A false value can mark advice or a satisfied point. source links to a page used to check the finding.
/** One review or verification finding. `error` marks a blocking problem.
A false value can mark advice or a satisfied point. `source` links to a
page used to check the finding. */
export type Feedback = {
error: boolean;
feedback: string;
source?: string
}(source)
Functions
mergeFeedback
mergeFeedback(a: Result<Feedback[]>, b: Result<Feedback[]>): Result<Feedback[]>Concatenate successful finding lists, returning the first failure if either input failed.
Parameters:
| Name | Type | Default |
|---|---|---|
| a | Result<Feedback[]> | |
| b | Result<Feedback[]> |
Returns: Result<Feedback[]>
(source)
flattenFeedback
flattenFeedback(feedback: Result<Feedback[]>[]): Result<Feedback[]>Combine finding lists, returning the first failed Result if one is present.
Parameters:
| Name | Type | Default |
|---|---|---|
| feedback | Result<Feedback[]>[] |
Returns: Result<Feedback[]>
(source)
renderFeedback
renderFeedback(feedback: Result<Feedback[]>): stringRender findings as paragraphs, or return the failure message when the review failed.
Parameters:
| Name | Type | Default |
|---|---|---|
| feedback | Result<Feedback[]> |
Returns: string
(source)
feedbackHasErrors
feedbackHasErrors(feedback: Result<Feedback[]>): booleanReturn whether findings include an error or the review itself failed.
Parameters:
| Name | Type | Default |
|---|---|---|
| feedback | Result<Feedback[]> |
Returns: boolean
(source)
failOpenFeedback
failOpenFeedback(feedback: Result<Feedback[]>): Result<Feedback[]>Keep successful findings and turn failures into an empty finding list.
Parameters:
| Name | Type | Default |
|---|---|---|
| feedback | Result<Feedback[]> |
Returns: Result<Feedback[]>
(source)