Commit Graph
2 Commits
Author SHA1 Message Date
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 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