Skip to content

[plan] Extract assign-to-agent parsing to dedicated function #5429

@github-actions

Description

@github-actions

Objective

Extract inline parsing logic for assign-to-agent configuration from safe_outputs.go into a dedicated parseAssignToAgentConfig() function in assign_to_agent.go.

Current State

Problem: Parsing logic is embedded inline in pkg/workflow/safe_outputs.go:202-225 (~24 lines)

File: pkg/workflow/assign_to_agent.go currently only contains buildAssignToAgentJob() (58 lines total)

Approach

  1. Create parseAssignToAgentConfig() function in assign_to_agent.go
  2. Move parsing logic from safe_outputs.go:202-225 to new function
  3. Update safe_outputs.go to call c.parseAssignToAgentConfig(outputMap)
  4. Verify tests pass with make test-unit

Implementation Details

New function signature:

func (c *Compiler) parseAssignToAgentConfig(outputMap map[string]any) *AssignToAgentConfig

Logic to extract (from safe_outputs.go:202-225):

  • Parse name field (default agent, optional)
  • Parse target and target-repo configuration using ParseTargetConfig()
  • Parse base configuration (github-token, max)
  • Handle null case (create empty config)

Update in safe_outputs.go:

// Replace lines 202-225 with:
assignToAgentConfig := c.parseAssignToAgentConfig(outputMap)
if assignToAgentConfig != nil {
    config.AssignToAgent = assignToAgentConfig
}

Files to Modify

  • Create: parseAssignToAgentConfig() in pkg/workflow/assign_to_agent.go
  • Update: pkg/workflow/safe_outputs.go (remove lines 202-225, add function call)

Expected Changes

  • assign_to_agent.go: 58 → ~88 lines (+30 lines)
  • safe_outputs.go: ~1,310 → ~1,286 lines (-24 lines)

Acceptance Criteria

  • parseAssignToAgentConfig() function added to assign_to_agent.go
  • Inline parsing removed from safe_outputs.go
  • Function called correctly in safe_outputs.go
  • All tests pass (make test-unit)
  • Build succeeds (make build)
  • Generated YAML unchanged (byte-for-byte)
    Related to [plan] Complete safe-output pattern consistency #5426

AI generated by Plan Command for #5382

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions