2.7 KiB
2.7 KiB
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, andResourceGraph(add_node,add_dependency,validate_and_planviaVoid::Algorithms::topological_order).include/Void/Runtime/Host.hpp:HostState,EmbeddedResources,ShutdownReport, inertHost(create,create_embedded), andHostBuilder.tests/standalone/Runtime/RuntimeHost.cppand installed consumertests/package/RuntimeOnly/{CMakeLists.txt,main.cpp}registered intests/package/InstalledComponents.cmake.
3. Exact files and interfaces
src/Runtime/module.cmakeinclude/Void/Runtime/{Options,ResourceGraph,Host}.hpptests/standalone/Runtime/RuntimeHost.cpptests/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 submoduleIO::BackendOptions::limitsexceeding globalRuntimeLimitsreject 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 andVoidInstalledComponentConsumers(RuntimeOnly) pass under-DVOID_WARNINGS_AS_ERRORS=ONand ASan+UBSan.
6. Verification commands
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'