Commit Graph
45 Commits
Author SHA1 Message Date
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
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
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
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 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 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 667045564e FSM v2 (D): hierarchy ergonomics — composite regions, await_any, state_path
- run_region<Sub>() — run_child plus introspection: shares the parent's
  executor/event mailbox/services, the calling state's on_enter/on_exit
  wrap it, and the parent's state_path() reports the parent->child chain
  while it runs. The caller maps the child's Outcome to a sibling
  transition.
- await_any<Es...>() — typed multi-event await yielding std::variant<Es...>,
  so one state handles several event types at a single level (parent-level
  watching alongside a child region's own events).
- state_path() now appends an active region child's path (consumer-
  consistent; deterministic in pump() mode). current_state() stays the
  lock-free cross-thread read.

Coroutines aren't preemptible mid-flight, so composite cancellation is
cooperative: the region awaits a shared Cancel event (events route to the
deepest awaiter) and returns a failing Outcome the parent maps — no frame
is abandoned. Documented in CLAUDE.md.

3 new tests (Hierarchy): region result drives the parent transition,
parent cancel routes to a sibling, state_path reports parent->child. 982
green, ASan+UBSan clean, stable across 10 runs, -Werror clean. Completes
the FSM v2 plan (A-D).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 15:13:47 +03:00
faumarayandClaude Fable 5 d9842129c7 FSM v2 (C): retry/error policies, transition interceptors, introspection
Error policies (State helpers; no engine change beyond timer-driven delay):
- delay(duration) suspends a state via a timer then resumes.
- with_retry(times, backoff, attempt) retries an async sub-step
  (Coro::Task<bool>) with backoff between tries, returning whether it
  eventually succeeded.
- next_or<Fallback>(step) routes a failing Step to a fallback state
  instead of failing the whole machine.

Interceptors / middleware:
- Machine::add_interceptor({before(Transition), after(state_name)}) runs
  ordered hooks around each transition (before = state entered, after =
  state finished running) for logging/metrics/validation. observe() stays
  the single read-only observer.

Introspection / diagram:
- Reactive transition entries now carry event/target names; describe()
  enumerates registered states (name, reactive?, initial?) plus the
  transitions declared by reactive states (event, target, guarded);
  imperative run()-chosen edges aren't statically knowable so those states
  appear as edgeless nodes. to_mermaid() renders a stateDiagram-v2 string.

12 new tests (Policies): with_retry success/exhaustion->fallback,
interceptor before/after ordering + registration order, describe() lists
states + reactive edges, to_mermaid() edge rendering. 979 green,
ASan+UBSan clean, stable across 10 runs, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 15:06:17 +03:00
faumarayandClaude Fable 5 422a7705c5 FSM v2 (B): timers, await_event_for, reactive/declarative states + guards
Engine: ExecutionContext gains a timer set (add_timer/cancel_timer); the
worker parks with try_acquire_until(earliest deadline) instead of a bare
acquire, and fires due timers in pump()/run_loop. The event mailbox waiter
is now multi-type (await any of N event types) and carries an optional
timeout — deliver() matches a waiting state directly (event needn't sit in
a buffer) and cancels the paired timer; the timer's fire resumes the
waiter with timed_out set. Single consumer still owns all mailbox/timer
state, so it stays lock-free for state code.

Machine:
- await_event_for<E>(duration) -> std::optional<E> (nullopt on timeout);
  await_any_event(types, deadline) for reactive states; existing
  await_event<E> rebuilt on the multi-type API.
- Reactive state base: instead of run(), a state overrides
  transitions(TransitionBuilder&) declaratively —
  on.event<E>().guard(fn).action(fn).to<S>() / .finish(v) / .fail(msg),
  and on.after(d).to<S>()/.fail(). The framework-provided run() builds the
  table once and loops: await any declared event or the timeout, evaluate
  matching entries in declaration order, check guard, run action,
  transition. Guards = bool(Derived&, const E&), actions sync or
  Coro::Task<void>. to<S>() static-asserts S in States<>. Reactive and
  imperative State subclasses mix freely in one machine.

8 new tests (Reactive): guarded reactive state + action ordering mixed
with an imperative terminal; await_event_for timeout vs event; reactive
after().to<> firing vs event beating the deadline. 973 green, ASan+UBSan
clean, timer tests stable across 12 runs, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 01:11:53 +03:00
faumarayandClaude Fable 5 e941a48007 FSM v2 (A): CRTP typed access, States<> auto-registration, lifecycle, observers
Maintainability core, breaking the state API (all FSM tests migrated):
- Machine<Derived, ResultT> (CRTP). State::self() returns Derived& — drops
  the static_cast<Derived&>(machine()) boilerplate from every state.
- `using States = Fsm::States<...>` auto-registers every state in the base
  ctor (first entry = initial unless `using Initial = S`); no more manual
  add<S>()/initial<S>() for static machines. next<S>() static_asserts S is
  in the list (unregistered targets are now a COMPILE error, not a runtime
  fail); next_dynamic<S>() + add<S>()/add_if<S>() remain for dynamic
  machines.
- Per-state lifecycle: StateBase gains virtual on_enter()/on_exit()
  (Coro::Task<void>, default no-op) run around run(); the engine visit is
  enter -> run -> exit, so entry/exit actions split out of run(). run()
  now has a default (fails) so reactive states (Phase B) needn't define it.
- Observability: virtual on_transition(from,to) (default logs via Void::Log)
  + observe(fn) called on every transition (and the initial entry) with a
  Transition{from,to,step}. state_path()/state_names() added.

Migrated Basic/Events/Nesting/Serialize/Concurrency + the Orchestrator and
service-hot-reload tests to CRTP + self() + States<>; new Lifecycle suite
(enter/run/exit ordering, observer edges, default-run failure). 968 green,
ASan+UBSan clean, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 01:03:43 +03:00
faumarayandClaude Fable 5 7b6cd7341a Plugins provide services: hot-reload + state-saving via the registry
Re-expresses the old FSM-plugin hot-plug through the service layer,
reusing the unchanged Plugin module (PluginManager, v2 serialize/
deserialize ABI, FileWatcher, atomic-rename install).

Service/PluginService.hpp: PluginServiceBinding<I> resolves a plugin's
exported service (extern "C" void_plugin_service(instance) -> IService*)
via PluginManager::raw_symbol and registers it under interface I. The
registry entry pins the plugin instance (and its mapped .so) so in-flight
callers never see a freed object. enable_hot_reload() re-binds on each
reload; the FSMs resolve I through their context, so a running FSM picks
up the new implementation on its next service<I>() call with no code
patched. I must derive IService (single inheritance) so the host recovers
it from IService* by static_cast — no dynamic_cast across RTLD_LOCAL.

Tests: ServicePluginV1/V2 (the plugin object is the service: IPlugin +
ICalc : IService; v2 migrates v1 state via Json::MigrationChain).
FsmServiceHotReload.cpp: an Orchestrator-launched FSM accumulates through
the plugin service while a reloader thread flips v1<->v2 under load —
state survives every migration, the FSM runs to completion, no crash; and
a deterministic reload test proving the implementation swaps (version
1->2) with the running total migrated.

Docs: CLAUDE.md/README updated for the new Fsm, Service, and Orchestrator
(StateMachine row removed). 965 tests green, ASan+UBSan clean, stable
across runs, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 00:47:47 +03:00
faumarayandClaude Fable 5 d5e53a4c75 Add Fsm::Orchestrator — owns the registry, launches/supervises FSMs
Orchestrator (Fsm module, which already depends on Service): holds a
ServiceRegistry, exposes services() for providers, start_services() to
run lifecycle on_start hooks, and launch<F>(args...) which constructs an
FSM, injects the registry as its context (set_services), starts it, and
supervises it via a type-erased FsmHandle (status/stop). stop_all()
stops every supervised FSM then the services (balanced exactly once
against start_services so the explicit call + destructor don't
double-fire on_stop). FSMs resolve dependencies purely by interface
through the injected registry, so the orchestrator wires graphs of
services + state machines with no concrete coupling.

3 tests: service injection into a launched FSM, launch + supervise +
stop_all with a worker-backed FSM hitting a shared service, and service
start/stop lifecycle ordering. 963 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 00:41:56 +03:00
faumarayandClaude Fable 5 cfeaf93a53 Add Service registry and rewrite Fsm as an inheritance/coroutine workflow
Service module (Void::Service):
- IService base (service_name + on_start/on_stop lifecycle).
- ServiceRegistry: type-keyed container — provide<I>(impl), get<I>()
  (nullptr if absent), require<I>() (throws), has<I>(), start_all/
  stop_all. Consumers depend only on the interface I and resolve at
  runtime (dependency inversion); a concrete that derives IService is
  recovered for lifecycle via dynamic_cast even when registered under a
  plain interface. shared_mutex; reads are the hot path.

New Void::Fsm — a single inheritance + coroutine workflow FSM replacing
the deleted statechart/compile-time FSMs:
- Derive Machine<ResultT>; declare states as nested structs deriving
  State; each implements Coro::Task<Step> run() returning next<S>() /
  succeed(...) / fail(...).
- Async by default: a non-template Detail::ExecutionContext owns one
  ManualExecutor + worker thread + a lock-free MPSC event queue + a typed
  event mailbox; a single consumer touches all mutable state so state
  code is lock-free/single-threaded. Embedder mode (own_worker=false)
  drives via pump() for deterministic tests.
- Events: co_await await_event<E>() consumes the oldest queued E (typed
  mailbox), suspending until one arrives; post<E>(e) is lock-free from
  any thread.
- Nesting: co_await run_child<Sub>(args...) runs a child on the same
  executor (shared events/services) and yields its Outcome.
- Dynamic: add<S>() / add_if<S>(cond) register states; next<unregistered>
  fails; has_state<S>() lets states branch.
- Services: set_services(registry); state.service<I>() resolves through
  the injected context.
- Observation: current_state() is a lock-free atomic-index read of an
  immutable name table (P2996 identifier_of, fallback to indexed names).
- Persistence: serialize() captures {state name, on_serialize data};
  restore() on an un-started machine resumes at the named state.

26 new tests (Service registry; FSM basic/success/fail, events incl.
cross-thread worker + order, nesting incl. failure propagation,
serialize/restore, dynamic registration, service resolution, and a
6-producer x 5k concurrent-post stress + lock-free current_state reader
check). 960 green, ASan+UBSan clean, stable across 10 runs, -Werror clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 00:39:05 +03:00
faumarayandClaude Fable 5 04cf1998bd 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>
2026-06-14 00:26:30 +03:00
faumarayandClaude Fable 5 6b5f61f00a Logging: colors, configurable/custom pattern tokens, split + history sinks
Pattern formatting (PatternFormatter):
- Token spec grammar {token:[align][width][,color]} — align <,>,^,
  std::format-style width, color a name or "auto" (= the level's color).
- Custom tokens via register_token(name, fn); unknown {name} resolves
  against registered renderers, then Entry::fields by key, else stays
  literal — so structured fields print as {request_id:>8}.
- Color model: AnsiColor + ColorPolicy{enabled, level_colors,
  token_colors} (ColorPolicy::defaults()); only PatternFormatter
  colorizes (never file/JSON/logfmt). ConsoleLogger now renders its
  default line through a colored PatternFormatter and exposes
  set_color_policy (honors Stacktrace::Color::g_color_enabled).

Structured fields:
- Entry gains a fields vector; Logging::FieldScope (RAII, thread-local)
  attaches key/values to every entry on the thread, snapshotted like
  scopes. JsonLines/logfmt include them.

New file sinks (async by default):
- Detail::RollingFile factors size+max-files rotation; RotatingFileLogger
  now delegates to it.
- SplitFileLogger: per-level files (<dir>/<level>.log) plus an optional
  combined <dir>/all.log.
- HistoryLogger: always-on, never-level-filtered durable JSON-lines
  audit trail over a rolling file.
- from_config gains split/history sinks and a log.color toggle.

22 new tests (pattern width/align/custom-token/field, color on/off + name
parsing, FieldScope nesting, split routing + combined, history JSON +
rotation, from_config split/history). 987 green; module build clean
under -Werror.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 00:24:31 +03:00
faumarayandClaude Fable 5 c988f635e9 Integrate FSM with Plugin: states/actions from plugins, hot reload
Fsm/PluginBehavior.hpp: IFsmBehaviorPack::register_into(Builder&) lets a
plugin contribute states/events/guards/actions; plugins export it via
extern "C" void_plugin_fsm_behaviors(). build_machine_def(pack) runs the
pack through a Builder and validates.

PluginManager::raw_symbol(name, symbol) resolves an optional extra entry
point from a plugin's current .so (returns nullptr if absent), so the
host can fetch the behaviour factory without widening the frozen IPlugin
vtable.

Integration flow (tests/internal/FsmPluginHotReload.cpp): build a machine
def from the plugin pack, run it; on reload, rebuild from the reloaded
pack and swap_definition between RTC steps. Same state names across
versions ⇒ the live configuration is adopted seamlessly (machine keeps
running, queue intact); v2's new "skip" transition goes live. Safety:
plugin actions are std::functions whose code lives in the .so, so a
PluginHandle is pinned for the machine's lifetime and dlclose_on_swap=
false keeps the code pages mapped under in-flight frames.

Tests: FsmPluginV1/V2 (same idle/busy/done states; v2 adds skip).
Definition-swap test proves configuration survival + new behaviour; the
stress test runs 4 producer threads posting while 5 v1<->v2 rebuild+swaps
happen concurrently, then asserts exactly one active leaf. 967 tests
green, stable across runs, ASan+UBSan clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 18:13:03 +03:00
faumarayandClaude Fable 5 b343bce396 Add Plugin hot-plug: PluginManager, versioned state ABI, file watching
Backward-compatible C ABI v2 (Plugin.hpp; ABI_VERSION unchanged, IPlugin
vtable frozen): optional void_plugin_state_version / serialize_state /
free_string / deserialize_state(inst, json, from_version). State transfer
prefers serialize->deserialize (survives layout changes; migrations live
in the new .so via Json::MigrationChain), falling back to the existing
transfer_state, then no-op. PluginLoader::reload gains this chain; the
shared transfer_plugin_state helper drives it. Existing ABI-v1 plugins
(TestPlugin) load and reload unchanged.

PluginManager (Manager.hpp/.cpp): multi-plugin registry with RCU-style
pinned handles. acquire(name) is one atomic<shared_ptr> load returning a
PluginHandle that keeps its instance alive for the whole call. reload()
is transactional: build new instance, transfer state from old, then
atomic-exchange it in; on any failure the old instance stays. In-flight
handles keep the old instance and its mapped .so alive (dlclose_on_swap=
false) until they drop, so work never stops and callers never see a torn
or freed object. watch(name) auto-reloads via FileSystem::FileWatcher
(debounced); on_reloaded fires after each swap.

Reload-safety: dlopen of a fresh-inode hotswap copy is required to load
new bytes; deployments must install the new .so by atomic rename, never
in-place overwrite of the mapped file (corrupts the running mapping ->
SIGBUS). Documented; tests install via copy-to-.incoming + rename.

Tests: StatefulPluginV1/V2 (shared IStateful interface, atomic counter;
v2 adds a field and migrates v1 JSON). Manager.cpp covers load/acquire,
v1->v2 migration, pinned-handle-survives-reload, legacy transfer_state
fallback, and watch auto-reload. HotReloadUnderLoad.cpp: 6 reader threads
calling through acquire() while 24 v1<->v2 reloads run concurrently --
zero crashes, state survives every migration, ASan+UBSan clean, stable
across 10+ runs.

965 tests green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 18:08:06 +03:00
faumarayandClaude Fable 5 697e07843c Add Void::Fsm - runtime hierarchical FSM with lock-free MPSC core
Definition (Builder -> immutable shared MachineDef):
- Named hierarchical states, events by name or enum identifier (P2996),
  states_from_enum, initial/parallel composites, shallow/deep history,
  deferred events, per-state timeouts, guards, entry/exit/transition
  actions (coroutine Task<void> or sync, wrapped), internal transitions.
- build() validates (initial children, transition endpoints) and
  flattens into index-addressed vectors with depth info for LCA.

Machine (one consumer, many producers):
- post() is lock-free from any thread: Vyukov MPSC push + counting-
  semaphore park/wake; the single consumer (owned worker, or embedder
  via run_pending) owns all mutable machine state with zero locks.
- Observation via seqlock over a trivially-copyable StateSnapshot of
  active leaves; readers retry, writer is wait-free, no heap.
- Run-to-completion: innermost-first transition resolution per region,
  LCA-based exit/entry ordering, history snapshotted at exit time,
  deferred events re-injected FIFO after each state change, timers via
  deadline park (generation counters kill stale fires), orthogonal
  regions dispatched independently on the single consumer.
- co_await machine.send(ev) / send_wait() resolve with SendResult after
  the step; actions are driven to completion on the consumer's
  ManualExecutor before the step ends.
- swap_definition: atomic<shared_ptr> definition swap between steps;
  identical active-leaf names adopt seamlessly (no entry re-runs, queue
  intact), otherwise initial configuration; history remapped by name.
- serialize_state()/restore_state(): JSON by state *names* for
  hot-reload and persistence; restore re-activates silently.
- start() returns only once the initial configuration is entered.

40 new tests: semantics (ordering, guards, internal/self transitions),
hierarchy + both history kinds, defer FIFO, parallel regions, timers,
coroutine actions, awaitable/blocking send, serialize/restore round
trips, seamless + fallback hot swap, and stress: 8 producers x 10k with
per-producer FIFO assertion, 4-reader seqlock tear check, 50 definition
swaps under sustained load. Green under ASan+UBSan, stable across
repeated runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 00:49:45 +03:00
faumarayandClaude Fable 5 c74a02a5a5 Overhaul Logging and Configuration; integrate the log facade library-wide
Void::Log facade (header-only, macro-free):
- Leveled function templates trace/debug/info/warn/error/fatal(module,
  fmt, args...) with lazy formatting - a disabled call is one relaxed
  atomic load, no allocation, no formatting.
- Global min level + per-module overrides (can raise or lower); empty
  sink/Disabled level = logging fully off; set_sink remains the splice
  point for external logging libraries.

Void::Logging::Logger - async by default, one class for both modes:
- Mode::Async (default): lock-free MPSC queue + logger-owned worker
  delivering batches via on_flush outside any lock; Immediate/Buffered
  give synchronous behavior via constructor arg or set_mode at runtime.
- Bounded queue with OverflowPolicy{Block, DropNewest, DropOldest};
  flush() (now virtual) blocks until everything submitted is delivered;
  base destructor only stops/joins the worker, never touches virtuals.
- Fixed a wakeup race: stale park token + fresh release overflowed the
  binary semaphore; wakeup is a counting semaphore (spurious wakes are
  absorbed by the worker loop).

New sinks and formatters:
- RotatingFileLogger (size-based rotation, max-files cap), NullLogger,
  CallbackLogger, MultiLogger (tee via new Logger::relay), SyslogLogger.
- Formatter interface: PatternFormatter ({time}/{level}/{scopes}/...),
  JsonLinesFormatter, LogfmtFormatter; installable on Console/File/
  Rotating sinks. Console/File sinks now default to Async.
- Logging::from_config builds the whole sink tree from Config keys;
  apply_facade_config drives facade levels.

Configuration:
- Typed get_as<T>/get_or_as<T> (numbers, bool spellings, enums by name,
  chrono durations), dotted keys, subtree(), sorted keys().
- New sources: from_env_prefix (APP_LOG__LEVEL -> log.level), from_ini
  (sections as prefixes), from_json (objects/arrays flattened),
  from_args (--key=value / --key value / --flag).
- Bind.hpp: reflection bind<T>(cfg, prefix) fills aggregates; defaults
  in the struct are the schema; nested aggregates, optional, vector.
- Watch.hpp: ConfigWatch reloads on change with per-key diff; parse
  failures keep the previous config.

System: new FileSystem::FileWatcher - debounced polling watcher (stable
mtime+size across N polls), callbacks off-thread, deletion events;
shared groundwork for plugin hot-reload.

Sweep: all internal Void::Log::log call sites migrated to the leveled
API ("Umbrella.Feature" labels); Plugin loader now logs load/reload.

918 tests green (28 new), stable across 30 consecutive runs, ASan+UBSan
clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 00:11:13 +03:00
faumarayandClaude Fable 5 8a6065539a Add Async lock-free infrastructure and reflection JSON serializer
Async (Void::Async):
- MpscQueue<T>: unbounded Vyukov multi-producer/single-consumer queue.
  Wait-free push (XCHG + store, no CAS loop); consumer-owned reclamation so
  no hazard pointers and no ABA. The transient mid-link empty window is
  documented; try_pop/empty are re-poll hints.
- Executor/ManualExecutor: minimal scheduling bridge for Coro::Task with
  lock-free post() from any thread and single-thread run_one()/drain();
  schedule_on() awaitable and spawn() for detached task launch with a
  self-destroying wrapper frame.

Data (Void::Json):
- Reflect.hpp: P2996 to_json/from_json for aggregate structs (field-name
  keys; arithmetic/bool/string/enum-by-name/vector/optional/string-map/
  nested aggregates), tolerant deserialization (unknown fields ignored,
  missing fields keep defaults, mismatches report dotted field paths).
- Versioned envelopes {"__version", "data"} with StateTraits<T> and
  MigrationChain for stepwise schema upgrades - groundwork for plugin
  hot-reload state transfer.
- Member to_json/from_json customization wins over reflection and is the
  only path on compilers without <meta> (Reflectable is false there).

Verified with GCC 16.1 (-freflection): 25 new tests including an
8-producer x 100k MPSC stress with per-producer FIFO assertion, coroutine
frame lifetime checks, and a 3-step v1->v3 migration; suite green under
ASan+UBSan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 18:57:15 +03:00
faumarayandClaude Fable 5 28b94883fd Restructure into umbrella modules (~55 -> 16 targets)
Headers move, CMake targets merge, C++ namespaces stay unchanged:
- Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant
- Functional: Pipeline, Either, Result, Retry
- Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval
- Math: +Matrix, Numeric, Random, Histogram
- Text: Str, Format, Tokenizer, Diff, Encoding, Semver
- Data: Json, Csv, Ini
- Async: Coro, Concurrency, EventBus, Observable
- Time: +Bench
- Log: Log facade + Logging framework (facade now header-only, breaking
  the Stacktrace<->Log link cycle the merge would have created)
- System: FileSystem + Process
- Configuration: +Argparse
- Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail

Module system fixes:
- OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no
  longer depends on the alphabetical discovery order of src/ subdirs
  (Testing -> Text would have been silently dropped).
- Every header-only module now has a tracked module.cmake; previously the
  empty src/<Name> marker dirs were untracked, so a fresh clone would have
  silently skipped those modules.
- VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT.

Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files
prefixed: ResultBasic etc.). Test count verified identical (831) before and
after. README/CLAUDE.md module tables updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 18:50:02 +03:00
faumarayandClaude Fable 5 da2e93c405 Finish module consolidation: fold Memo into Pipeline, dedupe Channel/Stopwatch
Completes the in-progress merges (Optional->Either/Opt, Curry+Memo->Pipeline,
ScopeGuard->Scope, String->Str):
- Pipeline/Memo.hpp now carries the full Memo API (memoize with recursion
  support, TupleHash, SimpleCache) alongside memoize_fn; old Memo module
  and its test dir removed.
- Duplicate Channel module removed; Concurrency::Channel gains empty() and
  the unique test cases (drain-after-close, multi-producer, string payloads).
- StopWatch module merged into Time::Stopwatch: one class with explicit
  start/stop/laps plus a started() factory for the auto-start RAII style;
  ScopedTimer moved along.
- Testing optional dep retargeted String->Str (pad_right lives in Str now).
- Stale empty dirs removed: src/{ScopeGuard,String,Core}, include/Void/{Core,
  Filesystem,Memo,Channel,StopWatch}.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 18:41:24 +03:00
faumarayandClaude Sonnet 4.6 58ff7b38a0 Add 20+ new modules with tests: Pipeline, Matrix, Tokenizer, ScopeGuard, Bitset, Optional, Counted, Curry, TypeMap, Bench, DisjointSet, Histogram, StopWatch, and more
Also fixes Diff/Memo/PriorityQueue from previous session: LineDiff is now
an alias for Edit<string> so count_op/apply work on line diffs; Memoized
uses std::apply instead of type-based get to handle duplicate arg types.

874/877 tests pass (3 are platform-gated plugin tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 23:49:09 +03:00
faumarayandClaude Sonnet 4.6 cb4dd58500 Add Ini, Csv, Semver modules
Void::Ini — IniFile parser supporting [sections], key=value pairs, ; and #
comments, quoted values, error reporting with line numbers, set/get, has_key,
sections(), serialize().

Void::Csv — RFC 4180 CSV parse/serialize with quoted fields, doubled-quote
escaping, custom delimiter, CRLF support; CsvWithHeader for named column access.

Void::Semver — Version struct with major/minor/patch/pre-release/build; parse()
(accepts optional v-prefix); to_string(); spaceship comparison per semver spec
(release > pre-release, build metadata ignored); compatible_with(), is_stable(),
bumped_major/minor/patch().

47/47 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 23:02:29 +03:00
faumarayandClaude Sonnet 4.6 b54f2156c5 Add Numeric and Format modules
Void::Numeric — checked_add/sub/mul/div returning std::expected<T,Error>;
saturating_add/sub/mul clamping at min/max; wrapping_add/sub/mul for unsigned;
clamp, parse_int (with base), parse_double, narrow_cast.

Void::Format — render() named-placeholder template engine ({key} syntax,
{{}} escaping); render_pos() positional ({0},{1}); indent() per-line prefix;
word_wrap() at whitespace boundaries; format_table() with auto column alignment.

44/44 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 22:59:55 +03:00
faumarayandClaude Sonnet 4.6 3c3ff46e39 Add Graph, Trie, LRU modules
Void::Graph — DiGraph<V,E> directed adjacency-list graph: add_vertex/add_edge,
has_vertex/has_edge, BFS/DFS traversal, topological sort (Kahn, returns nullopt
on cycle), can_reach, shortest_path (BFS, unweighted).

Void::Trie — Prefix tree Trie<V>: insert, contains, get, starts_with, erase
(with node pruning), keys_with_prefix, size/empty.

Void::LRU — LruCache<K,V>: get (promotes to MRU), put (evicts LRU when full),
peek (no promotion), erase, clear, contains, full/empty/size.

42/42 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 22:57:53 +03:00
faumarayandClaude Sonnet 4.6 388e75011f Add Observable, Pool, Ring modules
Void::Observable — Observable<T> reactive value with typed on_change listeners
and unsubscribe-by-handle; Signal<Args...> event broadcast with connect/disconnect.

Void::Pool — ObjectPool<T,ChunkSize> slab-based pool with unique_ptr<T,Deleter>
ownership; FixedPool<T,N> fixed-capacity in-place pool, returns nullptr when full.

Void::Ring — SpscRing<T,N> single-producer/single-consumer wait-free ring buffer;
MpscRing<T,N> multi-producer/single-consumer ring using CAS on the head pointer.
Both tested under real threads.

39/39 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 22:54:35 +03:00
faumarayandClaude Sonnet 4.6 a9a2e2b59a Add Scope, StateMachine, TypeList modules; remove macros from Scope
Void::Scope — RAII scope guards: ScopeExit/ScopeSuccess/ScopeFail with
on_exit/on_success/on_fail factory functions. No macros.

Void::StateMachine — compile-time FSM driven by Transition<From,Ev,To>
type lists. Supports typed entry/exit callbacks and returns bool from send()
indicating whether the transition was valid.

Void::TypeList — compile-time type list with: size_of, at, front, back,
contains, index_of, push_front/back, pop_front, concat, filter, transform,
reverse, unique, for_each, all_of/any_of/none_of.

Void::Encoding — Base64 (standard + URL-safe encode/decode) and Hex
encode/decode. Included in previous commit but missed in message.

36/36 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 22:49:22 +03:00
faumarayandClaude Sonnet 4.6 a09e000f0f Add Hash, Random, Uuid, Encoding, Bits, Math modules + make Testing deps optional
New header-only modules:
- Void::Hash — FNV-1a 32/64, CRC-32, DJB2, MurmurHash3-32, UDL literals
- Void::Random — Xoshiro256** PRNG, uniform_int/real, coin_flip, shuffle, random_string
- Void::Uuid — v4 (random), v5_lite (name-based), parse, RFC 4122 namespaces
- Void::Encoding — Base64 (standard + URL-safe), Hex encode/decode
- Void::Bits — popcount, bit extract/deposit, rotation, align, byteswap, masks
- Void::Math — Vec2/Vec3/Vec4, Mat4 (identity, translation, scale, rotation)

Testing module: move Stacktrace from INTERNAL_DEPS to OPTIONAL_DEPS. Added
Detail/Color.hpp shim that delegates to Stacktrace::Color when present or
provides inline ANSI fallback otherwise. All Stacktrace calls in SignalHandler,
ConsoleReporter, and Runner are gated on VOID_HAS_STACKTRACE.

Fix Repr.hpp reflect_struct to handle template specializations that lack
std::meta::identifier_of (now guarded by has_identifier check).

33/33 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 21:52:22 +03:00
faumaray 42268c6c35 Reflection and filesystem
Signed-off-by: faumaray <faumaray@gmail.com>
2026-05-03 18:09:46 +03:00
faumaray e7186f17f0 Testing module
Signed-off-by: faumaray <faumaray@gmail.com>
2026-04-29 22:49:33 +03:00
faumarayandClaude Sonnet 4.6 4fc129fb7e Initial commit: VoidLibrary C++23 modular library
Adds Logging module with thread-safe Logger base class, ScopedContext
RAII guards, Preset helpers, and a FileLogger standalone test/example.
Includes CMake module system for auto-discovery and CTest integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 21:28:29 +03:00