-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
Description
Objective
Convert medium complexity safe output handlers to use the factory pattern, building on the pattern established in Phase 1.
Context
This is Phase 2 of the safe output manager refactoring (#8098). These handlers are more complex than Phase 1 but simpler than create_issue.
Dependencies
- Requires: #aw_phase1_simple to be completed (establishes pattern)
Target Branch
sot (safe output transition)
Handlers to Refactor
actions/setup/js/add_comment.cjsactions/setup/js/create_discussion.cjs
Implementation Pattern
Follow the factory pattern established in Phase 1:
async function main(config = {}) {
// Initialize with config from JSON (no env vars)
return async function(outputItem, resolvedTemporaryIds) {
// Process single message
// Resolve any temporary ID references
// Return { temporaryId?, repo, number }
};
}
module.exports = { main };Special Considerations
add_comment.cjs
- Handles comments on issues, PRs, and discussions
- May need to resolve parent temporary IDs
- Config:
max,hide_older_comments
create_discussion.cjs
- Creates new discussions
- Returns temporary ID for new discussions
- Config:
max,category_id,repository_id
Testing
# Run handler tests
npm test -- add_comment.test.cjs
npm test -- create_discussion.test.cjs
# Integration test
npm test -- safe_output_handler_manager.test.cjsAcceptance Criteria
- Both handlers use factory pattern
- Temporary ID resolution works correctly
- No direct
process.envaccess in handlers - All existing tests pass
- Config properly passed through from JSON
Related to Safe output manager #8098
AI generated by Plan Command for #8098