From 9918ed476090b7d771dcc9b9456cc2ac150b0855 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 24 Nov 2026 03:57:29 +0300 Subject: [PATCH] docs(workflow): add Wave 4B (P1 IO, Runtime, Testing) task specs --- docs/agent-workflow/tasks/M-TESTING-02-03.md | 38 ++++++++++++++++++++ docs/agent-workflow/tasks/S-IO-01-02.md | 37 +++++++++++++++++++ docs/agent-workflow/tasks/S-RUNTIME-01.md | 35 ++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 docs/agent-workflow/tasks/M-TESTING-02-03.md create mode 100644 docs/agent-workflow/tasks/S-IO-01-02.md create mode 100644 docs/agent-workflow/tasks/S-RUNTIME-01.md diff --git a/docs/agent-workflow/tasks/M-TESTING-02-03.md b/docs/agent-workflow/tasks/M-TESTING-02-03.md new file mode 100644 index 0000000..6cb2636 --- /dev/null +++ b/docs/agent-workflow/tasks/M-TESTING-02-03.md @@ -0,0 +1,38 @@ +# Testing Per-Run Reporters, Subprocess Isolation, and Deterministic Harness +Task ID: M-TESTING-02, M-TESTING-03 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-04, C-16 + +## 1. Context and baseline +`Testing` (`Runner.cpp`, `Assert.cpp`, `Config.hpp`, `JUnitReporter.cpp`) currently uses a process-global static `std::ofstream` for JUnit reporting, silently turns malformed regex or empty explicit filter selections into passing 0-test runs, retains unbounded per-test assertions, and lacks owned `FailureCapture`, isolated subprocess test execution, versioned deterministic property shrinking, and clock/order-controlled `DeterministicRun`. + +## 2. Deliverables +- Updated `include/Void/Testing/{Config,Assert,Runner}.hpp` and `src/Testing/{Assert,Runner}.cpp`: + - Per-run owned JUnit stream checking open/write health cleanly. + - Strict CLI/config validation (invalid regex, unknown reporter, unopenable output path, empty selection without `--allow-empty` fail with exit code 2). + - Bounded per-test assertion retention (`1000` assertions / `1 MiB` diagnostics) and stray-assertion counter. + - Single-teardown fixture lifecycle recording teardown errors in `cleanup_error` without masking primary test failure. + - `--selftest-child ` fixtures inside `Runner::main`. +- New `include/Void/Testing/Capture.hpp` (`FailureCapture`) and `include/Void/Testing/{Subprocess.hpp}` + `src/Testing/Subprocess.cpp` (`current_executable_path`, `run_isolated_subprocess`, `ProcessTestOptions`, `ProcessOutcome`, `ProcessTestResult`). +- New `include/Void/Testing/Deterministic.hpp` (`ReplayToken`, version-1 rejection-mapped `DeterministicRng`, `check_property` with shrinking & budget-exhaustion `inconclusive`, and `DeterministicRun` schedule/clock/timer harness). +- Tests in `tests/standalone/Testing/{FrameworkHardening,Deterministic}.cpp`. + +## 3. Exact files and interfaces +- `include/Void/Testing/{Config,Assert,Runner,Capture,Subprocess,Deterministic}.hpp` +- `src/Testing/{Assert,Runner,Subprocess}.cpp` +- `tests/standalone/Testing/{FrameworkHardening,Deterministic}.cpp` + +## 4. Edge cases +- Child process `flood` saturating stdout and stderr concurrently drains via non-blocking `poll` with bounded truncation without pipe deadlock. +- Child process `hang` beyond `ProcessTestOptions::timeout` terminates via `SIGKILL` and reports `ProcessOutcome::timed_out`. +- Child process `abort` reports `ProcessOutcome::crashed` (`SIGABRT`) safely even under ASan/UBSan. +- Property shrinking preserves counterexample failure category and reports `inconclusive` on step, time, or discard exhaustion. + +## 5. Acceptance criteria +- `FrameworkHardening*|Deterministic*|Math*|ContainerFixture*|StructRepr*` and full 1,345+ `VoidTests` pass under RelWithDebInfo `-Werror` and ASan+UBSan. + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4b-testing -G Ninja -DVOID_ENABLED_MODULES="Core;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4b-testing && /tmp/void-w4b-testing/tests/VoidTests --filter "FrameworkHardening*|Deterministic*|Math*|ContainerFixture*|StructRepr*" && ctest --test-dir /tmp/void-w4b-testing --output-on-failure --timeout 60' +``` \ No newline at end of file diff --git a/docs/agent-workflow/tasks/S-IO-01-02.md b/docs/agent-workflow/tasks/S-IO-01-02.md new file mode 100644 index 0000000..843a55b --- /dev/null +++ b/docs/agent-workflow/tasks/S-IO-01-02.md @@ -0,0 +1,37 @@ +# IO Portable Driver, BufferLease, Mock Backend, and Linux Epoll Driver +Task ID: S-IO-01, S-IO-02 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-02, C-03, C-04, C-06 + +## 1. Context and baseline +VoidLibrary currently has no `IO` module (`src/IO/`, `include/Void/IO/`). Now that `Async` (`M-ASYNC-02`, `M-ASYNC-03`) and `Time` (`M-TIME-02`) are in place, `IO` can expose a dependency-minimal native descriptor/stream layer (`INTERNAL_DEPS Core Functional Time Memory Async`) with zero dependency on `Net`, `Runtime`, `System`, or `Log`. + +## 2. Deliverables +- `src/IO/module.cmake` (`INTERNAL_DEPS Core Functional Time Memory Async`). +- `include/Void/IO/Types.hpp`: `IoErrorCode` (`kIoErrorDomain = 8`), `make_io_error`, `Transfer`, `ComposedTransferError`, `IoLimits`, `BackendPreference`, `BackendOptions`, `DescriptorId`, `DriverTelemetry`, and PMR/quota-tracked `BufferLease`. +- `include/Void/IO/Driver.hpp`, `include/Void/IO/Stream.hpp`, `src/IO/EpollDriver.cpp`: + - `Driver` (`create`, `allocate_buffer`, `create_mock_stream`, `mock_controller`, `adopt_fd`, `create_socket_pair`, `poll_once`, `wake`, `request_stop`, `shutdown_and_join`, `telemetry`, `active_backend`). + - `ByteStream` (`read_some`, `write_some`, `read_some_owned`, `write_some_owned`, `close_and_join`) plus composed `read_exact` / `write_all`. + - Portable `MockBackend` for deterministic concurrency/stop-race verification and Linux level-triggered `EpollBackend` (no `EPOLLET`, `eventfd` wakeups, `(slot, generation)` tokens). +- `tests/standalone/IO/IoDriver.cpp` and installed package consumer `tests/package/IOOnly/{CMakeLists.txt,main.cpp}` registered in `tests/package/InstalledComponents.cmake`. + +## 3. Exact files and interfaces +- `src/IO/module.cmake`, `src/IO/EpollDriver.cpp` +- `include/Void/IO/{Types,Driver,Stream}.hpp` +- `tests/standalone/IO/IoDriver.cpp` +- `tests/package/IOOnly/{CMakeLists.txt,main.cpp}`, `tests/package/InstalledComponents.cmake` + +## 4. Edge cases +- Zero-length `read_some`/`write_some` succeeds immediately (`Transfer{0, false}`) without probing EOF. +- Same-direction overlapping operation on a stream rejects with `IoErrorCode::busy`; simultaneous `read_some` + `write_some` succeeds. +- Pre-stopped options or expired injected `MonotonicClock` deadline rejected before backend submission; active ops never resume continuations while backend holds `backend_refs` or borrowed buffers. +- Linux epoll level-triggered handling handles `EAGAIN`/`EINTR`/short transfers, drains buffered data before `EOF`/`HUP`, ignores stale `(slot, generation)` events after fd reuse, and keeps `EPOLLOUT` disabled when no write is pending. + +## 5. Acceptance criteria +- `Io*` tests and `VoidInstalledComponentConsumers` (`IOOnly`) pass under `-DVOID_WARNINGS_AS_ERRORS=ON`, ASan+UBSan, and Debug TSan (`-DVOID_ENABLE_TSAN=ON`). + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4b-io -G Ninja -DVOID_ENABLED_MODULES="IO;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4b-io && /tmp/void-w4b-io/tests/VoidTests --filter "Io*" && ctest --test-dir /tmp/void-w4b-io --output-on-failure --timeout 60' +``` \ No newline at end of file diff --git a/docs/agent-workflow/tasks/S-RUNTIME-01.md b/docs/agent-workflow/tasks/S-RUNTIME-01.md new file mode 100644 index 0000000..b33feea --- /dev/null +++ b/docs/agent-workflow/tasks/S-RUNTIME-01.md @@ -0,0 +1,35 @@ +# Runtime Inert Host, Validated Limits, EmbeddedResources, and ResourceGraph +Task ID: S-RUNTIME-01 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-04, C-05, C-09 + +## 1. Context and baseline +VoidLibrary currently has no `Runtime` module (`src/Runtime/`, `include/Void/Runtime/`). P1 establishes the inert managed composition contracts on top of `Core`, `Functional`, `Time`, `Memory`, `Algorithms`, `Async`, and `IO` without implicitly starting worker threads or depending on `System`, `Net`, `Service`, or `Log`. + +## 2. Deliverables +- `src/Runtime/module.cmake` (`INTERNAL_DEPS Core Functional Time Memory Algorithms Async IO`). +- `include/Void/Runtime/Options.hpp`: `kRuntimeErrorDomain = 11`, `RuntimeLimits`, `ShutdownPolicy`, `Options`, `validate_options`. +- `include/Void/Runtime/ResourceGraph.hpp`: `ResourceOwnership`, `ResourceKind`, `ResourceNode`, `LifecyclePlan`, and `ResourceGraph` (`add_node`, `add_dependency`, `validate_and_plan` via `Void::Algorithms::topological_order`). +- `include/Void/Runtime/Host.hpp`: `HostState`, `EmbeddedResources`, `ShutdownReport`, inert `Host` (`create`, `create_embedded`), and `HostBuilder`. +- `tests/standalone/Runtime/RuntimeHost.cpp` and installed consumer `tests/package/RuntimeOnly/{CMakeLists.txt,main.cpp}` registered in `tests/package/InstalledComponents.cmake`. + +## 3. Exact files and interfaces +- `src/Runtime/module.cmake` +- `include/Void/Runtime/{Options,ResourceGraph,Host}.hpp` +- `tests/standalone/Runtime/RuntimeHost.cpp` +- `tests/package/RuntimeOnly/{CMakeLists.txt,main.cpp}`, `tests/package/InstalledComponents.cmake` + +## 4. Edge cases +- `Host::create()` starts zero worker threads and opens zero OS descriptors (`HostState::constructed`). +- Zero worker counts in non-embedded mode, zero limits, `drain_grace > total_timeout`, and submodule `IO::BackendOptions::limits` exceeding global `RuntimeLimits` reject before construction. +- `EmbeddedResources::validate()` rejects null required ports (`executor`, `io`, `clock`). +- `ResourceGraph::validate_and_plan()` catches duplicate node IDs, missing required dependencies, and dependency cycles (preserving cycle witness) while producing deterministic startup order and exact reverse shutdown order. + +## 5. Acceptance criteria +- `Runtime*` tests and `VoidInstalledComponentConsumers` (`RuntimeOnly`) 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-w4b-runtime -G Ninja -DVOID_ENABLED_MODULES="Runtime;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4b-runtime && /tmp/void-w4b-runtime/tests/VoidTests --filter "Runtime*" && ctest --test-dir /tmp/void-w4b-runtime --output-on-failure --timeout 60' +``` \ No newline at end of file