Commit Graph
78 Commits
Author SHA1 Message Date
faumaray 8531bea681 Use organization release token 2026-08-01 20:12:32 +03:00
faumaray 68d86f76a2 Build release artifacts with RelWithDebInfo
Release / release (push) Successful in 29m41s
v1.1.0
2026-08-01 18:07:13 +03:00
faumaray cb58236538 Release 1.1.0 with transactional plugin validation 2026-08-01 17:59:57 +03:00
faumaray 4418374de7 Release: make checksums directly verifiable
Release / release (push) Successful in 1m6s
v1.0.0
2026-07-30 03:42:14 +03:00
faumaray d1572a55a5 Release: export token for publisher
Release / release (push) Failing after 1m2s
2026-07-30 03:33:57 +03:00
faumaray f732845dc7 Release: use native Gitea job token
Release / release (push) Failing after 1m2s
2026-07-30 03:30:45 +03:00
faumaray c509aa7424 Make rotating logger failure test deterministic
Release / release (push) Failing after 21m4s
2026-07-30 02:03:44 +03:00
faumaray f528ef644c Align release workflow with Gitea Actions
Release / release (push) Failing after 20m42s
2026-07-29 23:11:54 +03:00
faumaray 721e11f4ce Remove assistant-only repository artifacts 2026-07-29 22:51:54 +03:00
faumaray 4c2b96ac69 Add reusable strict JSON, rate limiting, and sealed secrets 2026-07-29 22:40:15 +03:00
faumaray 7edce967f2 Update: align component feed identities
CI / GCC 16 / C++26 / werror (push) Failing after 1m57s
CI / GCC 16 / C++26 / default (push) Failing after 2m36s
CI / GCC 16 / C++26 / sanitizers (push) Failing after 2m39s
2026-07-29 00:41:57 +03:00
faumaray 05815c4668 Update: add component catalog transactions
CI / GCC 16 / C++26 / sanitizers (push) Failing after 2m35s
CI / GCC 16 / C++26 / default (push) Failing after 2m39s
CI / GCC 16 / C++26 / werror (push) Failing after 1m54s
2026-07-29 00:22:20 +03:00
faumaray 9d8b334b4b Plugin: initialize readiness detail
CI / GCC 16 / C++26 / default (push) Failing after 2m39s
CI / GCC 16 / C++26 / sanitizers (push) Failing after 2m40s
CI / GCC 16 / C++26 / werror (push) Failing after 1m54s
2026-07-28 23:18:07 +03:00
faumaray 541d4e8b6d Plugin: adapt legacy lifecycle to modules
CI / GCC 16 / C++26 / sanitizers (push) Failing after 2m42s
CI / GCC 16 / C++26 / default (push) Failing after 2m43s
CI / GCC 16 / C++26 / werror (push) Failing after 1m52s
2026-07-28 22:58:44 +03:00
faumaray fb5388a7ee Plugin: add reusable module descriptor
CI / GCC 16 / C++26 / sanitizers (push) Failing after 1m48s
CI / GCC 16 / C++26 / werror (push) Failing after 1m56s
CI / GCC 16 / C++26 / default (push) Failing after 7m11s
2026-07-28 22:33:51 +03:00
faumaray 053ee5b296 update
CI / GCC 16 / C++26 / sanitizers (push) Failing after 4s
CI / GCC 16 / C++26 / werror (push) Failing after 3s
CI / GCC 16 / C++26 / default (push) Failing after 1m48s
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-25 23:42:52 +03:00
faumaray 3851aeb703 Update
CI / GCC 16 / C++26 / werror (push) Failing after 3m9s
CI / GCC 16 / C++26 / sanitizers (push) Failing after 10m15s
CI / GCC 16 / C++26 / default (push) Failing after 13m1s
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-20 01:18:53 +03:00
faumaray 8583a479dd Update
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-15 19:49:06 +03:00
faumaray fa30098129 Update
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-12 03:00:38 +03:00
Aleksey Selihov 4fca5523f6 Merge pull request 'feat/plugin-system' (#2) from feat/plugin-system into main
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
Reviewed-on: https://git.faumaray.ru/Void/VoidLibrary/pulls/2
2026-07-11 23:40:11 +00:00
Aleksey Selihov 704d1a8e89 Merge branch 'main' into feat/plugin-system
CI / GCC 16 / C++26 / default (pull_request) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (pull_request) Has been cancelled
CI / GCC 16 / C++26 / werror (pull_request) Has been cancelled
2026-07-11 23:38:22 +00:00
faumaray f94366104e Update
CI / GCC 16 / C++26 / default (pull_request) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (pull_request) Has been cancelled
CI / GCC 16 / C++26 / werror (pull_request) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-12 02:37:49 +03:00
faumarayandClaude Fable 5 9a54f15e7e Net: actually enforce Request::timeout on HTTP socket I/O
Request::timeout was declared but never used — every sync Asio
operation (TLS handshake, read, write) blocked without bound, so a
stalled peer hung the calling thread indefinitely (observed: a stalled
CDN download blocking a host's shutdown join forever).

SO_RCVTIMEO cannot fix this: Asio's sync emulation treats the
resulting EAGAIN as would-block and poll()s with no deadline. Instead
a per-request DeadlineGuard watchdog ::shutdown()s the descriptor on
expiry, which wakes any blocked sync op with EOF and fails the
request. Declaration order in send() keeps the descriptor owners alive
past the guard. Resolution and connect() remain on kernel defaults.

Regression test: a stalled localhost server is bounded at ~1s.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yj92cCihyaYtf4gKCT3nv
2026-07-12 00:20:49 +03:00
faumarayandClaude Fable 5 a06f639393 Plugin: copy_on_load option; unique hotswap temp names
- copy_on_load: dlopen a fresh-inode temp copy on first load (reloads
  already did), so deployments that rewrite the plugin file in place —
  e.g. a build writing its output — cannot corrupt the mapped image.
  The registry keeps addressing the original path for watch/reload.
- hotswap_copy now generates a unique temp name per copy. glibc dedupes
  dlopen by pathname, so the previous fixed ".void_hotswap" name made
  every second reload through the same path silently return the
  already-mapped OLD image instead of the new bytes.
- hot_reload_under_concurrent_load now asserts the true downgrade
  semantics (v2 -> v1 is rejected transactionally, v2 stays); it only
  ever passed the old all-succeed expectation via the dedup bug, since
  no flip after the first actually took effect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yj92cCihyaYtf4gKCT3nv
2026-07-11 23:46:21 +03:00
faumarayandClaude Fable 5 ee4486e1d2 Plugin: discovery, unload, config entry, multi-observer reloads, state API
Host-side additions for applications embedding a plugin system:

- PluginManager::load_directory(dir) loads every shared-library file in
  a directory (filename order) with per-file expected results.
- PluginManager::unload(name) drops the registry entry; the instance
  dies with its last pinned handle (RCU semantics, as on reload).
- Optional C entry void_plugin_configure(inst, config): fed from
  PluginManagerOptions::config_provider after create and after each
  reload swap, before on_load().
- on_reloaded() is now multi-observer: returns a ReloadCallbackId,
  remove_on_reloaded() unregisters. Manual reload() now notifies
  observers too (previously only watched reloads did, contradicting
  the documented contract). PluginServiceBinding deregisters its
  callback on destruction (was a dangling-callback hazard).
- PluginManager::serialize_state/deserialize_state expose the plugin's
  v2 state exports so an embedder can carry plugin state through its
  own hot reload.
- ServiceRegistry::remove<I>() withdraws a provided service (child
  removal re-exposes a parent's entry).
- EventBus::subscribe_scoped<E>() returns a move-only RAII
  Subscription that unsubscribes on destruction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yj92cCihyaYtf4gKCT3nv
2026-07-11 23:39:10 +03:00
Aleksey Selihov 6f1b5f0b72 Merge pull request 'Process update and UdpSocket' (#1) from feat/plugin-system into main
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
CI / GCC 16 / C++26 / default (push) Has been cancelled
Reviewed-on: https://git.faumaray.ru/Void/VoidLibrary/pulls/1
2026-07-11 18:44:30 +00:00
faumaray 7ca0e1b62e Process update and UdpSocket
CI / GCC 16 / C++26 / sanitizers (pull_request) Has been cancelled
CI / GCC 16 / C++26 / werror (pull_request) Has been cancelled
CI / GCC 16 / C++26 / default (pull_request) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-11 21:40:52 +03:00
faumaray 827c9e150a change rotation
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-06 14:42:28 +03:00
faumaray a4f52cf174 fix warnings in cmake about sqlite
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-06 12:03:10 +03:00
faumarayandClaude Opus 4.8 0b3505e00f Json: decode \u UTF-16 surrogate pairs to valid UTF-8
The \uXXXX unescaper encoded each 16-bit unit independently, so an astral
character written as a surrogate pair (e.g. an emoji, 🎸) became two
separately-encoded surrogates — invalid UTF-8 (ED A0 BC ED BE B8) that renders
as replacement characters. Consumers that validate UTF-8 (e.g. TeamSpeak)
reject any string containing it, which silently dropped every bot reply that
embedded an emoji-bearing YouTube title.

Combine a high surrogate (D800-DBFF) with the following low surrogate
(DC00-DFFF) into one code point and emit proper 4-byte UTF-8; a lone surrogate
still falls through as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 02:39:10 +03:00
faumarayandClaude Opus 4.8 2d3f9dc319 Log: carry call-site source_location through to the sink
Every log line showed LoggingAdapter.hpp as its source because make_sink
called Void::Logging::Logger::log() with a defaulted source_location captured
inside the adapter, discarding the real call site.

Capture std::source_location at each Void::Log::{info,warn,...} call via an
FmtLoc wrapper (the same trick Logger uses internally), thread it through a
4-argument Sink, and forward it from make_sink to logger.log(). Sinks now
receive the originating file/line/function.

Formatted emission is routed through a single non-overloaded Detail::emit():
forwarding a (level, module, std::string, source_location) call to the public
log() would otherwise also match the variadic log() overload, deducing
source_location as a format argument and failing in FmtLoc's consteval ctor.

Sink is now a 4-arg callable; updated the bundled tests accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 02:35:42 +03:00
faumaray e4ddb0c8c4 update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-06-25 02:16:11 +03:00
faumarayandClaude Opus 4.8 96b8b19970 Net: configurable body limit, opt-in redirect following, tolerant CONNECT
HttpClient could not download release artifacts (e.g. yt-dlp self-update):

- Beast's default body limit (~1 MiB) rejected the ~30 MB binary with
  "body limit exceeded". Add set_max_body_size() (0 = unlimited; default
  64 MiB) and read the body through a response_parser with that limit.
- Through an HTTP proxy the CONNECT reply was parsed with empty_body, so any
  body on a non-2xx reply threw "unexpected body" before the status could be
  inspected. Read only the header (skip(true) + read_header) so the tunnel
  status is checked cleanly.
- Add set_max_redirects() to follow 3xx Location transparently (default 0 =
  off, so callers that inspect redirects keep working). Resolves absolute,
  host-relative and bare-relative Location targets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 01:53:10 +03:00
faumarayandClaude Opus 4.8 2c3ff56b67 Sqlite: add bind(const std::string&) overload
Disambiguates std::string arguments to Statement::bind, which otherwise
match both bind(string_view) and bind(optional<string>) and are ambiguous.
Delegates to the string_view overload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:41:33 +03:00
faumarayandClaude Opus 4.8 44839f9f24 Json: add typed safe-navigation member accessors
Value::has / get_str / get_num / get_bool / child_object / child_array —
convenience getters for walking dynamic JSON without manual find()+type-check
chains. Missing or wrong-typed keys yield the supplied default (scalars) or
nullptr (children); never throw. Tests in JsonAccessors.cpp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 22:13:47 +03:00
faumarayandClaude Opus 4.8 adc0de310e Service: allow registering non-polymorphic service types
ServiceRegistry::provide<I> cross-cast to IService via dynamic_cast, which
fails to compile when I is a plain (non-polymorphic) value type. Guard the
cross-cast with std::is_polymorphic_v<I>; non-polymorphic services are
stored and resolvable but carry no lifecycle aspect. Test added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:59:02 +03:00
faumarayandClaude Opus 4.8 cb639a713d Add Void::Sqlite — RAII SQLite wrapper with migrations
New SHARED module (separate from Data so Json/Csv/Ini consumers don't link
SQLite). Generic, Result-based:
- Database — open (file or :memory:), exec, prepare, begin, last_insert_rowid,
  changes; enables WAL + busy timeout + foreign_keys for writable modes.
- Statement — move-only prepared statement; 1-based typed bind (int/double/
  text/null/optional), step(), reset, 0-based column accessors.
- Transaction — RAII; rolls back on scope exit unless commit() is called.
- Migration + Database::migrate() — forward, in-order, idempotent schema
  upgrades tracked via PRAGMA user_version.

Dependencies.cmake resolves SQLite::SQLite3 via find_package. Tests exercise
CRUD, null handling, commit/rollback, migrations and errors on :memory:.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:24:18 +03:00
faumarayandClaude Opus 4.8 c92dff6ff7 Add Void::Net — HTTP client + URL parser + SOCKS5/CONNECT proxies
New SHARED module built on Boost.Beast/Asio + OpenSSL (all generic, no
application coupling):
- Void::Net::Url — RFC 3986 parse into scheme/host/port/path/query/target
  (Boost.URL), with scheme-default ports and TLS detection.
- Void::Net::HttpClient — synchronous GET/POST/send with TLS (SNI),
  configurable User-Agent and TLS verification, request/response types.
- Proxy support: HTTP CONNECT tunnelling for TLS targets, plain-HTTP
  forwarding, and a full SOCKS5 handshake (auth, IPv4/IPv6/domain).
- Reuses Void::Encoding::Base64 for proxy auth.

Build wiring: Dependencies.cmake resolves Boost (headers + url) and OpenSSL
+ Threads via find_package (system Boost/OpenSSL). Tests cover URL parsing
and live localhost HTTP GET/POST round-trips (full suite 1136 pass).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:21:08 +03:00
faumarayandClaude Opus 4.8 fb0506581f Add Url/Html encoding, ISO-8601 interval parse, TempFile, random_string charset
Universal additions (all generic, header-only, tested; full suite 1127 pass):
- Void::Encoding::Url — RFC 3986 percent encode/decode + query_encode.
- Void::Text::html_unescape — numeric + common named HTML entities -> UTF-8.
- Void::Time::parse_iso8601_interval — parse PT#H#M#S / P#DT#H#M#S durations
  (distinct from the unit-suffix parse_duration).
- Void::FileSystem::TempFile — RAII unique temp file (alongside TempDir),
  with keep() to persist.
- Void::Random::random_string(n, charset) overload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:15:01 +03:00
faumarayandClaude Opus 4.8 80293ee56f Add async/resilience/reflection primitives + FSM v2 rewrite
A round of new universal capabilities (all generic — templated/reflection
based, no app coupling), verified by the test suite (1103 passing):

Data reflection:
- Reflect.hpp now (de)serializes chrono::duration, chrono::time_point,
  std::variant (tagged), std::array, and non-string-keyed std::map;
  Meta.hpp gains is_time_point_v et al.

Async:
- EventBus gains Mode::Async (worker-thread dispatch + flush()).
- ThreadPool gains a bounded queue, try_submit(), and rejection stats.

New modules / containers:
- Resilience: TokenBucket, KeyedRateLimiter<Key>, CircuitBreaker,
  ResourceMonitor.
- Containers: BufferPool<T> (size-class buffer reuse) and Cache<K,V>
  (per-entry TTL, LRU/LFU/FIFO eviction, hit/miss stats).
- System: process/CPU/memory metrics (Metrics.hpp) and a streaming
  Process API.

Plus FSM v2 (typed Success/Failure, sub-machines, parallel regions,
history states, deferred events), Configuration/Logging reflection
helpers, and the accompanying test suites.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 15:45:16 +03:00
faumarayandClaude Fable 5 43b5a81504 FSM: fix parked-coroutine leak — Machine owns its driver
A machine started in worker mode and stopped while still parked on an event
(e.g. await_event that never arrives) leaked its whole suspended coroutine
frame chain. start() used Async::spawn, which detaches the driver in a
fire-and-forget DetachedTask with no retained handle, so nothing could ever
destroy the parked frames. Pre-existing since before the FSM upgrade
(confirmed via a worktree at the prior baseline); the Serialize suite hit it
(two tests start a machine that parks then stop()).

Fix: the Machine now owns its top-level driver coroutine as a member
(std::optional<Coro::Task<void>>) instead of detaching it — start() posts
the driver's handle to the executor while retaining ownership, and stop() /
reset() destroy it after the worker is joined. Destroying the owning Task
cascade-destroys the suspended chain (each nested Task destructor frees its
handle). Added a non-owning Coro::Task::handle() accessor for scheduling.

Full ASan/UBSan suite now clean (was: 1616 bytes leaked in Serialize); 1002
tests (999 green, 3 skipped), 0 flaky in 12 worker-mode runs, Void_Fsm
-Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 17:29:48 +03:00
faumarayandClaude Fable 5 4af3ee6d0c FSM (8): deferred events + richer reactive DSL — completes the upgrade
Final phase of the FSM upgrade. Extends the reactive transition DSL:

- Deferred events: on.defer<E>() holds an E that arrives while in the state
  (instead of dropping it) and re-posts it to the mailbox after the next
  transition (UML deferred-event semantics). The reactive loop awaits the
  declared + deferred types, accumulates held envelopes, and re-injects them
  via Machine::repost() on exit.
- Entry/exit actions: on.enter(fn) / on.exit(fn) run when the reactive state
  is entered / left (around the wait loop).
- Internal transitions: on.event<E>().internal(fn) runs fn on E but stays in
  the state — no exit/enter, no transition (EventEntry gains an `internal`
  flag; the loop runs the action and keeps waiting).

2 new tests (Defer): a deferred Click is held in Busy and replayed in Idle
after Done (with enter/exit ordering asserted); three internal Ticks
accumulate with the state entered exactly once. 1002 tests (999 green, 3
skipped), ASan/UBSan clean, -Werror clean.

This finishes the requested FSM upgrade: one signature-inferred State,
typed Success/Failure results, multi-waiter mailbox, parallel/orthogonal
regions, history states, and the deferred/internal/entry-exit DSL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 02:48:27 +03:00
faumarayandClaude Fable 5 2903eca3a6 FSM (7): history states — run_region<Sub>(Resume::History)
A composite region can resume at the sub-state it last reached instead of
restarting from its initial state (shallow history), reusing the existing
serialize()/restore():

  co_await run_region<Work>();                 // Initial (default)
  co_await run_region<Work>(Resume::History);  // resume where it left off

- New Resume{Initial, History} enum. On region exit the engine snapshots the
  child's serialize() keyed by region type into the parent
  (m_region_history); on a History re-entry it restore()s that snapshot
  before driving. restore() runs before attach() (attach marks the child
  Running, and restore requires Idle).
- run_region no longer forwards constructor args (children are
  default-constructed, like run_parallel); the only prior caller passed
  none.

2 new tests (History): a History re-entry resumes at the last leaf (skips
the earlier states); a plain Initial re-entry restarts from the top. 1000
tests (997 green, 3 skipped). History/Hierarchy/Parallel ASan-clean.

Known pre-existing issue (NOT from this change): the Serialize suite leaks
under ASan because two tests start a machine that parks on an event then
stop() without it finishing — the parked coroutine frame is never
destroyed. Confirmed present at the pre-epic baseline (7c7c590); it is an
engine-lifetime issue (machine stopped while parked), orthogonal to the FSM
feature work, and left for a separate fix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 02:42:35 +03:00
faumarayandClaude Fable 5 9d6be56847 FSM (6): parallel / orthogonal regions (run_parallel, run_parallel_any)
Builds on the multi-waiter mailbox: a state can run several sub-machines
concurrently on the shared executor.

- co_await run_parallel<A, B, ...>() spawns each child (Async::spawn) and
  joins ALL, yielding std::tuple<A::Outcome, ...>. Children run interleaved
  on the single executor — when one parks on an event, another runs (only
  possible now that the mailbox holds multiple waiters).
- co_await run_parallel_any<A, B, ...>() resolves on the FIRST to finish,
  yielding std::variant<A::Outcome, ...> of the winner. Losers keep running
  cooperatively (coroutines aren't preemptible), so the children are kept
  alive by the spawned tasks (shared_ptr keepalive) until they finish — a
  loser parked forever leaks its frame until the machine stops (documented).
- Join is a small latch coroutine (completion counter + a parked parent
  handle posted when it reaches zero / on first arrival); single-consumer,
  no lock. Children default-constructed, share events/services.

3 new tests (Parallel): join-all (worker + deterministic embedder, both
children park concurrently), first-finisher race. 998 tests (995 green, 3
skipped), ASan/UBSan clean (validates the spawned-task lifetimes — no UAF/
leak), -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 01:34:48 +03:00
faumarayandClaude Fable 5 c6b7306614 FSM (5): multi-waiter mailbox (engine foundation)
ExecutionContext had a single Waiter slot, so only one coroutine could park
on events at a time. Replace it with a FIFO list of waiters: set_waiter
appends (each with a unique id + its own timer); deliver routes an event to
the first parked waiter that wants its type, else buffers; a timeout fires
only its own waiter (found by id). Single-consumer invariant unchanged — all
mailbox mutation stays on the consumer thread.

Pure refactor (no API change); unblocks parallel regions and deferred
events. 995 tests (992 green, 3 skipped), ASan clean, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 01:24:02 +03:00
faumarayandClaude Fable 5 ec9e466d7a FSM (4): one signature-inferred State (drops Reactive/Continue bases)
There is now a single state base, `State`. The engine infers each state's
role purely from member signatures via P2996 — no `override`, no
framework-mandated names:

  struct Work : State {                          // entry
    Coro::Task<Step> run() { ... }
    Coro::Task<Step> run(Cfg c) { ... }          // startup-entry (launch data)
  };
  struct Idle : State {                          // reactive
    void transitions(TransitionBuilder& on) { on.event<Go>().to<Run>(); }
  };
  struct After : State {                         // continuation
    Coro::Task<Step> ok(ChildSuccess auto s) { use s.value; }
    Coro::Task<Step> no(ChildFailure auto f) { use f.value; }
  };

- Detail/Roles.hpp: ChildSuccess/ChildFailure concepts over boxes, plus the
  reflection selectors (invoke_entry / invoke_startup / invoke_handler /
  dispatch_result / has_transitions / make_driver). At add<S>() a per-state
  driver thunk is stored (reactive table vs entry, by whether S has a
  TransitionBuilder& member); drive() calls it. startMachine<Sub, Next>(data)
  builds a Launch step carrying a launcher (injects data into Sub's initial
  startup-entry) + a dispatcher (dispatch_result<Next, Sub>) that builds the
  ChildSuccess/Failure box and calls Next's matching handler.
- Removed Reactive/Continue<R> bases, StateKind/kind(), StateBase::run/resume
  (only on_enter/on_exit remain virtual). Reactive states keep the same DSL.
- Toolchain note: template-for + member splicing fails inside a coroutine
  body in this GCC build, so the selectors are non-coroutines returning a
  Task<Step> (plain Step wrapped via ready_task). Discovery is
  invocability-based — no parameter-type reflection (P3096). Probe-verified.

All FSM tests migrated to the nameless style (SubMachine: Continue ->
ChildSuccess/Failure handlers + startup-entry seeding; reactive states drop
the Reactive base/override). 995 tests (992 green, 3 skipped), ASan clean,
-Werror clean; lone intermittent failure remains the pre-existing racy
plugin hot-reload-under-load test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 01:20:56 +03:00
faumarayandClaude Fable 5 9e9eb838ea FSM: typed Success/Failure result model (reflected nested types)
A machine is now Machine<Derived> (dropping the ResultT template param) and
declares its result types as nested types reflected *by name* — Success and
Failure (a struct or a using-alias), each defaulting to void:

    class Login : public Machine<Login> {
      using Success = Token;     // or a nested struct; default void
      struct Failure { int code; };
    };

- Outcome = std::expected<Success, Failure> (void failure -> std::monostate
  error arm). succeed(Success{...}) / fail(Failure{...}) carry the typed
  values (nullary when void). Resolved by plain dependent-name lookup
  (Detail/Result.hpp), no P2996.
- Engine/system faults (no initial state, unregistered target, no entry)
  travel a SEPARATE FsmError channel: status()==Faulted + system_error(),
  never the typed Failure. New Step::Kind::Fault carries it.
- CRTP wrinkle: Derived is incomplete at base instantiation, so the engine
  stores the result type-erased (std::any) and rebuilds the typed Outcome in
  wait()/run_blocking()/take_outcome() — function templates defaulted on
  Derived. run_child/run_region/start_machine reconstruct OutcomeOf<Sub> at
  the boundary (Sub is complete).
- Step carries Success/Failure payloads as std::any; the reactive DSL
  (finish/fail) and Continue<Sub> are reparameterised off the nested types.

Interim: Continue<Sub> keeps the named on_success/on_failure form (Phase 2
replaces it with signature-inferred ChildSuccess/ChildFailure). All FSM
tests migrated to the nested-type form. 995 tests (992 green, 3 skipped),
ASan clean, -Werror clean; the lone intermittent failure is the
pre-existing racy plugin hot-reload-under-load test (flaky on HEAD too).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 21:14:43 +03:00
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
faumarayandClaude Fable 5 b34226369a FSM (2): declarative sub-machine continuations (startMachine + Continue<R>)
A state can now launch a full sub-FSM and have the engine resume into a
named state that handles the result, instead of awaiting+branching by hand:

    co_return startMachine<Login, AfterLogin>(user, tries);

    struct AfterLogin : Continue<bool> {        // Login = Machine<Login,bool>
      Task<Step> on_success(bool ok) override {
        co_return ok ? next<Home>() : next<Locked>(); }
      Task<Step> on_failure(FsmError e) override { co_return fail(e.message); }
    };

- Sub runs on the parent's shared executor/event-mailbox/services (reuses
  run_child); seed data is forwarded to Sub's constructor.
- The engine dispatches on its own: on entry with a pending result it calls
  the state's resume(), which Continue<R> overrides to pick
  on_success(R)/on_failure(FsmError) by the outcome. Continue<void> takes a
  nullary on_success(). A Continue handler may itself return another
  startMachine (chaining) or any Step.
- Type-safe: startMachine<Sub, Next> static_asserts Next derives
  Continue<Sub::result_type> and is in States<>.

Mechanics: Step gains Kind::Launch carrying the target + a type-erased
launcher (a coroutine that runs the sub and maps its Outcome to a
LaunchResult); drive() awaits it, stashes the result, and the entered
state's resume() consumes it. StateBase::resume defaults to run().

5 new tests (SubMachine): success/failure dispatch, void-result nullary
on_success, chained startMachine through Continue states, and that the sub
shares the parent's event mailbox. 987 green, ASan+UBSan clean, stable
across 10 runs, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 15:37:40 +03:00
faumarayandClaude Fable 5 fedc14b0e3 FSM refactor (1): split the Fsm.hpp monolith into focused headers
Fsm.hpp had grown to ~1200 lines holding everything. Split it behind the
same <Void/Fsm/Fsm.hpp> umbrella (which now just includes Machine.hpp), with
no behaviour change:

- Machine.hpp — the Machine<Derived,ResultT> template: States list, nested
  State/Reactive bases, lifecycle, events, nesting, persistence.
- Detail/Reactive.hpp — the declarative transition DSL lifted to standalone
  templates (TransitionTable/EventEntry/EventClause/AfterClause/
  TransitionBuilder parameterised by Derived/ResultT); Machine::Reactive
  aliases TransitionTable/TransitionBuilder.
- Detail/Awaiter.hpp — one EventAwaiter built on
  ExecutionContext::{try_take_any,set_waiter}; the four near-identical inline
  awaiters (await_event / await_event_for / await_any / await_any_event)
  collapse to make_event_awaiter wrappers with per-call projections.
- Detail/Introspect.hpp — namespace-scope StateInfo/EdgeInfo + free
  to_mermaid(span<StateInfo>); describe() returns the shared structs,
  to_mermaid() delegates.
- Detail/TypeName.hpp — shared Detail::type_name<T>() (P2996 identifier_of,
  typeid fallback), replacing the per-class state_type_name helper.

982 green, ASan clean, -Werror Fsm build clean. No test changes needed.

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