Class: Eco::API::UseCases::GraphQL::Compat::Parity::RunResult
- Defined in:
- lib/eco/api/usecases/graphql/compat/parity/run_result.rb
Overview
A normalised, comparable snapshot of ONE use-case run.
The A/B parity harness reduces a run — whether it went through the legacy (v2 / OozeRedirect) path or the native GraphQL path — to just its OBSERVABLE outcome:
kpis— the KPI counter hash (search/retrieved/updated/created/… )updates— the per-page update payload the run WOULD send, keyed by page id
Two runs are "equivalent" when, after normalisation, both are identical. This is the unit the strangler-fig migration is gated on: flip a case name only once its native RunResult matches the legacy RunResult over the same input.
Everything here is PURE (no session, no network) so equivalence can be asserted offline in specs; the live capture step (feeding real runs in) is the only part that needs credentials.
Constant Summary collapse
- CANON_KPI_ALIASES =
KPI names differ between the legacy and native cases (e.g.
updated_oozesvsupdated_pages). We compare on a CANONICAL subset of counters that both sides expose the same way, mapping each side's names onto the canon. { search: %i[total_search_oozes total_search_pages search], duplicated: %i[dupped_search_oozes dupped_search_pages duplicated], retrieved: %i[retrieved_oozes retrieved_pages retrieved], updated: %i[updated_oozes updated_pages updated], created: %i[created_oozes created_pages created], skipped: %i[skipped_pages skipped], failed: %i[failed_update_oozes failed_pages failed] }.freeze
Instance Attribute Summary collapse
-
#kpis ⇒ Object
readonly
Returns the value of attribute kpis.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#updates ⇒ Object
readonly
Returns the value of attribute updates.
Instance Method Summary collapse
-
#compare_to(other) ⇒ Object
Compare against another RunResult, returning a Comparison value object.
-
#equivalent_to?(other) ⇒ Boolean
Convenience: are the two runs equivalent?.
-
#initialize(label:, kpis: {}, updates: {}) ⇒ RunResult
constructor
A new instance of RunResult.
-
#page_ids ⇒ Object
The set of page ids this run acted on.
-
#to_h ⇒ Object
Merge/normalise into a plain hash (handy for golden-file capture).
Constructor Details
#initialize(label:, kpis: {}, updates: {}) ⇒ RunResult
Returns a new instance of RunResult.
24 25 26 27 28 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 24 def initialize(label:, kpis: {}, updates: {}) @label = label.to_s @kpis = normalize_kpis(kpis) @updates = normalize_updates(updates) end |
Instance Attribute Details
#kpis ⇒ Object (readonly)
Returns the value of attribute kpis.
19 20 21 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 19 def kpis @kpis end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
19 20 21 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 19 def label @label end |
#updates ⇒ Object (readonly)
Returns the value of attribute updates.
19 20 21 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 19 def updates @updates end |
Instance Method Details
#compare_to(other) ⇒ Object
Compare against another RunResult, returning a Comparison value object.
36 37 38 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 36 def compare_to(other) Comparison.new(self, other) end |
#equivalent_to?(other) ⇒ Boolean
Convenience: are the two runs equivalent?
41 42 43 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 41 def equivalent_to?(other) compare_to(other).equivalent? end |
#page_ids ⇒ Object
The set of page ids this run acted on.
31 32 33 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 31 def page_ids updates.keys end |
#to_h ⇒ Object
Merge/normalise into a plain hash (handy for golden-file capture).
46 47 48 |
# File 'lib/eco/api/usecases/graphql/compat/parity/run_result.rb', line 46 def to_h { label: label, kpis: kpis, updates: updates } end |