Skip to content

refactor(di): add module registrar support to unified_bootstrapper#370

Merged
kcenon merged 1 commit into
mainfrom
refactor/issue-366-audit-di-and-add-module-registrar
Feb 23, 2026
Merged

refactor(di): add module registrar support to unified_bootstrapper#370
kcenon merged 1 commit into
mainfrom
refactor/issue-366-audit-di-and-add-module-registrar

Conversation

@kcenon

@kcenon kcenon commented Feb 23, 2026

Copy link
Copy Markdown
Owner

Closes #366
Part of #363

Summary

  • Add ModuleRegistrar C++20 concept for compile-time validation of module registration classes
  • Add dynamic module registration API to unified_bootstrapper (register_module(), unregister_module(), registered_modules(), is_module_registered())
  • Support both function-based and class-based (concept-constrained) registration
  • Modules registered before initialize() are deferred and called during init; modules registered after are called immediately
  • Simplify register_optional_services() by integrating dynamic module dispatch alongside legacy #ifdef guards
  • Add 12 unit tests covering pre/post-init registration, duplicates, ordering, failure propagation, and concept-based registration

Context

This is Phase 1+2 of the DI container consolidation effort (#363):

Phase 1 (Audit) identified that:

System DI Implementation Migration Effort
monitoring_system Already delegates to service_container Minimal
logger_system lightweight_di_container + bridge adapter Medium
database_system database_coordinator + bridge adapter High

Phase 2 (Enhancement) adds the module registrar infrastructure that downstream systems will use to register their services with the unified container.

Remaining phases tracked in: #367 (logger), #368 (monitoring), #369 (database)

Test Plan

  • All 37 unified_bootstrapper tests pass (12 new)
  • All 122 project tests pass with no regressions
  • Full build succeeds with no warnings
  • Compile-time static_assert verifies ModuleRegistrar concept

)

Add dynamic module registration to unified_bootstrapper, replacing
compile-time #ifdef guards with runtime registration. This enables
subsystems to register their DI services programmatically.

- Add ModuleRegistrar concept to concepts/service.h
- Add register_module(), unregister_module(), registered_modules(),
  is_module_registered() to unified_bootstrapper
- Support both function-based and class-based (concept) registration
- Modules registered before initialize() are called during init;
  modules registered after are called immediately
- Add 12 unit tests for module registration functionality
@kcenon kcenon merged commit e9a166e into main Feb 23, 2026
24 checks passed
@kcenon kcenon deleted the refactor/issue-366-audit-di-and-add-module-registrar branch February 23, 2026 11:10
kcenon added a commit that referenced this pull request Apr 13, 2026
) (#370)

Add dynamic module registration to unified_bootstrapper, replacing
compile-time #ifdef guards with runtime registration. This enables
subsystems to register their DI services programmatically.

- Add ModuleRegistrar concept to concepts/service.h
- Add register_module(), unregister_module(), registered_modules(),
  is_module_registered() to unified_bootstrapper
- Support both function-based and class-based (concept) registration
- Modules registered before initialize() are called during init;
  modules registered after are called immediately
- Add 12 unit tests for module registration functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(di): Phase 1+2 — audit DI containers and add module registrar support

1 participant