Skip to content

[Task] feat: Implement service registration in unified_bootstrapper #317

Description

@kcenon

What

Implement the placeholder register_core_services() and register_optional_services() methods in unified_bootstrapper to actually register system services.

Scope

In Scope:

  • Core service registration (always registered)
  • Optional service registration based on bootstrapper_options
  • Service dependency ordering
  • Error handling for registration failures

Out of Scope:

  • Actual service implementations (provided by subsystems)
  • Runtime service discovery

Why

Problem

Current implementation at unified_bootstrapper.h:444-485 contains only placeholder code:

inline VoidResult unified_bootstrapper::register_core_services() {
    // Core services are minimal and always registered
    // The actual service implementations come from subsystems via adapters
    return VoidResult::ok({});  // Empty!
}

Business Value

  • unified_bootstrapper becomes actually usable
  • Systems can properly initialize via single entry point
  • Proper dependency injection for all subsystems

Part of #314

Who

When

  • Priority: Medium
  • Dependencies: Service adapters from each subsystem

Where

File Location

common_system/include/kcenon/common/di/unified_bootstrapper.h

How

Technical Approach

  1. Define service registration hooks

    // Each subsystem provides a registration function
    namespace kcenon::logger::di {
        VoidResult register_services(service_container& container);
    }
  2. Implement register_optional_services

    inline VoidResult unified_bootstrapper::register_optional_services(
        const bootstrapper_options& opts) {
        
        if (opts.enable_logging) {
            // Check if logger adapter is available
            #if defined(KCENON_HAS_LOGGER_SYSTEM)
            auto result = logger::di::register_services(service_container::global());
            if (result.is_err()) return result;
            #endif
        }
        
        if (opts.enable_monitoring) {
            #if defined(KCENON_HAS_MONITORING_SYSTEM)
            auto result = monitoring::di::register_services(service_container::global());
            if (result.is_err()) return result;
            #endif
        }
        
        // ... similar for database and network
        
        return VoidResult::ok({});
    }
  3. Add feature detection macros

    • Create config/feature_system_deps.h with detection macros
    • Allow graceful degradation when subsystems not available

Acceptance Criteria

  • register_core_services() registers essential services
  • register_optional_services() conditionally registers based on options
  • Feature detection macros for each subsystem
  • Proper error handling and rollback on failure
  • Documentation for extending with new subsystems
  • Integration test with at least one subsystem

Testing Requirements

  1. Test initialization with all options enabled
  2. Test initialization with each option individually
  3. Test graceful handling when subsystem not available
  4. Test error rollback on registration failure

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions