Class: Ace::Test::EndToEndRunner::Molecules::SuiteReportWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/test/end_to_end_runner/molecules/suite_report_writer.rb

Overview

Writes an aggregated package or suite report

Uses LLM synthesis to generate rich reports with root cause analysis, friction insights, and improvement suggestions. Falls back to a static template on LLM failure.

Constant Summary collapse

REPORT_KINDS =
{
  package: ->(timestamp, package) { "#{timestamp}-#{package}-report.md" },
  suite: ->(timestamp, _package) { "#{timestamp}-suite-report.md" }
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(config: nil) ⇒ SuiteReportWriter

Returns a new instance of SuiteReportWriter.

Parameters:

  • config (Hash, nil) (defaults to: nil)

    Configuration hash (reads reporting.model and reporting.timeout)



22
23
24
25
26
# File 'lib/ace/test/end_to_end_runner/molecules/suite_report_writer.rb', line 22

def initialize(config: nil)
  reporting = (config || {}).dig("reporting") || {}
  @model = reporting["model"] || "glite"
  @timeout = reporting["timeout"] || 60
end

Instance Method Details

#write(results, scenarios, package:, timestamp:, base_dir:, report_kind: :package, diagnostics: nil) ⇒ String

Write an aggregated report

Parameters:

  • results (Array<Models::TestResult>)

    Test results (ordered)

  • scenarios (Array<Models::TestScenario>)

    Corresponding scenarios

  • package (String)

    Package name (e.g., “ace-lint”)

  • timestamp (String)

    Timestamp ID for this run

  • base_dir (String)

    Base directory for cache output

Returns:

  • (String)

    Path to the written report file



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ace/test/end_to_end_runner/molecules/suite_report_writer.rb', line 41

def write(results, scenarios, package:, timestamp:, base_dir:, report_kind: :package, diagnostics: nil)
  cache_dir = File.join(base_dir, ".ace-local", "test-e2e")
  FileUtils.mkdir_p(cache_dir)

  report_path = File.join(cache_dir, report_filename(report_kind, timestamp, package))

  overall_status = compute_status(results)
  executed_at = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
  results_data = build_results_data(results, scenarios)
  narrative_sections = synthesize_narrative_sections(
    results_data,
    package: package,
    timestamp: timestamp,
    overall_status: overall_status,
    executed_at: executed_at
  )
  content = build_report(
    results_data,
    package: package,
    timestamp: timestamp,
    overall_status: overall_status,
    executed_at: executed_at,
    narrative_sections: narrative_sections,
    diagnostics: diagnostics
  )

  File.write(report_path, content)
  report_path
end