Files

2.8 KiB

M-SERVICE-01..05 — Owning ServiceHandles, Immutable Snapshots, DAG Lifecycle & ServicePlugin Split

  • Wave: Wave 8 (feat/roadmap-p2-wave8, branched from main at d83d0f4)
  • Roadmap reference: docs/roadmap/modules/Service.md, docs/roadmap/DEPENDENCIES.md (Rule #3, G-HOST)

Scope & Ownership

  • src/Service/module.cmake: INTERNAL_DEPS Core Functional Time Async LogState, EXCLUDE_HEADERS Void/Service/PluginService.hpp (zero external deps, zero Plugin dependency).
  • src/ServicePlugin/module.cmake: INTERNAL_DEPS Service Plugin LogState, EXTRA_HEADERS Void/Service/PluginService.hpp.
  • include/Void/Service/Types.hpp: kServiceErrorDomain = 22, ServiceErrorCode, make_service_error, ServiceLimits (256 providers, 16 parent levels, 1,024 edges, 64 staged changes, 128 lifecycle requests, 4 retained generations), PublicationEpoch, ExpectedEpoch, ServicePin, ServiceHealth, ServiceObservation, ShutdownReport, IManagedService, ServiceHandle<I>.
  • include/Void/Service/Registry.hpp + src/Service/Registry.cpp:
    • Preserve 100% of existing ServiceRegistry API (provide<I>, remove<I>, get<I>, require<I>, has<I>, start_all, stop_all, size).
    • Immutable SnapshotData swapped atomically under a short guard; old snapshots, destructors, and observers released/invoked outside locks.
    • start_all()/stop_all() copy retained lifecycle list under short lock and invoke callbacks outside locks.
    • ServiceSnapshot retaining parent_snapshot shared_ptr so child snapshots outlive parent registries; snapshot(), from_parent_snapshot(), refresh_parent().
    • acquire<I>() -> Result<ServiceHandle<I>> returning service_stopping when closed or missing_service when absent, pinning generation lifetime until handle drop.
    • ProviderSet (add, add_alias sharing one lifecycle node per object pointer), PreparedPublication, prepare_batch (topological sort + cycle/duplicate/missing-dep/limit validation), start_staged (topological start + abort_start() + reverse rollback preserving active snapshot), publish (epoch check + retention cap + atomic swap), start, close_and_join (dependent-first stop + incomplete_owners reporting without freeing live providers), retained_generation_count().
  • include/Void/Service/PluginService.hpp: preserved PluginServiceBinding<I> + acquire_plugin_service<I> pinning exact PluginHandle via ServicePin.
  • Tests & consumers: tests/standalone/Service/ServiceHardening.cpp, tests/package/ServiceOnly/*, tests/package/ServicePluginOnly/*, updated tests/package/InstalledComponents.cmake.

Verification Criteria

  • Standalone Service;ServicePlugin;Testing RelWithDebInfo -Werror: Service* tests + ctest 2/2 (ServiceOnly, ServicePluginOnly).
  • Full Wave 8 RelWithDebInfo -Werror, ASan+UBSan -Werror, and Wave 8 TSan.