Class BaselineStore

java.lang.Object
dev.dokimos.core.gate.BaselineStore

public final class BaselineStore extends Object
Reads and writes the regression-gate baseline file, and reconstructs comparison-ready RunResults from it.

The baseline is a committed source file. It is read and written through the module-relative filesystem path, never the classpath, so the read and the write always target the same file (a classpath copy under target/test-classes would not).

  • Method Details

    • project

      public static BaselineFile project(ExperimentResult result, GateConfig config)
      Projects an experiment result into the v1 baseline format (no I/O).
      Parameters:
      result - the experiment result to project (must have at least one run)
      config - the gate configuration (controls pairing)
      Returns:
      the baseline projection
      Throws:
      IllegalArgumentException - if the result has no runs
      IllegalStateException - if an item has no evaluator results
    • write

      public static void write(Path path, ExperimentResult result, GateConfig config) throws IOException
      Writes a baseline atomically to the given source-tree path (creating parent directories).
      Parameters:
      path - the baseline file path
      result - the experiment result to project
      config - the gate configuration
      Throws:
      IOException - if the file cannot be written
    • read

      public static BaselineFile read(Path path) throws IOException
      Reads and validates a baseline file.
      Parameters:
      path - the baseline file path
      Returns:
      the parsed and validated baseline
      Throws:
      IOException - if the file cannot be read
      IllegalStateException - if the format version is unsupported or the content is invalid
      IllegalArgumentException - if the file is not valid JSON
    • toRunResults

      public static List<RunResult> toRunResults(BaselineFile baseline)
      Reconstructs comparison-ready runs from a baseline. The reconstructed run is faithful for what the comparison engine reads (item key + per-evaluator score and verdict); the model outputs, reasons, and metrics the projection dropped are never consulted by the engine.
      Parameters:
      baseline - the baseline to reconstruct
      Returns:
      a single-element list holding the reconstructed run