Skip to content

Replace concrete module type switch with ExecutionTrackerSetter interface in cmd/server/main.go #62

Closed

Description

@intel352

Problem

cmd/server/main.go around lines 280–295 has a switch on concrete module types:

case *module.QueryHandler:
    qh.SetExecutionTracker(app.executionTracker)
case *module.CommandHandler:
    ch.SetExecutionTracker(app.executionTracker)

This pattern requires modifying the server every time a new module type needs an execution tracker.

Fix Direction

Define an ExecutionTrackerSetter interface:

type ExecutionTrackerSetter interface {
    SetExecutionTracker(ExecutionTrackerProvider)
}

Have eligible modules implement it. The engine ranges over services calling the interface method — no more switch.

Note

Depends on the serverApp god object refactor and the type assertions refactor being merged first.

Context

See docs/DEFERRED_ISSUES.md — Architecture section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitectural design and coupling issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions