Void::Log::Detail::state() was a static in an inline function, which is
one object per DLL on Windows: a sink set from one DLL never saw events
from another (a plugin's log lines, or any module but the one that set
it). The state now lives in Void::LogState, a small compiled module with
no dependencies, linked by every module that includes the facade
(Async, System, Stacktrace, Testing; the rest through them), so
INTERFACE modules can still log and no dependency cycle appears.
Tests: VoidTests 1242 pass, 3 skip; run_with_args_builds_correct_argv
and run_stdin_forwarded_to_cat fail on NixOS, which has no
/bin/echo or /bin/cat (exit 127).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VOID_ENABLED_MODULES (cache, empty for all) configures only the named
modules and their INTERNAL_DEPS, followed transitively; OPTIONAL_DEPS
are used when named too. A project embedding Void configures what it
links, so the packages of modules it never builds (LibArchive, OpenSSL,
SQLite, libsodium) need not exist, as in a mingw-w64 cross build.
Testing's crash handlers use the C runtime's signal() on Windows, which
has no sigaction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
include/Void/Detail/Enum.hpp is included by public headers of Core
(Meta.hpp), Log (Level.hpp, LoggingAdapter.hpp), Configuration
(Config.hpp) and Data (Reflect.hpp), but belongs to no module's
FILE_SET, so `cmake --install` never copied it and every consumer of
an installed VoidLibrary failed to compile those headers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
- 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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>