Skip to content

[plan] Refactor create_issue handler to factory pattern #8103

@github-actions

Description

@github-actions

Objective

Convert the most complex safe output handler (create_issue.cjs) to use the factory pattern.

Context

This is Phase 3 of the safe output manager refactoring (#8098). This is the most complex handler with 355 lines and handles sub-issue linking, cross-repository support, and parent-child relationships.

Dependencies

  • Requires: #aw_phase2_medium to be completed

Target Branch

sot (safe output transition)

Handler to Refactor

actions/setup/js/create_issue.cjs (355 lines)

Complex Features to Preserve

  1. Sub-issue linking logic - Parent-child issue relationships
  2. Cross-repository support - Issues in different repos
  3. Temporary ID resolution - Resolve parent temporary IDs
  4. Parent-child relationships - Link sub-issues to parents
  5. Label sanitization - Clean up labels before applying
  6. Issue type mapping - Support custom issue types

Implementation Pattern

async function main(config = {}) {
  const { 
    max = 5, 
    expires = 7, 
    allowed_labels = [], 
    allowed_issue_types = {} 
  } = config;
  
  return async function(outputItem, resolvedTemporaryIds) {
    // Process single issue creation message
    // Resolve parent temporary IDs
    // Create issue with all features
    // Return { temporaryId, repo, number }
  };
}

module.exports = { main };

Config Parameters

  • max - Maximum issues per workflow
  • expires - Days until issues expire
  • allowed_labels - Whitelisted labels
  • allowed_issue_types - Custom issue type mappings
  • default_assignees - Default assignees for issues

Testing

# Run comprehensive tests
npm test -- create_issue.test.cjs

# Test sub-issue linking
npm test -- create_issue.test.cjs -t "sub-issue"

# Integration test
npm test -- safe_output_handler_manager.test.cjs

Acceptance Criteria

  • Factory pattern implemented
  • Sub-issue linking preserved
  • Cross-repository support maintained
  • Temporary ID resolution works
  • No direct process.env access
  • All existing tests pass
  • Parent-child relationships work correctly
    Related to Safe output manager #8098

AI generated by Plan Command for #8098

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions