Skip to content

[plan] Refactor trial_command.go to separate business logic from command setup #23907

Description

@github-actions

Objective

Refactor pkg/cli/trial_command.go (1,007 lines) to separate the Cobra command setup from the business logic, following the established NewXCommand() + RunX() pattern.

Context

From discussion #23903 (Repository Quality: File Size Discipline). Command files should be thin wrappers; business logic should live in separate helper files. The existing codebase pattern is NewXCommand() (thin) + RunX() (extracted, testable).

Approach

  1. Identify the RunE / run function logic and extract it to pkg/cli/trial_runner.go
  2. Keep NewTrialCommand() in trial_command.go as a thin wrapper — target under 200 lines
  3. Move any structs/types specific to trial logic to pkg/cli/trial_types.go if needed to keep files within limits
  4. Target: trial_command.go under 200 lines, trial_runner.go under 400 lines

Rules

  • Do NOT change function signatures or exported names
  • Run make fmt after changes
  • Run go test ./pkg/cli/ -run ".*[Tt]rial.*" to validate
  • Run make agent-finish before committing

Acceptance Criteria

  • pkg/cli/trial_command.go reduced to Cobra command setup and flag definitions — under 200 lines
  • Business logic extracted to pkg/cli/trial_runner.go (or appropriately named files)
  • All existing trial-related tests pass
  • New files are each under 350 lines

Generated by Plan Command for issue #discussion #23903 ·

  • expires on Apr 3, 2026, 2:40 PM UTC

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions