Conversation
…ue_helpers.cjs - Create missing_issue_helpers.cjs with buildMissingIssueHandler() factory - Refactor create_missing_data_issue.cjs to use shared helper - Refactor create_missing_tool_issue.cjs to use shared helper - Add missing_issue_helpers.test.cjs with 14 tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request successfully refactors duplicate code from create_missing_data_issue.cjs and create_missing_tool_issue.cjs into a shared helper module, reducing code duplication by approximately 200 lines per file.
Changes:
- Created
missing_issue_helpers.cjswith a parameterizedbuildMissingIssueHandlerfactory function that encapsulates the common issue creation/update pipeline - Refactored
create_missing_data_issue.cjsfrom 228 lines to 42 lines by delegating to the new helper - Refactored
create_missing_tool_issue.cjsfrom 221 lines to 42 lines by delegating to the new helper - Added comprehensive test coverage with 14 tests in
missing_issue_helpers.test.cjs
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| actions/setup/js/missing_issue_helpers.cjs | New shared helper module exporting buildMissingIssueHandler factory function that parameterizes item fields, templates, and renderers |
| actions/setup/js/missing_issue_helpers.test.cjs | New comprehensive test suite covering validation, max count enforcement, config extraction, comment/issue creation, labels, and error handling |
| actions/setup/js/create_missing_data_issue.cjs | Refactored to use buildMissingIssueHandler with data-specific renderers for data_type and optional context fields |
| actions/setup/js/create_missing_tool_issue.cjs | Refactored to use buildMissingIssueHandler with tool-specific renderers for backtick-formatted tool names |
Comments suppressed due to low confidence (1)
actions/setup/js/missing_issue_helpers.cjs:170
- The JSDoc comment should include the
resolvedTemporaryIdsparameter to match the MessageHandlerFunction signature. Update the comment to:
/**
* Message handler function that processes a single missing-issue message
* @param {Object} message - The message to process
* @param {Object} resolvedTemporaryIds - Resolved temporary IDs
* @returns {Promise<Object>} Result with success/error status and issue details
*/ /**
* Message handler function that processes a single missing-issue message
* @param {Object} message - The message to process
* @returns {Promise<Object>} Result with success/error status and issue details
*/
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @param {Object} message - The message to process | ||
| * @returns {Promise<Object>} Result with success/error status and issue details | ||
| */ | ||
| return async function handleMissingIssue(message) { |
There was a problem hiding this comment.
The returned handler function should accept both message and resolvedTemporaryIds parameters to match the MessageHandlerFunction type signature and be consistent with all other handlers in the codebase. Currently it only accepts the message parameter.
Update the function signature to:
return async function handleMissingIssue(message, resolvedTemporaryIds) {Even if resolvedTemporaryIds is not used in this handler, it must be included in the signature for API consistency.
This issue also appears on line 166 of the same file.
| return async function handleMissingIssue(message) { | |
| return async function handleMissingIssue(message, resolvedTemporaryIds) { |
| if (result.success) { | ||
| processedIssues.push(result); | ||
| } | ||
|
|
There was a problem hiding this comment.
The processedIssues array is declared and populated but never used or returned. This appears to be dead code that was carried over from the original implementations. Consider removing it to reduce clutter, or if it's intended for future use, add a comment explaining its purpose.
| if (result.success) { | |
| processedIssues.push(result); | |
| } |
create_missing_data_issue.cjsandcreate_missing_tool_issue.cjsduplicated ~200 lines each — the entire handler pipeline (config parsing, search-or-create, comment/body construction, max-count enforcement) was identical except for field names and item renderers.Changes
missing_issue_helpers.cjs(new) — exportsbuildMissingIssueHandler(options), parameterized over the parts that actually differ:itemsField/templatePath/templateListKey— field and template routingbuildCommentHeader(runUrl)— header lines for existing-issue commentsrenderCommentItem(item, index)/renderIssueItem(item, index)— item-level renderingcreate_missing_data_issue.cjs— reduced from 228 → 43 lines; delegates tobuildMissingIssueHandlerwith data-specific renderers (data_type, optionalcontext)create_missing_tool_issue.cjs— reduced from 221 → 42 lines; delegates with tool-specific renderers (backtick-formattedtoolname)missing_issue_helpers.test.cjs(new) — 14 tests covering validation, max-count, config extraction, comment-on-existing, create-new, labels, and API errorsWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.