Class: Fosm::TransitionLog

Inherits:
ApplicationRecord show all
Defined in:
app/models/fosm/transition_log.rb

Overview

Immutable audit trail of every FOSM state transition. Records are never updated or deleted — this is an append-only log. Supports optional state snapshots for efficient replay and audit.

Instance Method Summary collapse

Instance Method Details

#by_agent?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/models/fosm/transition_log.rb', line 25

def by_agent?
  actor_type == "symbol" && actor_label == "agent"
end

#by_human?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/models/fosm/transition_log.rb', line 29

def by_human?
  !by_agent? && actor_id.present?
end

#snapshot?Boolean

Returns true if this log entry includes a state snapshot

Returns:

  • (Boolean)


34
35
36
# File 'app/models/fosm/transition_log.rb', line 34

def snapshot?
  state_snapshot.present?
end