Lifecycle And Messaging Flow

guarded state transitions, rollback rules, and hub publication paths

Lifecycle And Messaging Flow guarded state transitions, rollback rules, and hub publication paths Lifecycle And Messaging Flow guarded state transitions, rollback rules, and hub publication paths Lifecycle state machine Operations and atomicity rules Hub publication, transaction queue, and cross-VM coordination Destructed fresh build state construct() legal Constructing OnConstruct hook intermediate status Constructed ready for selection can_reconstruct() Destructing Current clears first OnDestruct hook Disposed terminal late completion aborts Fixture-backed validator spec/fixtures/lifecycle-transitions.json shared across all conformance suites Operations construct destruct reconstruct dispose Predicates can_construct() can_destruct() can_reconstruct() safe no-op states Per-VM guard serializes lifecycle ops rejects concurrent re-entry prevents resurrection Transactional rollback failed construct -> Destructed failed destruct -> Constructed rollback publishes status Parent orchestration composite/group/aggregate wait for child settled states sequential reference impls Status messages construction status 2 / 4 lifecycle emissions hot FIFO delivery Property messages IsCurrent / Model Snapshot / ActiveKey per-flavor names Collection + tree collection changes tree structure changes batch Reset Transaction queue nested scopes flatten lossless outer flush re-entrant append Per-instance bindings property change events single-VM adapters bypass shared hub Consumers commands view adapters cross-VM observers Key rule Lifecycle operations raise when called from an illegal state, while selection after Disposed is a silent no-op. Hub transactions defer a lossless FIFO until the outer scope exits; re-entrant sends append to the same iterative drain. construct() destruct() dispose() reconstruct() validated by gates commands serializes queues rollback drives children iterative drain

State semantics

  • Destructed is the fresh-builder start, Constructed is the ready state, and Disposed is terminal.
  • Reconstruct is not shorthand in docs: it is its own observable four-step sequence.
  • Rollback after failed hooks is part of the normative lifecycle contract.

Atomicity

  • A per-VM guard serializes lifecycle work and blocks concurrent re-entry.
  • Late async completions that race dispose() abort instead of reviving a torn-down VM.
  • Container VMs orchestrate children but do not change the core state machine.

Messaging

  • Hub transactions preserve every typed message while deferring one iterative FIFO drain until the outermost scope exits.
  • Subscriber-generated messages append to the same queue instead of recursively re-entering the subject.
  • Per-instance propertyChanged surfaces exist so views do not need to filter the shared hub when they bind one VM.