2.6 KiB
2.6 KiB
Core Standalone UUID, Checked Bits, and Portable Hash
Task IDs: M-CORE-02, M-CORE-03 Phase: P1 Status: APPROVED Contracts: C-01, C-02, C-05
1. Context and baseline
include/Void/Core/Uuid.hpp currently includes <Void/Math/Random.hpp> (an undeclared dependency leak violating C-01), allocates temporary std::string objects in parse() and v5_lite(), and marks v4() unconditionally noexcept. include/Void/Core/Bits.hpp lacks checked boundary variants, and include/Void/Core/Hash.hpp uses __builtin_memcpy in murmur3_32.
2. Deliverables
- Portable incremental/constexpr extensions in
include/Void/Core/Hash.hpp. - Zero-Math, zero-allocation
UuidAPIs ininclude/Void/Core/Uuid.hpp. include/Void/Core/CheckedBits.hpp(checked_extract,checked_deposit,checked_align_up,checked_align_down).- Expanded unit tests in
tests/standalone/Core/{Uuid,Bits,Hash}.cppand isolated installed consumertests/package/CoreOnly.
3. Exact files and interfaces
include/Void/Core/Hash.hpp:fnv1a64_offset_basis,fnv1a64_update,crc32_initial,crc32_update,crc32_finalize; endian-portableconstexprmurmur3_32.include/Void/Core/Uuid.hpp: remove<Void/Math/Random.hpp>and<format>; addGenerateError,v4(G&),try_v4() noexcept, throwingv4(),constexpr format_chars,constexprzero-allocparse, zero-alloc byte-identicalv5_lite.include/Void/Core/CheckedBits.hpp:BitError { invalid_range, invalid_alignment, overflow },checked_extract,checked_deposit,checked_align_up,checked_align_down.tests/package/CoreOnly/{CMakeLists.txt,main.cpp},tests/package/InstalledComponents.cmake.
4. Edge cases
checked_extract/checked_deposit:offset = width,count = 0,count = width,offset + countinteger overflow.checked_align_up:alignment = 0, non-power-of-two,value = MAXoverflow.Uuid::v5_lite: golden byte-for-byte equivalence with 1.xns.bytes + namehash output.- Throwing custom URBG propagates out of
v4(G&);try_v4()convertsrandom_devicefailure without returning nil.
5. Acceptance criteria
-DVOID_ENABLED_MODULES=Core -DVOID_ENABLE_TESTING=OFFinstalls and runsCoreOnlywith all external packages disabled and noMathdependency.- Core tests pass with
-DVOID_WARNINGS_AS_ERRORS=ONand ASan/UBSan.
6. Verification commands
dev cpp-gcc -c cmake -S . -B /tmp/void-p1-core -G Ninja -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug -DVOID_ENABLED_MODULES="Core;Testing" -DVOID_WARNINGS_AS_ERRORS=ON
dev cpp-gcc -c cmake --build /tmp/void-p1-core --parallel 4
dev cpp-gcc -c /tmp/void-p1-core/tests/VoidTests --filter "Uuid*|Bits*|Hash*"