diff --git a/docs/agent-workflow/tasks/M-BINARY-02-03.md b/docs/agent-workflow/tasks/M-BINARY-02-03.md new file mode 100644 index 0000000..3f3f465 --- /dev/null +++ b/docs/agent-workflow/tasks/M-BINARY-02-03.md @@ -0,0 +1,35 @@ +# Binary Writer, Owning ByteBuffer, DecodeBudget, and Endian Codecs +Task ID: M-BINARY-02, M-BINARY-03 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-02, C-04, C-07 + +## 1. Context and baseline +`include/Void/Binary/Reader.hpp` provides non-owning bounds-checked reading with native-endian defaults, while Binary lacks `Writer`, `ByteBuffer`, cumulative decode budgets, transaction/rollback helpers, strict bool/IEEE float codecs, and `kBinaryErrorDomain` codes. + +## 2. Deliverables +- `src/Binary/module.cmake` updated to `INTERNAL_DEPS Functional Memory`; `tests/package/InstalledComponents.cmake` updated to pass `Memory Core` for `Binary`/`Foundation` component checks. +- New `include/Void/Binary/Budget.hpp`: `BinaryErrorCode`, `make_error`, `DecodeLimits`, `DecodeBudget` (overflow-safe cumulative field bytes and RAII `DepthGuard`). +- Extended `include/Void/Binary/Reader.hpp`: `kBinaryErrorDomain` codes, pre-consume endian check, `readLittle`/`readBig`, strict `readBool`, explicit `readF32`/`readF64` (IEEE binary32/64, no default endian), `checkpoint`/`rollback`/`Transaction`, `readBytesChecked`/`subreaderChecked`. +- New `include/Void/Binary/Writer.hpp`: non-owning mutable `Writer` with pre-write capacity checks, overlapping `memmove`-safe `writeBytes`, explicit-endian `write`/`writeLittle`/`writeBig`/`writeBool`/`writeF32`/`writeF64`/`writeString`, and `checkpoint`/`rollbackPosition`. +- New `include/Void/Binary/ByteBuffer.hpp`: PMR-backed bounded `ByteBuffer` (`max_bytes`, `0` ceiling for empty-only, self-aliasing `append`, `std::bad_alloc` -> `allocation_failed`, preserves committed bytes on failure) and zero-copy `FrozenBytes` via `freeze()`. +- Tests in `tests/standalone/Binary/{Reader,Writer,ByteBuffer}.cpp` and expanded `tests/package/Binary/main.cpp`. + +## 3. Exact files and interfaces +- `src/Binary/module.cmake`, `tests/package/InstalledComponents.cmake`, `tests/package/Binary/main.cpp` +- `include/Void/Binary/{Budget,Reader,Writer,ByteBuffer}.hpp` +- `tests/standalone/Binary/{Reader,Writer,ByteBuffer}.cpp` + +## 4. Edge cases +- Truncated or unsupported-endian operations leave cursor position and destination buffer untouched. +- `readBool` accepts only `0x00`/`0x01` without consuming invalid bytes; IEEE float width/IEC-559 checked via `static_assert`. +- Shared cumulative `DecodeBudget` enforces total bytes and depth across nested `subreaderChecked`. +- `ByteBuffer` with `BudgetResource` preserves previously written data on ceiling or OOM failure; `freeze()` preserves underlying pointer with zero copy. + +## 5. Acceptance criteria +- `Reader*`, `Writer*`, `ByteBuffer*`, and `VoidInstalledComponentConsumers` pass under `-DVOID_WARNINGS_AS_ERRORS=ON`. + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-p1-binary -G Ninja -DVOID_ENABLED_MODULES="Binary;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-p1-binary && /tmp/void-p1-binary/tests/VoidTests --filter "Reader*|Writer*|ByteBuffer*" && ctest --test-dir /tmp/void-p1-binary --output-on-failure --timeout 60' +``` diff --git a/docs/agent-workflow/tasks/M-CONTAINERS-02-03.md b/docs/agent-workflow/tasks/M-CONTAINERS-02-03.md new file mode 100644 index 0000000..8b6a4f6 --- /dev/null +++ b/docs/agent-workflow/tasks/M-CONTAINERS-02-03.md @@ -0,0 +1,37 @@ +# Containers Pool Lease Lifetimes, Budgets, and Non-Spinning Rings +Task ID: M-CONTAINERS-02, M-CONTAINERS-03 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-04, C-05 + +## 1. Context and baseline +`include/Void/Containers/Pool.hpp` (`ObjectPool`, `FixedPool`) and `BufferPool.hpp` currently hold raw pool pointers in returned leases/deleters, leak slots on throwing construction, allocate heap nodes on buffer recycle, and lack admission/byte ceilings. `include/Void/Containers/Ring.hpp` currently spins indefinitely in `MpscRing::pop()` while waiting for `ready_[tail]` and lacks destruction of queued items on ring drop and explicit `close()`/`try_pop()` polling states. + +## 2. Deliverables +- `src/Containers/module.cmake` declaring `INTERNAL_DEPS Core Memory`. +- Upgraded `include/Void/Containers/Pool.hpp`: stationary `std::shared_ptr`, `std::pmr::memory_resource*` slab allocation, intrusive zero-alloc `noexcept` `Slot` recycling, throwing-ctor rollback, `ObjectPoolLimits`, `PoolError`, `try_acquire`, `live()`, `allocated_bytes()`, and exception-safe `FixedPool::try_acquire`. +- Upgraded `include/Void/Containers/BufferPool.hpp`: stationary `std::shared_ptr`, O(1) power-of-two intrusive buckets (`buckets[65]`), checked `size_class` overflow, `Limits`, `BufferPoolError`, `try_acquire`, extended `Stats`, safe pool move/destruction while leases outlive owner. +- Upgraded `include/Void/Containers/Ring.hpp`: `PushStatus`, `PopStatus`, `PopResult`, Vyukov per-slot sequence `MpscRing` non-spinning `try_pop()`/`close()`, destructor cleanup in `~SpscRing()`/`~MpscRing()`, keeping 1.x `push`/`pop`/`empty`/`full`/`capacity`. +- Expanded tests in `tests/standalone/Containers/{Pool,BufferPool,Ring}.cpp`. + +## 3. Exact files and interfaces +- `src/Containers/module.cmake` +- `include/Void/Containers/Pool.hpp` +- `include/Void/Containers/BufferPool.hpp` +- `include/Void/Containers/Ring.hpp` +- `tests/standalone/Containers/{Pool,BufferPool,Ring}.cpp` + +## 4. Edge cases +- Owner moved/destroyed while leases/buffers are still live (`~Buffer`/`~Ptr` frees directly via `State` and upstream resource with zero UAF and zero recycle heap allocations). +- `std::construct_at` throwing rolls back slot/budget accounting. +- Delayed MPSC producer paused inside move construction causes consumer `try_pop()` to return `PopStatus::pending` without blocking/spinning, then `PopStatus::ok` once producer completes. +- `> 4 * N` ring wraparound, `close()`, and `~SpscRing()`/`~MpscRing()` item destruction verified under TSan and ASan/UBSan. + +## 5. Acceptance criteria +- `Pool*`, `BufferPool*`, and `Ring*` pass under `-DVOID_WARNINGS_AS_ERRORS=ON` and under Debug TSan (`-DVOID_ENABLE_TSAN=ON`). + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-p1-containers -G Ninja -DVOID_ENABLED_MODULES="Containers;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-p1-containers && /tmp/void-p1-containers/tests/VoidTests --filter "Pool*|BufferPool*|Ring*" && ctest --test-dir /tmp/void-p1-containers --output-on-failure --timeout 60' +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-p1-containers-tsan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DVOID_ENABLED_MODULES="Containers;Testing" -DVOID_ENABLE_TSAN=ON -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-p1-containers-tsan && /tmp/void-p1-containers-tsan/tests/VoidTests --filter "Ring*"' +``` diff --git a/docs/agent-workflow/tasks/M-DATA-02.md b/docs/agent-workflow/tasks/M-DATA-02.md new file mode 100644 index 0000000..deb8de4 --- /dev/null +++ b/docs/agent-workflow/tasks/M-DATA-02.md @@ -0,0 +1,34 @@ +# Data Exact 64-Bit Signed/Unsigned JSON Numbers and Checked Conversion +Task ID: M-DATA-02 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-05, C-07 + +## 1. Context and baseline +`include/Void/Data/Json.hpp` currently stores all numbers as `double`, silently rounding integers above `2^53` through parse, DOM construction, equality, serialization, SAX events, and `Reflect.hpp`. StrictJson (`Void::Json::Strict::Value`) is already signed `int64_t` and must remain completely unchanged (C-07). + +## 2. Deliverables +- `src/Data/module.cmake` updated to `INTERNAL_DEPS Core Math Time`. +- Extended `include/Void/Data/Json.hpp`: `NumberKind`, `ConversionError`, `int64_t`/`uint64_t`/`double` variant alternatives, unambiguous integral/float constructors, `is_int`/`is_uint`/`is_double`/`is_integer`/`number_kind`/`as_uint`/`get_int`/`get_uint`, `number_as` delegating to `Void::Numeric::checked_cast`, exact cross-type `operator==`, strict RFC 8259 numeric grammar parsing (256-byte limit, `-0` -> integer `0`, `-0.0` preserved as negative double), optional `SaxHandler::{on_int,on_uint}` retaining `on_number` compatibility, exact `std::to_chars` serialization + `try_serialize`. +- Updated `include/Void/Data/Reflect.hpp` (exact integer `leaf_to_json`, `number_as` in `leaf_from_json` and versioned envelopes) and `include/Void/Configuration/Config.hpp` (exact integer stringification). +- Expanded tests in `tests/standalone/Data/{Json,Reflect}.cpp`; `StrictJson.hpp` and `tests/standalone/Data/StrictJson.cpp` untouched. + +## 3. Exact files and interfaces +- `src/Data/module.cmake` +- `include/Void/Data/Json.hpp` +- `include/Void/Data/Reflect.hpp` +- `include/Void/Configuration/Config.hpp` +- `tests/standalone/Data/{Json,Reflect}.cpp` + +## 4. Edge cases +- `INT64_MIN`, `INT64_MAX`, `UINT64_MAX`, and `2^53 ± 1` survive parse, serialize, equality, and reflection round trips without silent rounding; integers `< INT64_MIN` or `> UINT64_MAX` fail parsing. +- `Value{UINT64_MAX} != Value{static_cast(UINT64_MAX)}` and `Value{(std::uint64_t{1} << 53) + 1} != Value{static_cast(1ULL << 53)}`. +- `number_as` rejects `2^53 + 1` with `Rounding::exact`, succeeds with explicit `Rounding::nearest_even`; `try_serialize` rejects `NaN`/`Inf` with `Error::NonFinite`. + +## 5. Acceptance criteria +- `Data;Update;Configuration;Testing` suites (`Json*|StrictJson*|Reflect*|Update*|Config*`) pass under `-DVOID_WARNINGS_AS_ERRORS=ON` without modifying `StrictJson`. + +## 6. Verification commands +```sh +dev cpp-gcc -p openssl -c bash -lc 'cmake -S . -B /tmp/void-p1-data -G Ninja -DVOID_ENABLED_MODULES="Data;Update;Configuration;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-p1-data && /tmp/void-p1-data/tests/VoidTests --filter "Json*|StrictJson*|Reflect*|Update*|Config*"' +``` diff --git a/docs/agent-workflow/tasks/M-TEXT-02.md b/docs/agent-workflow/tasks/M-TEXT-02.md new file mode 100644 index 0000000..8cd3e05 --- /dev/null +++ b/docs/agent-workflow/tasks/M-TEXT-02.md @@ -0,0 +1,29 @@ +# Text ASCII Helpers, View Splitting, and Bounded Growth +Task ID: M-TEXT-02 +Phase: P1 +Status: APPROVED +Contracts: C-01, C-05, C-13 + +## 1. Context and baseline +`src/Text/module.cmake` declares zero dependencies. `include/Void/Text/Str.hpp` currently uses `std::isspace`/`std::tolower`/`std::toupper`/`std::isalpha`/`std::isdigit`/`std::isalnum` without an explicit locale-free ASCII byte contract (`0..127` classified, bytes `>= 128` preserved unchanged) and lacks overflow/output-bounded splitting, replacing, repeating, and joining utilities. + +## 2. Deliverables +- Extended `include/Void/Text/Str.hpp` adding `constexpr noexcept` ASCII-only classifiers, `trim_*_ascii`, `to_lower_ascii`/`to_upper_ascii`, and `iequals_ascii`. +- New `include/Void/Text/Bounded.hpp` defining `Void::Text::{TextLimits, TextError, EmptyParts, split_views, replace_bounded, repeat_bounded, join_bounded}` and re-exporting ASCII helpers. +- Tests in `tests/standalone/Text/Str.cpp` and `tests/standalone/Text/Bounded.cpp`. + +## 3. Exact files and interfaces +- `include/Void/Text/Str.hpp`: keep all 1.x `Void::Str` signatures intact; add `is_ascii_*`, `to_*_ascii_char`, `trim_{left,right,}_ascii`, `to_{lower,upper}_ascii`, `is_{alpha,digit,alnum}_ascii`, `iequals_ascii`. +- `include/Void/Text/Bounded.hpp`: `TextLimits` (`max_input=16MiB`, `max_output=16MiB`, `max_parts=65536`), `TextError`, `split_views`, `replace_bounded`, `repeat_bounded`, `join_bounded`. + +## 4. Edge cases +- High bytes `0x80..0xFF` and multi-byte UTF-8 sequences preserved untouched by ASCII trim/case helpers; embedded NUL bytes preserved. +- Empty delimiter/needle rejected with `TextError::Code::invalid_rule`; oversized input/parts/output rejected BEFORE allocating; `SIZE_MAX` count*size multiplication rejected with `TextError::Code::overflow`; shrinking `replace_bounded` verified cleanly. + +## 5. Acceptance criteria +- `Str*` and `Bounded*` tests plus full `Text;Testing` suite pass under `-DVOID_WARNINGS_AS_ERRORS=ON` without Unicode linkage. + +## 6. Verification commands +```sh +dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-p1-text -G Ninja -DVOID_ENABLED_MODULES="Text;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-p1-text && /tmp/void-p1-text/tests/VoidTests --filter "Str*|Bounded*" && ctest --test-dir /tmp/void-p1-text --output-on-failure --timeout 60' +```