Skip to content

Extract domain services into self-registering module types (feature flag pattern) #90

@intel352

Description

@intel352

Overview

Following the template established by the feature flag migration (PR #56, commit ab64254), extract each domain service into a self-registering module type that can be declared in YAML config.

Template pattern:

  1. Define the module type with config struct (db_path, cache_ttl, etc.)
  2. Module's ProvidesServices() self-registers its admin adapter in the service registry
  3. Server auto-discovers it via interface assertion — no explicit wiring

Domain Services to Extract

Service Current Location New Module Type Key Config
Event Store evstore.SQLiteEventStore eventstore.service db_path, retention_days
Timeline/Replay store/timeline_handler.go timeline.service event_store dependency
DLQ store/dlq_handler.go dlq.service max_retries, retention
Execution Tracker module/execution_tracker.go execution.tracker event_store dependency
Runtime Manager module/runtime_manager.go runtime.manager
Backfill/Mock/Diff store/backfill_handler.go backfill.service
Ingest Handler hardcoded in server ingest.handler
Billing billing/handler.go billing.service stripe_key, plans

Per-Service Pattern

For each service:

  • Create module type in module/ (or reuse existing if partially done)
  • Implement ProvidesServices() to self-register admin adapter
  • Add config struct with appropriate fields
  • Register factory in engine.go (or plugin)
  • Declare in admin/config.yaml
  • Remove hardcoded wiring from cmd/server/main.go
  • Add schema in schema/module_schema.go
  • Test module in isolation

Depends On

Already Done

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions