Remove the two old FSMs ahead of the inheritance-based rewrite
Deletes the compile-time Void::StateMachine and the builder-based runtime Void::Fsm (Definition/Machine/Event/PluginBehavior + their standalone tests, the FSM behaviour plugins, and the FSM x Plugin integration test and its CMake wiring). The general-purpose Plugin module and its stateful hot-reload tests are untouched. Both are being replaced by a single inheritance + coroutine workflow FSM (next phase). 936 tests green (51 old FSM/StateMachine tests removed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b5f61f00a
commit
04cf1998bd
20 files changed
+3
-3793
No files matched your search
@@ -47,8 +47,7 @@ VoidLibrary is a C++26 modular shared library organized as **umbrella modules**
|
||||
| `Configuration` | SHARED | Config, Env + Argparse |
|
||||
| `Stacktrace` | SHARED | Boost.Stacktrace capture, color helpers (kept separate to isolate the Boost dep) |
|
||||
| `Plugin` | SHARED | dlopen loader + manager, C ABI, hot reload (see below) |
|
||||
| `StateMachine` | INTERFACE | compile-time variant-based FSM |
|
||||
| `Fsm` | SHARED | runtime hierarchical FSM (see below) |
|
||||
| `Fsm` | SHARED | inheritance + coroutine workflow FSM (see below) |
|
||||
| `Testing` / `TestingMock` | STATIC / INTERFACE | test + mock frameworks |
|
||||
|
||||
`include/Void/Detail/` (e.g. `Enum.hpp` — P2996 enum reflection) is not a module; it is header-only and reachable from every module via the shared include root.
|
||||
@@ -136,19 +135,9 @@ Other key points:
|
||||
|
||||
`Configuration::Config`: flat string store with dotted keys. Sources (overlay-composable, last wins): `from_env`, `from_env_prefix("APP_")` (`__`→`.`, lowercased), `from_file` (KEY=VALUE), `from_ini`, `from_json` (flattened), `from_args` (`--key=value`). Typed access `get_as<T>` / `get_or_as<T>` (numbers, bool spellings, enums by name via reflection, chrono durations like "250ms"). `subtree(prefix)` strips a prefix. `Bind.hpp`: `bind<T>(cfg, prefix)` fills an aggregate via P2996 (defaults = schema). `Watch.hpp`: `ConfigWatch` reloads a file on change with per-key diff (debounced polling via `FileSystem::FileWatcher` in `System`).
|
||||
|
||||
### Fsm module (runtime FSM)
|
||||
### Fsm module
|
||||
|
||||
`Void::Fsm` — full-featured runtime state machine, distinct from the compile-time `StateMachine`:
|
||||
|
||||
- **Definition**: `Builder` declares states by name (`state("a", parent)` — hierarchical), events (`event("go")` or from enums via reflection), `initial`, `parallel` (orthogonal regions), `history(Shallow|Deep)`, `defer`, `timeout(state, ms, event)`, `transition(from, on, to).guard(...).action(...)`, `internal(in, on)`. `build()` validates into an immutable `shared_ptr<const MachineDef>`. Names are the stable identity; ids are per-definition.
|
||||
- **Actions** are `std::function<Coro::Task<void>(Machine&, const Event&)>` (sync lambdas via `SyncAction` overloads). The run-to-completion step finishes only when the action's coroutine completes; the worker drives it on its own `ManualExecutor`.
|
||||
- **Concurrency (MPSC)**: `post()` is lock-free from any thread (Vyukov queue + park semaphore); exactly one consumer — the owned worker (`start()` returns once the initial configuration is entered) or the embedder via `run_pending()` when constructed with `MachineOptions{.own_worker = false}` (the deterministic mode used by most tests; note `send_wait`/queued `serialize_state` would self-deadlock there — they're for the worker mode). Observation (`current()`, `is_in`) is a seqlock read of a trivially-copyable `StateSnapshot` (≤16 active leaves).
|
||||
- **send paths**: `co_await machine.send(ev[, &executor])` resolves with `SendResult{Handled,Deferred,Unhandled,Dropped}` after the step; `send_wait` blocks; resumption defaults to the machine worker.
|
||||
- **Hot swap**: `swap_definition(def)` applies between steps. If every active leaf name exists in the new def, the configuration is adopted without re-running entry actions (seamless); otherwise the machine re-enters the initial configuration. History is remapped by name.
|
||||
- **Persistence**: `serialize_state()` → JSON with leaf/history *names*; `restore_state(json)` on a stopped machine re-activates silently (no entry actions).
|
||||
- History records are snapshotted at exit time in `perform_transition` (not incrementally) — keep it that way; incremental recording accumulates stale leaves.
|
||||
|
||||
**FSM behaviours from plugins** (`Fsm/PluginBehavior.hpp`): a plugin implements `IFsmBehaviorPack::register_into(Builder&)` and exports `extern "C" IFsmBehaviorPack* void_plugin_fsm_behaviors()`. The host resolves it via `PluginManager::raw_symbol(name, kFsmBehaviorsSymbol)`, calls `build_machine_def(pack)`, and on `on_reloaded` rebuilds + `swap_definition` — same state names ⇒ the running machine keeps its configuration. Plugin-provided actions are `std::function`s whose code lives in the `.so`; keep a `PluginHandle` pinned and rely on `dlclose_on_swap=false` so the code pages stay mapped under in-flight coroutine frames. See `tests/internal/FsmPluginHotReload.cpp`.
|
||||
`Void::Fsm` is being rewritten as an inheritance + coroutine workflow FSM (states as nested structs, async `run` returning next-state/success/fail, events, nesting, dynamic registration). Documented when it lands.
|
||||
|
||||
### Plugin module (hot reload)
|
||||
|
||||
|
||||
Reference in new issue
Block a user