Class: Hecks::Bluebook::Saga
- Inherits:
-
Struct
- Object
- Struct
- Hecks::Bluebook::Saga
- Defined in:
- lib/hecks/bluebook/process_manager.rb
Overview
The compensation half of a procedure, as its own thing.
A PROCESS MANAGER coordinates: legs, states, an opinion about who goes next. A SAGA undoes: what makes the world good again when a leg it dispatched is refused. Two concepts, and the industry slurs them into one word — so here they are two objects, and a procedure either has a saga or does not.
undoes is the ordered list of commands the compensation sends — a
STATIC PREVIEW, declaration order (Behaviour::ProcessManager#saga),
not one instance's own runtime history. Per-dispatch compensation
(compensates, on the step it compensates for) moved most of what
a saga undoes off this leg's own hand-written body and onto
whichever forward dispatch each one undoes — this reads every
declared compensates across the WHOLE saga first, then whatever
this leg's own hand-written body still lists, for compensation
that isn't expressible as "undo command X." WHICH of a declared
compensates actually fires for one instance, and in what order
(newest-first, completed-legs-only), is SagaInterpreter's own
dynamic completed_compensations — a per-instance runtime fact
this declaration-only object could never hold.
NAMING COLLISION, ONCE FLAGGED, NOW RESOLVED — command's own
corrects event, reverses: true (docs/implemented/decisions/0036-
corrects-is-an-appended-fact-not-a-rewrite.md) already claimed
reverses for a different meaning: auto-deriving a command's OWN
corrective mutation from a past EVENT, not a saga's own
compensating leg from a past DISPATCH. This feature keeps
reverses reserved for corrects and uses compensates for
per-dispatch saga compensation instead — a deliberate choice, not
an accidental collision.
Instance Attribute Summary collapse
-
#compensations ⇒ Object
Returns the value of attribute compensations.
-
#from_state ⇒ Object
Returns the value of attribute from_state.
-
#to_state ⇒ Object
Returns the value of attribute to_state.
-
#trigger ⇒ Object
Returns the value of attribute trigger.
Instance Method Summary collapse
Instance Attribute Details
#compensations ⇒ Object
Returns the value of attribute compensations
71 72 73 |
# File 'lib/hecks/bluebook/process_manager.rb', line 71 def compensations @compensations end |
#from_state ⇒ Object
Returns the value of attribute from_state
71 72 73 |
# File 'lib/hecks/bluebook/process_manager.rb', line 71 def from_state @from_state end |
#to_state ⇒ Object
Returns the value of attribute to_state
71 72 73 |
# File 'lib/hecks/bluebook/process_manager.rb', line 71 def to_state @to_state end |
#trigger ⇒ Object
Returns the value of attribute trigger
71 72 73 |
# File 'lib/hecks/bluebook/process_manager.rb', line 71 def trigger @trigger end |
Instance Method Details
#to_s ⇒ Object
74 |
# File 'lib/hecks/bluebook/process_manager.rb', line 74 def to_s = "#{trigger} → #{to_state} (#{undoes.join(', ')})" |
#undoes ⇒ Object
72 |
# File 'lib/hecks/bluebook/process_manager.rb', line 72 def undoes = compensations.map(&:command_name) |