# P0 Module Closures, Header Ownership, and Consumer Matrix Task ID: X-BASE-03 Phase: P0 Status: APPROVED ## 1. Context and baseline Audit of `src/*/module.cmake` vs `#include ` reveals: 1. `` is used by `LogState`, `Async`, `System`, `Stacktrace`, `Configuration`, `Plugin`, and `Service`, yet is installed only by `Void_Log`. 2. Undeclared acyclic internal dependencies in `Containers`, `Data`, `Configuration`, `Service`, `Plugin`, `Fsm`, `Testing`, `TestingMock`, and `Log`. 3. `Core/Uuid.hpp` still leaks `` (resolved in `M-CORE-02`); `Functional/Detail/Repr.hpp` includes ``. 4. `tests/CMakeLists.txt` fails when `VOID_ENABLED_MODULES` builds subsets, and `InstalledComponents.cmake` lacks foundation, embedded, static, and relocated checks. ## 2. Deliverables - Extend `cmake/Module.cmake` with `EXTRA_HEADERS` / `EXCLUDE_HEADERS`; transfer `` ownership to `LogState`. - Reconcile acyclic `INTERNAL_DEPS` across `src/*/module.cmake` files and introduce `Void::FunctionalCoreFormatting`. - Filter `VoidTests` sources in `tests/CMakeLists.txt` by required `ACTIVE_MODULES` and forward `ACTIVE_MODULES`, `CMAKE_GENERATOR`, and `CMAKE_MAKE_PROGRAM` to `InstalledComponents.cmake`. - Add `tests/package/Foundation`, `tests/package/Embedded`, and relocated-prefix validation in `InstalledComponents.cmake`. ## 3. Exact files and interfaces - `cmake/Module.cmake`, `src/LogState/module.cmake`, `src/Log/module.cmake` - `src/Containers/module.cmake`, `src/Data/module.cmake`, `src/Configuration/module.cmake`, `src/Service/module.cmake`, `src/Plugin/module.cmake`, `src/Fsm/module.cmake`, `src/Testing/module.cmake`, `src/TestingMock/module.cmake` - `include/Void/FunctionalCoreFormatting/Repr.hpp`, `src/FunctionalCoreFormatting/module.cmake` - `tests/CMakeLists.txt`, `tests/package/InstalledComponents.cmake`, `tests/package/Foundation/*`, `tests/package/Embedded/*` ## 4. Edge cases - Do not add `Math` to `Core/module.cmake` (violates C-01); keep `Core -> Math` documented until `M-CORE-02`. - Keep `Void/Functional/Detail/Repr.hpp` installed with `Functional` for Wave A+B while providing `Void::FunctionalCoreFormatting`. - Fail loudly if `VOID_ENABLE_TESTING=ON` without `Testing` enabled or if 0 package consumers run. ## 5. Acceptance criteria - Full `ctest` (including relocated `VoidInstalledComponentConsumers`) passes with `-Werror`. - Minimal foundation subset (`Time;Math;Text;Binary;Functional;Testing`) builds and passes with external packages disabled. - `System;Testing` without `Log` installs `include/Void/Log/Log.hpp` and passes `Process*`. - Static (`-DBUILD_SHARED_LIBS=OFF`) and embedded `add_subdirectory` (`tests/package/Embedded`) consumers build and pass. ## 6. Verification commands See `VERIFICATION.md` commands for `/tmp/void-p0-closures`, `/tmp/void-p0-minimal`, `/tmp/void-p0-system`, `/tmp/void-p0-embedded`, and `/tmp/void-p0-static`.