assess method

Judges candidate, and base when there is one, with ProfileValidator.validateLoaded. It runs the base's rules even when OKF blocks the base, so a write that repairs OKF is charged only with the findings it adds.

Synchronous, and reads no bundle file and takes no lock; only the path-targets-exist builtin checks the disk, for a path target the loaded bundle does not hold. A Profile rule can be slow, such as a pattern that backtracks without end on a concept's text, and nothing on the calling isolate can interrupt it: assessWithin bounds it.

Implementation

KnowledgeAssessment assess() {
  final base = this.base;
  if (base == null) {
    return KnowledgeAssessment(
      base: null,
      candidate: validator.validateLoaded(candidate, selection),
      baseFindings: const [],
    );
  }
  final baseResult = validator.validateLoaded(base, selection);
  return KnowledgeAssessment(
    base: baseResult,
    candidate: validator.validateLoaded(candidate, selection),
    baseFindings: switch ((baseResult.profile, selection)) {
      (Assessed(:final findings), _) => findings,
      (BlockedByOkf(), SelectedProfile(:final profile)) => evaluate(
        profile,
        BundleFacts.project(
          base,
          profile: profile,
          buildGraph: validator.buildGraph,
        ),
      ).findings,
      _ => const [],
    },
  );
}