Activity Contracts for Workflow Orchestrator#360
Conversation
PR Validation PassedPR description validation passed |
WalkthroughA new activity contracts Go package is introduced, defining shared types for the activity system including global output mappings, standardized activity inputs and outputs, and a common activity function signature. Module configuration is established for the new package. Changes
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
core/activity-contracts/activity/activity.go (1)
22-27: Clarify precedence betweenActivityOutput.Errorand returnederror.Lines 22-27 currently expose two error channels. Please define one canonical behavior to avoid inconsistent handling across activities and orchestrator paths.
Proposed contract clarification
type ActivityOutput struct { Result map[string]interface{} `json:"result,omitempty"` - Error string `json:"error,omitempty"` + // Error is for domain/business failures that should be serialized in workflow state. + // Runtime/infrastructure failures should be returned from ActivityFunc as a non-nil error. + Error string `json:"error,omitempty"` } // ActivityFunc is the function signature that every registered activity must implement. +// Return non-nil error only for runtime/execution failures. type ActivityFunc func(ctx context.Context, globalOutputs GlobalActivityOutputs, input ActivityInput) (ActivityOutput, error)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/activity-contracts/activity/activity.go` around lines 22 - 27, Define a single canonical error precedence: treat the error value returned by ActivityFunc as authoritative for control flow and orchestration, and treat ActivityOutput.Error only as an optional, informational field for result payloads; update all callers (the orchestrator and any executor) to check the returned error from ActivityFunc first and only inspect ActivityOutput.Error if the returned error is nil, and update comments/docs on the ActivityOutput struct and the ActivityFunc type to state this precedence so implementers know to return an error for control/failure and only set ActivityOutput.Error for non-fatal, descriptive result information.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@core/activity-contracts/activity/activity.go`:
- Around line 22-27: Define a single canonical error precedence: treat the error
value returned by ActivityFunc as authoritative for control flow and
orchestration, and treat ActivityOutput.Error only as an optional, informational
field for result payloads; update all callers (the orchestrator and any
executor) to check the returned error from ActivityFunc first and only inspect
ActivityOutput.Error if the returned error is nil, and update comments/docs on
the ActivityOutput struct and the ActivityFunc type to state this precedence so
implementers know to return an error for control/failure and only set
ActivityOutput.Error for non-fatal, descriptive result information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ede72fd-5da4-4b1a-a91d-848215d0bebd
📒 Files selected for processing (2)
core/activity-contracts/activity/activity.gocore/activity-contracts/go.mod
What type of PR is this?
Description
PR Description
Adding a small Go Project which is used by workflow-orchestrator and activities.
Added tests
Key Requirement Doc
Why is KRD not required?
Just model changes, which needs to be released
Downstream Impact
Additional Information