Class: Ast::Merge::Git::LocalBenchmarkReport
- Inherits:
-
Object
- Object
- Ast::Merge::Git::LocalBenchmarkReport
- Defined in:
- lib/ast/merge/git/local_benchmark.rb,
sig/ast/merge/git.rbs
Overview
Builds a non-scalar paired report from local benchmark raw evidence.
Constant Summary collapse
- SUCCESS =
%w[correct_clean true_conflict].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Hash[String, untyped]
-
#initialize(run) ⇒ LocalBenchmarkReport
constructor
A new instance of LocalBenchmarkReport.
Constructor Details
#initialize(run) ⇒ LocalBenchmarkReport
Returns a new instance of LocalBenchmarkReport.
1834 1835 1836 1837 |
# File 'lib/ast/merge/git/local_benchmark.rb', line 1834 def initialize(run) @run = run @results = run.fetch('results') end |
Class Method Details
.build(run) ⇒ Hash[String, untyped]
1830 1831 1832 |
# File 'lib/ast/merge/git/local_benchmark.rb', line 1830 def self.build(run) new(run).build end |
Instance Method Details
#build ⇒ Hash[String, untyped]
1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 |
# File 'lib/ast/merge/git/local_benchmark.rb', line 1839 def build pairs = @results.group_by { |result| result['case_id'] }.values.map { |items| transition(items) } false_auto_merges = candidate_eligible.select { |item| item['outcome'] == 'false_auto_merge' } preservation_failures = candidate_eligible.select do |item| item.dig('dimensions', 'preservation', 'violations').any? || item.dig('dimensions', 'preservation', 'unverified').any? end unexpected_errors = candidate_results.select { |item| item['outcome'] == 'error' } { 'schema_version' => 'structuredmerge.benchmark.report/v1', 'kind' => 'paired_aggregate_report', 'corpus_id' => @run['corpus_id'], 'corpus_digest' => @run['corpus_digest'], 'selection' => @run['selection'], 'run_manifest' => @run.fetch('run_manifest'), 'cache_identity' => @run['cache_identity'], 'dimensions' => { 'safety' => { 'eligible' => candidate_eligible.length, 'false_auto_merge_result_ids' => false_auto_merges.map { |item| item['id'] }, 'gate' => false_auto_merges.empty? ? 'pass' : 'fail', 'non_compensable' => true }, 'effectiveness' => outcome_counts, 'preservation' => { 'eligible' => candidate_eligible.length, 'violation_result_ids' => candidate_eligible.filter_map do |item| item['id'] if item.dig('dimensions', 'preservation', 'violations').any? end, 'unverified_result_ids' => candidate_eligible.filter_map do |item| item['id'] if item.dig('dimensions', 'preservation', 'unverified').any? end, 'gate' => preservation_failures.empty? ? 'pass' : 'fail' }, 'performance' => performance, 'reliability' => { 'error_result_ids' => unexpected_errors.map { |item| item['id'] }, 'gate' => unexpected_errors.empty? ? 'pass' : 'fail' }, 'coverage' => coverage, 'competitive' => competitive }, 'strata' => strata, 'transitions' => pairs, 'newly_passing_case_ids' => pairs.filter_map { |pair| pair['case_id'] if pair['newly_passing'] }, 'newly_failing_case_ids' => pairs.filter_map { |pair| pair['case_id'] if pair['newly_failing'] }, 'changed_conflict_case_ids' => pairs.filter_map { |pair| pair['case_id'] if pair['changed_conflict'] }, 'hard_gate_failed' => false_auto_merges.any? || preservation_failures.any? || unexpected_errors.any?, 'scalar_score' => nil } end |