Skip to content

Refactor god classes: MigrationService (970 LOC), ThreeScaleService (758 LOC) #110

Description

@pcastelo

Problem

MigrationService.java is 970 LOC handling analyze, YAML generation, secret creation, AI prompt building, catalog parsing, and DevHub registration. Violates Single Responsibility Principle and is high regression risk.

Proposed extraction

  • YamlResourceGenerator — YAML manipulation and resource assembly
  • SecretGenerator — K8s secret creation for OIDC, API keys
  • AiPromptBuilder — AI prompt construction for migration analysis
  • CatalogInfoGenerator — DevHub catalog-info.yaml generation
  • Keep MigrationService as thin orchestrator (~200 LOC)

Also refactor

  • ThreeScaleService.java (758 LOC) — extract cache layer and CRD discovery
  • MigrationResource.java (306 LOC) — extract input validation

Acceptance criteria

  • No class exceeds 300 LOC
  • Existing tests still pass after extraction
  • New classes have dedicated unit tests
  • No behavior change (pure refactoring)

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendQuarkus backendclean-codeRefactoring and code qualitypriority:mediumPlan for next sprinttech-debtTechnical debt reduction

    Type

    No type

    Fields

    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