From 710a9c183375865a24ba8fbdf69ded7de2ffa4d6 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 24 Nov 2026 03:33:45 +0300 Subject: [PATCH] docs(workflow): add Wave 4A (P1 Algorithms, Unicode, Async) task specs --- docs/agent-workflow/tasks/M-ASYNC-02-03.md | 38 ++++++++++++++++++++ docs/agent-workflow/tasks/S-ALGORITHMS-02.md | 38 ++++++++++++++++++++ docs/agent-workflow/tasks/S-UNICODE-01-02.md | 38 ++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 docs/agent-workflow/tasks/M-ASYNC-02-03.md create mode 100644 docs/agent-workflow/tasks/S-ALGORITHMS-02.md create mode 100644 docs/agent-workflow/tasks/S-UNICODE-01-02.md diff --git a/docs/agent-workflow/tasks/M-ASYNC-02-03.md b/docs/agent-workflow/tasks/M-ASYNC-02-03.md new file mode 100644 index 0000000..47f481f --- /dev/null +++ b/docs/agent-workflow/tasks/M-ASYNC-02-03.md @@ -0,0 +1,38 @@ +# Async OperationState, ResumeTicket, TaskScope, and Bounded Executor Lanes +Task ID: M-ASYNC-02, M-ASYNC-03 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-04, C-06, C-07 + +## 1. Context and baseline +`src/Async/module.cmake` currently depends only on `LogState`, while `include/Void/Async/Executor.hpp` provides only void-returning `post()`, `ManualExecutor`, `schedule_on`, and fire-and-forget `spawn()`. Async lacks structured admission control, race-free backend completion vs cancellation settlement, completion-lane backpressure bypass, and structured `TaskScope` join/cancellation/exception ownership. + +## 2. Deliverables +- Updated `src/Async/module.cmake` declaring `INTERNAL_DEPS Functional Time LogState`. +- New `include/Void/Async/Operation.hpp`: `OperationOptions`, `AdmissionError`, `AsyncErrorCode` (`kAsyncErrorDomain`), `make_async_error`, `DomainOutcomeKind`, `ResumeTicket`, and `OperationState` managing combined `std::stop_source`, atomic `backend_refs`, single-winner CAS terminal state, and post-backend-release continuation resumption outside locks. +- Upgraded `include/Void/Async/Executor.hpp`: keeps 1.x `post`/`ManualExecutor`/`schedule_on`/`spawn` working while adding `try_post`, `post_completion` (reserved completion lane), `is_executor_thread()`, bounded `ManualExecutor` queue capacity, and cancellable clock-aware `schedule_on(executor, options, clock)`. +- New `include/Void/Async/TaskScope.hpp`: `TaskScopeOptions`, `JoinHandle`, reserve-then-transfer `TaskScope::spawn` (preserving `Task` on admission failure), `request_stop`, `co_await join()`, `join_blocking()` with `self_join` detection, `join_pumping`, and `DetachedOwner`. +- Tests in `tests/standalone/Async/OperationScope.cpp`. + +## 3. Exact files and interfaces +- `src/Async/module.cmake` +- `include/Void/Async/Operation.hpp` +- `include/Void/Async/Executor.hpp` +- `include/Void/Async/TaskScope.hpp` +- `tests/standalone/Async/OperationScope.cpp` + +## 4. Edge cases +- Failed `TaskScope::spawn` (full or stopped) does not consume or destroy caller's `Coro::Task`. +- Concurrent backend commit vs `std::stop_token` firing resolves to exactly one terminal outcome, releases backend references before resuming continuation outside locks, and supports synchronous completion without double-resume. +- Reserved `post_completion` succeeds even when normal submission queue capacity is saturated. +- `join_blocking()` called from the associated executor thread detects `self_join` rather than deadlocking. +- Concurrent cancellation/completion/join stress passes cleanly under Debug TSan and ASan/UBSan. + +## 5. Acceptance criteria +- `OperationScope*`, `Executor*`, `Coro*`, and `ThreadPool*` tests pass under RelWithDebInfo `-Werror`, ASan+UBSan, and Debug TSan (`-DVOID_ENABLE_TSAN=ON`). + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4a-async -G Ninja -DVOID_ENABLED_MODULES="Async;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4a-async && /tmp/void-w4a-async/tests/VoidTests --filter "OperationScope*|Executor*|Coro*" && ctest --test-dir /tmp/void-w4a-async --output-on-failure --timeout 60' +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4a-async-tsan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DVOID_ENABLED_MODULES="Async;Testing" -DVOID_ENABLE_TSAN=ON -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4a-async-tsan && /tmp/void-w4a-async-tsan/tests/VoidTests --filter "OperationScope*|Executor*|ThreadPool*"' +``` \ No newline at end of file diff --git a/docs/agent-workflow/tasks/S-ALGORITHMS-02.md b/docs/agent-workflow/tasks/S-ALGORITHMS-02.md new file mode 100644 index 0000000..82cf4eb --- /dev/null +++ b/docs/agent-workflow/tasks/S-ALGORITHMS-02.md @@ -0,0 +1,38 @@ +# Algorithms Indexed Graph Views, Work Budgets, and Iterative Traversals/Topology +Task ID: S-ALGORITHMS-02 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-05, C-07 + +## 1. Context and baseline +VoidLibrary currently has no `Algorithms` module (`src/Algorithms/module.cmake`, `include/Void/Algorithms/`). Graph algorithms are needed as a standalone header-only module with strict dependency discipline (`INTERNAL_DEPS Core Math`), zero unbounded recursion, pre-checked scratch memory budgets, overflow-safe sizing via `Void::Numeric`, and safe cancellation / concurrent graph mutation detection. + +## 2. Deliverables +- `src/Algorithms/module.cmake` declaring `INTERNAL_DEPS Core Math`. +- New `include/Void/Algorithms/Graph.hpp` defining `Void::Algorithms::{WorkLimits, AlgorithmError, Topology, TraversalResult, ShortestPathResult, IndexedGraphView, HasVersionStamp, AdjacencyView}` and iterative `bfs`, `dfs`, `shortest_path_unweighted`, and `topological_order`. +- Comprehensive unit and edge-case tests in `tests/standalone/Algorithms/Graph.cpp`. +- Package consumer `tests/package/AlgorithmsOnly/{CMakeLists.txt,main.cpp}` registered in `tests/package/InstalledComponents.cmake` (`Algorithms Math Core`). + +## 3. Exact files and interfaces +- `src/Algorithms/module.cmake` +- `include/Void/Algorithms/Graph.hpp` +- `tests/standalone/Algorithms/Graph.cpp` +- `tests/package/AlgorithmsOnly/CMakeLists.txt` +- `tests/package/AlgorithmsOnly/main.cpp` +- `tests/package/InstalledComponents.cmake` + +## 4. Edge cases +- Out-of-range source/target vertex IDs or `vertex_count()` exceeding `WorkLimits` rejected before scratch allocations. +- Overflowing edge/vertex scratch budget calculations rejected using `Void::Numeric::checked_mul`/`checked_add`. +- Out-of-range neighbor IDs in adjacency lists diagnosed cleanly without out-of-bounds vector access. +- Deep graphs (`> 100k` vertices / chains) execute strictly iteratively with no stack overflow. +- `topological_order` uses Kahn's algorithm and, on cycle detection, runs iterative 3-color DFS to extract a deterministic cycle witness `[u0, ..., uk, u0]`. +- Periodic `std::stop_token` and `HasVersionStamp::version()` checks abort mid-traversal with `cancelled` / `concurrent_modification`. + +## 5. Acceptance criteria +- `Graph*` tests and `VoidInstalledComponentConsumers` (`AlgorithmsOnly`) pass under `-DVOID_WARNINGS_AS_ERRORS=ON` and ASan/UBSan. + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4a-alg -G Ninja -DVOID_ENABLED_MODULES="Algorithms;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4a-alg && /tmp/void-w4a-alg/tests/VoidTests --filter "Graph*" && ctest --test-dir /tmp/void-w4a-alg --output-on-failure --timeout 60' +``` \ No newline at end of file diff --git a/docs/agent-workflow/tasks/S-UNICODE-01-02.md b/docs/agent-workflow/tasks/S-UNICODE-01-02.md new file mode 100644 index 0000000..179e227 --- /dev/null +++ b/docs/agent-workflow/tasks/S-UNICODE-01-02.md @@ -0,0 +1,38 @@ +# Unicode 17.0.0 Manifest and Strict/Repair/Streaming UTF Codecs +Task ID: S-UNICODE-01, S-UNICODE-02 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-05, C-07 + +## 1. Context and baseline +VoidLibrary currently has no `Unicode` module (`src/Unicode/`). `Text` handles locale-free ASCII-only operations (`M-TEXT-02`), while UTF-8/UTF-16/UTF-32 validation, transcoding, one-unit repair, and streaming decoding must live in a dedicated `Unicode` module pinning Unicode `17.0.0` metadata and keeping `Text` independent of Unicode data. + +## 2. Deliverables +- `src/Unicode/module.cmake` declaring `INTERNAL_DEPS Core Text`. +- `src/Unicode/MANIFEST.md` pinning Unicode `17.0.0`, official UCD source URL, and Unicode license notice. +- New `include/Void/Unicode/Utf.hpp` defining `Void::Unicode::{data_version, is_scalar_value, UtfPolicy, UtfErrorKind, UtfError, Scalar, UtfLimits, TranscodeCounts}`, strict & `replace_one_unit` validation/transcoding functions for UTF-8/UTF-16/UTF-32 (owning and into-`std::span`), and stateful `Utf8StreamDecoder` / `Utf16StreamDecoder`. +- Tests in `tests/standalone/Unicode/Utf.cpp`. +- Package consumer `tests/package/UnicodeOnly/{CMakeLists.txt,main.cpp}` registered in `tests/package/InstalledComponents.cmake` (`Unicode Text Core`). + +## 3. Exact files and interfaces +- `src/Unicode/module.cmake` +- `src/Unicode/MANIFEST.md` +- `include/Void/Unicode/Utf.hpp` +- `tests/standalone/Unicode/Utf.cpp` +- `tests/package/UnicodeOnly/CMakeLists.txt` +- `tests/package/UnicodeOnly/main.cpp` +- `tests/package/InstalledComponents.cmake` + +## 4. Edge cases +- Rejects overlong UTF-8 sequences, UTF-16 surrogates (`U+D800..U+DFFF`) in UTF-8/UTF-32, unpaired surrogates in UTF-16, code points `> U+10FFFF`, and truncated sequences under `UtfPolicy::reject`. +- WHATWG-compliant maximal subpart (`replace_one_unit`) emits `U+FFFD` per ill-formed unit/maximal subpart and advances cleanly without skipping subsequent valid units. +- Pre-reserve limit checks against `UtfLimits` reject oversized inputs/outputs before large allocations; periodic `std::stop_token` checks abort long transcodes cleanly. +- Streaming `Utf8StreamDecoder` / `Utf16StreamDecoder` split sequences across arbitrary 1-byte/1-unit boundaries and flush trailing incomplete sequences cleanly at EOF. + +## 5. Acceptance criteria +- `Utf*` tests and `VoidInstalledComponentConsumers` (`UnicodeOnly`) pass under `-DVOID_WARNINGS_AS_ERRORS=ON` and ASan/UBSan. + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4a-unicode -G Ninja -DVOID_ENABLED_MODULES="Unicode;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4a-unicode && /tmp/void-w4a-unicode/tests/VoidTests --filter "Utf*" && ctest --test-dir /tmp/void-w4a-unicode --output-on-failure --timeout 60' +``` \ No newline at end of file