Class: Moult::GateReport
- Inherits:
-
Object
- Object
- Moult::GateReport
- Defined in:
- lib/moult/gate_report.rb
Overview
The serialized result model for moult gate (schema/gate.schema.json), sibling
to HealthReport and BoundariesReport. It owns its own JSON envelope and
leaves every signal contract — and the two protected APIs — untouched.
This is the FIRST and ONLY Moult contract that renders a VERDICT. Every other analysis emits a confidence-graded / classified SIGNAL with no pass/fail; the gate consumes those signals, applies an explicit recorded Moult::Gate::Policy, and reports one top-level verdict. The verdict is an auditable application of that policy over confidence-graded candidates — never a claim that code is certainly wrong or dead. The words "verdict"/"pass"/"fail" live here and nowhere else.
Defined Under Namespace
Classes: Component
Constant Summary collapse
- SCHEMA_VERSION =
Bump only on a breaking change to the serialized shape.
1
Instance Attribute Summary collapse
-
#base_ref ⇒ Object
readonly
Returns the value of attribute base_ref.
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#evaluation ⇒ Object
readonly
Returns the value of attribute evaluation.
-
#generated_at ⇒ Object
readonly
Returns the value of attribute generated_at.
-
#git_ref ⇒ Object
readonly
Returns the value of attribute git_ref.
-
#merge_base ⇒ Object
readonly
Returns the value of attribute merge_base.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#findings ⇒ Object
Contributing findings flattened across all rules (for CI projections).
-
#initialize(root:, base_ref:, merge_base:, scope:, components:, policy:, evaluation:, git_ref: nil, generated_at: nil) ⇒ GateReport
constructor
A new instance of GateReport.
- #reasons ⇒ Object
- #rules ⇒ Object
- #summary ⇒ Object
- #to_h ⇒ Object
-
#verdict ⇒ Object
The top-level verdict, "pass" or "fail".
Constructor Details
#initialize(root:, base_ref:, merge_base:, scope:, components:, policy:, evaluation:, git_ref: nil, generated_at: nil) ⇒ GateReport
Returns a new instance of GateReport.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/moult/gate_report.rb', line 36 def initialize(root:, base_ref:, merge_base:, scope:, components:, policy:, evaluation:, git_ref: nil, generated_at: nil) @root = root @base_ref = base_ref @merge_base = merge_base @scope = scope @components = components @policy = policy @evaluation = evaluation @git_ref = git_ref @generated_at = generated_at end |
Instance Attribute Details
#base_ref ⇒ Object (readonly)
Returns the value of attribute base_ref.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def base_ref @base_ref end |
#components ⇒ Object (readonly)
Returns the value of attribute components.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def components @components end |
#evaluation ⇒ Object (readonly)
Returns the value of attribute evaluation.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def evaluation @evaluation end |
#generated_at ⇒ Object (readonly)
Returns the value of attribute generated_at.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def generated_at @generated_at end |
#git_ref ⇒ Object (readonly)
Returns the value of attribute git_ref.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def git_ref @git_ref end |
#merge_base ⇒ Object (readonly)
Returns the value of attribute merge_base.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def merge_base @merge_base end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def policy @policy end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def root @root end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
26 27 28 |
# File 'lib/moult/gate_report.rb', line 26 def scope @scope end |
Instance Method Details
#findings ⇒ Object
Contributing findings flattened across all rules (for CI projections).
63 64 65 |
# File 'lib/moult/gate_report.rb', line 63 def findings rules.flat_map(&:findings) end |
#reasons ⇒ Object
58 59 60 |
# File 'lib/moult/gate_report.rb', line 58 def reasons evaluation.reasons end |
#rules ⇒ Object
54 55 56 |
# File 'lib/moult/gate_report.rb', line 54 def rules evaluation.rules end |
#summary ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/moult/gate_report.rb', line 67 def summary { rules: rules.size, evaluated: rules.count(&:evaluated), failed: rules.count { |r| r.evaluated && r.passed == false }, findings: findings.size } end |
#to_h ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/moult/gate_report.rb', line 76 def to_h { schema_version: SCHEMA_VERSION, tool: {name: "moult", version: Moult::VERSION}, analysis: { root: root, git_ref: git_ref, generated_at: generated_at, base_ref: base_ref, merge_base: merge_base, scope: scope.to_s, components: components.map(&:to_h) }, policy: policy.to_h, verdict: verdict, reasons: reasons.map(&:to_h), summary: summary, rules: rules.map(&:to_h) } end |
#verdict ⇒ Object
The top-level verdict, "pass" or "fail". The CLI maps this to its exit code.
50 51 52 |
# File 'lib/moult/gate_report.rb', line 50 def verdict evaluation.verdict end |