Files

2.5 KiB

M-FSM-01..05 — Structured Scopes, Race-Loser Joins, Boundary Checkpoints & Bounded Supervision

  • Wave: Wave 8 (feat/roadmap-p2-wave8, branched from main at d83d0f4)
  • Roadmap reference: docs/roadmap/modules/Fsm.md, docs/roadmap/DEPENDENCIES.md

Scope & Ownership

  • src/Fsm/module.cmake: INTERNAL_DEPS Async Core Data Functional Time Log Service.
  • include/Void/Fsm/StateKey.hpp: kFsmErrorDomain = 25, FsmErrorCode, make_fsm_error, shared constexpr bool terminal(Status) including Faulted, TerminationReason, FsmLimits (1,024 mailbox events / 4 MiB, 256 deferred, 1,024 timers, 128 child regions, depth 32, 256 retained transitions, 4 MiB checkpoint, 64 events / 1ms per turn), Checkpoint, ExecutionBinding, StateId.
  • include/Void/Fsm/Detail/Engine.hpp + src/Fsm/Engine.cpp:
    • Injected Time::MonotonicClock and FsmLimits for timers and turn budgeting.
    • Bounded try_post enforcing mailbox event & byte limits (overloaded) alongside a bounded control lane so stop/checkpoint/jump always progress.
    • Scope-tracked waiters & timers (cancel_scope_waiters) cancelled prior to state destruction.
  • include/Void/Fsm/Machine.hpp:
    • Preserve 100% of existing API (start, wait, run_blocking, run_parallel, run_parallel_any, serialize, restore).
    • Add acquire_service<I>() returning owning Service::ServiceHandle<I>, try_post, termination_reason, bounded transition_history, observer_errors, state_stop_token(), await_event_cancellable, safe_point.
    • Add run(ExecutionBinding, Async::OperationOptions) with root + per-state stop scopes, waiter/timer cleanup before on_exit, on_exit exception faulting, observer error isolation.
    • Add run_parallel_structured (sibling fault stop/join) and run_parallel_any_structured (deterministic tie-break + stop/join all losers).
    • Add boundary request_checkpoint / restore_checkpoint / restore_legacy_checkpoint.
  • include/Void/Fsm/Orchestrator.hpp: fix FsmHandle::finished() via terminal(status()), clarify shared_ptr ownership docs, add SupervisionPolicy (StopOnFault, BoundedRestart 3/60s on injected clock, 1,024 max supervised), unlocked observers, try_launch.
  • Tests & consumers: tests/standalone/Fsm/FsmHardening.cpp, tests/package/FsmOnly/*, tests/package/InstalledComponents.cmake.

Verification Criteria

  • Standalone Fsm;Testing RelWithDebInfo -Werror: Fsm* tests + ctest 2/2 (FsmOnly).
  • Full Wave 8 RelWithDebInfo -Werror, ASan+UBSan -Werror, and Wave 8 TSan.