Skip to content

Duplicate Code: Missing-issue wrapper pattern in actions/setup/js #28254

@github-actions

Description

@github-actions

Overview

A semantic duplicate-code scan found a repeated wrapper pattern around buildMissingIssueHandler(...) in three production .cjs files. Each file is ~40 lines and largely differs only by configuration values and small item-rendering variations.

Critical Information

  • Pattern: missing/incomplete issue handler wrappers with duplicated scaffolding
  • Severity: Medium
  • Occurrences: 3
  • Duplication size: ~25-30 repeated lines per file
  • Commit analyzed: 0775d65c9572ac16c5fa3bd72df9c39db939e5b3

Duplication Details

Evidence
  • All three files define HANDLER_TYPE, call buildMissingIssueHandler({...}), and export main.
  • diff -u between these files shows only field-name/content substitutions, while the surrounding structure is duplicated.
  • Serena symbol overview reports an equivalent symbol layout in all 3 files (HANDLER_TYPE, main, module export).

Impact Analysis

  • Maintainability: Updating shared behavior (headers, list rendering conventions, metadata fields) requires synchronized edits across multiple files.
  • Bug risk: Divergence risk increases when one wrapper receives updates and others do not.
  • Code bloat: Repeated boilerplate obscures the true per-handler deltas.

Refactoring Recommendations

  1. Move wrapper creation to a descriptor registry.
    • Add a single map/array of handler descriptors (type, list key, template path, header builder, item renderer).
    • Generate/export handlers via one shared factory loop.
  2. Keep per-handler item formatting as isolated callbacks.
    • Preserve current output behavior while reducing duplicated scaffolding.
  3. Add focused tests for descriptor-driven registration.
    • Validate each handler type still maps to expected fields and rendered sections.

Implementation Checklist

  • Create a descriptor-based registration utility for missing/incomplete issue handlers
  • Replace the three near-identical wrapper files with minimal descriptor exports
  • Add/update tests to lock expected rendering and issue metadata
  • Verify no behavior change in safe output issue generation

Analysis Metadata

  • Analyzed files: 1001 production .go/.cjs files (tests/workflows excluded)
  • Detection method: Serena semantic analysis + structural diff comparison
  • Triggered by: @pelikhan
  • Workflow run: §24888375770

References:

Warning

⚠️ Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • ab.chatgpt.com
  • api.github.com
  • chatgpt.com
  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"
    - "api.github.com"
    - "chatgpt.com"
    - "github.com"

See Network Configuration for more information.

Generated by Duplicate Code Detector ·

Metadata

Metadata

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