Skip to content

refactor: isComponentEnabled accepts any type, loses compile-time safety #48

@digiserg

Description

@digiserg

Summary

isComponentEnabled at line 1284 uses any with a type switch over known component types. If a new component type is added but not included in the switch, the function silently returns false — disabling the component with no compile-time warning. This is a maintenance footgun.

Detailed Requirements

Define an enableable interface (e.g., type enableable interface { IsEnabled() bool }) and implement it on all component spec types. Replace the any parameter with the typed interface so that new components that forget to implement IsEnabled() cause a compile error rather than silent misbehavior.

Location

  • internal/controller/axonopsserver_controller.go:1284

Acceptance Criteria

  1. isComponentEnabled uses a typed interface parameter, not any
  2. New component types that do not implement the interface cause a compile error
  3. All existing callers updated to use the interface
  4. No behavioral change for existing components

Testing Requirements

  • Unit test: verify each component type satisfies the interface
  • Compile-time verification: adding a new component type without IsEnabled() fails to compile

Documentation Requirements

  • Add godoc to the enableable interface
  • Comment on isComponentEnabled explaining the design choice

Dependencies

  • None

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt and code quality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions