Class: Eco::API::UseCases::GraphQL::Samples::Pages::Template::Deploy::Loop
- Inherits:
-
Object
- Object
- Eco::API::UseCases::GraphQL::Samples::Pages::Template::Deploy::Loop
- Defined in:
- lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb
Overview
Deploy → verify → monitor orchestration (Phase 5).
Ties the four offline-safe pieces into one pass:
- APPLY — hand a gem
Diff::Deployplan to theApplier(dry-run by DEFAULT; live only behind an explicitcommit: true+ executor). - DRIFT — re-read the target and run a pre/post self-version diff, then compare the applied
delta to the intended delta (
DriftReport). Reports drift honestly. - VERIFY — run the post-deploy template doc through a
Verifier(ecoportal-qa when present, else the null verifier). - MONITOR — optional sync-readiness scan of a register subset against the post-deploy template.
Everything is OFFLINE against fixtures. The two seams that would touch a live API — applying the
batch and re-reading the target — are injected as callables, so specs (and dry-runs) drive them
with fixtures and a RecordingExecutor:
loop = Deploy::Loop.new( plan: gem_deploy_plan, intended: source_version_diff, # the diff the plan was built from pre_doc: target_before_doc, # the target template BEFORE apply reread: -> { recording_executor.doc } # how to fetch the target AFTER apply (post-deploy doc) ) result = loop.run(commit: false, executor: recording_executor, entries: register_entries)
result.applied # => Applier::Outcome result.drift # => DriftReport (nil if pre_doc/reread not supplied) result.verdict # => Verifier::Verdict result.sync_readiness # => SyncReadiness (nil if no entries) result.ok? # => apply not blocked && drift match && verify pass result.report # => aggregate human summary
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#initialize(plan:, intended: nil, pre_doc: nil, reread: nil, target: nil, verifier: nil, diff_builder: nil) ⇒ Loop
constructor
A new instance of Loop.
-
#run(commit: false, executor: nil, allow_partial: false, entries: nil) ⇒ Result
Run the full pass.
Constructor Details
#initialize(plan:, intended: nil, pre_doc: nil, reread: nil, target: nil, verifier: nil, diff_builder: nil) ⇒ Loop
Returns a new instance of Loop.
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 95 def initialize(plan:, intended: nil, pre_doc: nil, reread: nil, target: nil, verifier: nil, diff_builder: nil) @plan = plan @intended = intended @pre_doc = pre_doc @reread = reread @target = target @verifier = verifier || Verifier.default @diff_builder = diff_builder end |
Instance Method Details
#run(commit: false, executor: nil, allow_partial: false, entries: nil) ⇒ Result
Run the full pass.
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 115 def run(commit: false, executor: nil, allow_partial: false, entries: nil) applied = Applier.new(@plan, target: @target).apply( commit: commit, executor: executor, allow_partial: allow_partial ) post_doc = applied.skipped_reason.nil? ? reread_post_doc : nil drift = build_drift(post_doc) verdict = post_doc ? @verifier.verify(post_doc) : nil monitor = build_monitor(post_doc, entries) Result.new(applied: applied, drift: drift, verdict: verdict, sync_readiness: monitor) end |