All files / src/apps/user/pages/evaluation assuranceStatus.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                  11x                   11x                           11x                   11x  
/**
 * What an agent's assurance status means, in words — one place for the
 * Assurance page and the board tile that shows the same statuses
 * (`components/dashboard/widgets/AssuranceWidgets.tsx`). The tone each
 * carries is `ASSURANCE_STATUS` in `components/detail`.
 */
 
import { AssuranceStatus } from "@/objects/Evaluation";
 
export const STATUS_LABEL: Record<AssuranceStatus, string> = {
  current: "Passing",
  failing: "Below pass mark",
  unscored: "Not scored yet",
  outdated: "Changed since evaluated",
  unrecorded: "Version not recorded",
  never: "Never evaluated",
  regressed: "Regressed",
};
 
export const STATUS_HINT: Record<AssuranceStatus, string> = {
  current:
    "The version in force was evaluated and reaches the pass mark on every dataset it ran.",
  failing:
    "The version in force was evaluated and falls below a dataset's pass mark.",
  unscored:
    "The version in force was evaluated, but its run has not been scored yet.",
  outdated: "Only an older version was evaluated; the agent has changed since.",
  unrecorded: "Evaluated before runs recorded agent versions — run it again to know.",
  never: "No completed run has evaluated this agent as it is configured.",
  regressed: "Its latest run scored worse than the run before it — see Reviews.",
};
 
/** Worst first, as svc-core orders the fleet (`assurance.STATUSES`). */
export const STATUS_ORDER: AssuranceStatus[] = [
  "regressed",
  "failing",
  "never",
  "unscored",
  "outdated",
  "unrecorded",
  "current",
];
 
export const needsAttention = (status: AssuranceStatus) => status !== "current";