Files
Library/tests
faumarayandClaude Fable 5 7c7c590d79 FSM (3): direct control — fluent events, free jumps, lifecycle, mutation
Adds imperative ergonomics for driving and reshaping a machine. The engine
isn't preemptible mid-state (coroutines aren't interruptible), so external
controls apply at transition boundaries and mutation is Idle-only — both
documented.

- Fluent events: send(e1, e2, …) variadic post.
- Free runtime jumps: in-state goto_state<S>() reaches any registered state
  with no declared transition ("each state can be moved to another state");
  external jump<S>() requests a redirect applied by drive() at the next
  boundary (race-safe via an atomic, non-preemptive).
- Lifecycle: reset() returns a finished/idle machine to Idle (drops the
  owned ctx, clears outcome/current/jump); restart() / restart_at<S>()
  re-run; pause() / resume() (ExecutionContext gains a paused flag — the
  worker stops draining and pump() no-ops while paused; posted events
  buffer until resume()).
- Runtime mutation (Idle only): remove<S>() (re-packs indices,
  fixes the initial), set_initial<S>(), replace<S, T>().

8 new tests (Direct): send batch, goto_state skip, boundary jump (embedder
mode), restart / restart_at, remove + set_initial, replace, pause holds
events until resume. 995 green, ASan+UBSan clean, 0 flaky in 15 runs,
-Werror clean. Completes the FSM refactor plan (1-3).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 15:44:19 +03:00
..