-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
Description
Objective
Clean up the Go compiler to generate only the consolidated GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG JSON instead of 30+ individual environment variables.
Context
This is Phase 5 of the safe output manager refactoring (#8098). After all JavaScript handlers are refactored, remove the individual env var generation from the Go compiler.
Dependencies
- Requires: #aw_phase4_update to be completed (all handlers refactored)
Target Branch
sot (safe output transition)
Go Files to Modify
pkg/workflow/compiler_safe_outputs_core.go- Core safe output compilationpkg/workflow/compiler_safe_outputs_issues.go- Issue-specific env varspkg/workflow/compiler_safe_outputs_discussions.go- Discussion-specific env varspkg/workflow/compiler_safe_outputs_shared.go- Shared env var generation
Implementation Changes
Remove Individual Env Var Functions
Delete or consolidate:
generateIssueEnvVars()generateCommentEnvVars()generateDiscussionEnvVars()generateLabelEnvVars()- etc. (8+ functions)
Keep Only These Env Vars
GH_AW_SAFE_OUTPUTS_STAGED- Staged mode flagGH_AW_SAFE_OUTPUTS_HANDLER_CONFIG- JSON configuration
New Config Generation
func generateHandlerConfig(workflow *Workflow) (string, error) {
config := map[string]interface{}{
"create_issue": map[string]interface{}{
"max": workflow.SafeOutputs.Issues.Max,
"expires": workflow.SafeOutputs.Issues.Expires,
"allowed_labels": workflow.SafeOutputs.Issues.AllowedLabels,
},
"add_comment": map[string]interface{}{
"max": workflow.SafeOutputs.Comments.Max,
"hide_older": workflow.SafeOutputs.Comments.HideOlder,
},
// ... other handlers
}
return json.Marshal(config)
}Testing
# Run Go tests
make test-unit
# Build and test compilation
make build
./gh-aw compile test-workflow.md
# Verify env vars in output
cat test-workflow.lock.yml | grep "GH_AW_"Acceptance Criteria
- Individual env var generation removed
- Only 2 env vars generated:
STAGEDandHANDLER_CONFIG - JSON config contains all handler settings
- All Go tests pass
- Test workflow compiles successfully
- Compiled workflow has correct env vars structure
Related to Safe output manager #8098
AI generated by Plan Command for #8098
Copilot