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

100% Statements 7/7
100% Branches 6/6
100% Functions 1/1
100% Lines 5/5

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                                              3x                   3x     98x 97x 88x    
/**
 * Which part of the Evaluation tab a `?section=` value opens.
 *
 * The tab opens on Assurance — which version of each agent has evidence
 * behind it — because that is the question a reader brings to the tab:
 * "is my fleet fit for purpose?". Datasets and Reports are a link away from
 * it, as the material that answer is built from. The tab's own key
 * ("evaluation"), no section at all and anything unrecognised land on
 * Assurance.
 *
 * Every name the datasets section has had still resolves to it — links,
 * bookmarks and history carry them, and a dead alias is a 404 for a user
 * who did nothing wrong:
 *
 * - "evaluations", "experiments", "labs", "compare": the experiment list, in
 *   its successive names — now each experiment lives on its dataset
 * - "test_suites", "benchmarking": datasets under their old names
 *
 * Kept out of `Evaluation.tsx` so the Governance page can resolve a section
 * without loading the (lazy) evaluation module.
 */
export type EvaluationSection = "assurance" | "datasets" | "reports";
 
const DATASET_ALIASES: ReadonlySet<string> = new Set([
  "datasets",
  "evaluations",
  "experiments",
  "labs",
  "compare",
  "test_suites",
  "benchmarking",
]);
 
export const evaluationSectionFor = (
  section: string | null | undefined,
): EvaluationSection => {
  if (section === "reports") return "reports";
  if (section && DATASET_ALIASES.has(section)) return "datasets";
  return "assurance";
};