Class: SkillBench::HistoryRecorder::PersistenceService

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/history_recorder/persistence_service.rb

Overview

Orchestrates recording evaluation results to the history file. Thin service that delegates path resolution and file I/O to HistoryPathResolver and HistoryFile respectively.

Class Method Summary collapse

Class Method Details

.record(results, source_path:, model:) ⇒ Boolean

Records evaluation results into a historical benchmarks file.

Parameters:

  • results (Hash)

    The results from a Runner.call.

  • source_path (String)

    The resolved source path used for the evaluation.

  • model (String)

    The model name used for the evaluation.

Returns:

  • (Boolean)

    true if recorded successfully, false otherwise.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/skill_bench/history_recorder/persistence_service.rb', line 15

def self.record(results, source_path:, model:)
  return false unless results[:success]

  history_file = HistoryPathResolver.resolve
  return false unless history_file

  history = HistoryFile.load(history_file)
  entry = {
    timestamp: Time.now.iso8601,
    source_path: source_path,
    model: model,
    summary: SummaryService.summarize(results[:tasks])
  }

  history << entry
  HistoryFile.write(history_file, history)
  true
rescue StandardError => e
  SkillBench::ErrorLogger.log_error(e, 'HistoryRecorder')
  false
end