-
Notifications
You must be signed in to change notification settings - Fork 296
Closed as not planned
Labels
Description
Objective
Add Cause error field and Unwrap() error method to 4 custom error types that currently can't participate in Go's error chain inspection.
Context
From Sergo analysis discussion #16458 (hybrid-symbol-error-analysis). Currently, only OperationError correctly implements Unwrap(). The other 4 custom error types break idiomatic Go error handling with errors.Is() and errors.As().
Types to Fix
WorkflowValidationError—pkg/workflow/error_helpers.go:14ConfigurationError—pkg/workflow/error_helpers.go:116GitHubToolsetValidationError—pkg/workflow/github_toolset_validation_error.go:16SharedWorkflowError—pkg/workflow/shared_workflow_error.go:16
Reference: Correct Implementation
// OperationError (GOOD - has Unwrap)
type OperationError struct {
Operation string
EntityType string
EntityID string
Cause error // ✅ Has Cause field
Suggestion string
Timestamp time.Time
}
func (e *OperationError) Unwrap() error {
return e.Cause // ✅ Implements Unwrap
}Approach
- Add optional
Cause errorfield to each of the 4 structs - Implement
Unwrap() erroron each struct returning theCausefield - Update constructor functions to accept an optional cause parameter (use variadic or a separate
WithCausepattern to maintain backward compatibility) - Add test cases using
errors.Is()anderrors.As()to verify error chain inspection works
Files to Modify
pkg/workflow/error_helpers.go—WorkflowValidationError,ConfigurationErrorpkg/workflow/github_toolset_validation_error.go—GitHubToolsetValidationErrorpkg/workflow/shared_workflow_error.go—SharedWorkflowError
Acceptance Criteria
- All 4 error types have a
Cause errorfield - All 4 error types implement
Unwrap() error - Constructor functions maintain backward compatibility (existing call sites not broken)
- Tests verify
errors.Is()anderrors.As()work through error chains -
make agent-finishpasses (build, test, lint, fmt)
Generated by Plan Command for issue #discussion #16458
- expires on Feb 20, 2026, 5:34 PM UTC
Reactions are currently unavailable