Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
There was a problem hiding this comment.
Pull request overview
Adds overdue/failed automation to workflow executions and step executions, including configurable grace periods and new evidence on failure.
Changes:
- Introduces an
OverdueServiceand wires it into the scheduler worker to mark steps/executions overdue and fail them after grace expiry. - Adds new statuses/fields (
overdue,OverdueAt,DueDate) plus status-transition validation, retry initialization behavior, and dependent-step failure propagation. - Exposes grace-period overrides on workflow definitions/instances/steps via handlers and updates Swagger + tests accordingly.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/workflow/step_transition.go | Adds invalid-transition sentinel error, overdue transition rule, and failure entrypoint. |
| internal/workflow/scheduler.go | Runs overdue checks at the end of scheduler work when enabled. |
| internal/workflow/overdue.go | New service to mark steps/executions overdue and fail overdue executions after grace. |
| internal/workflow/overdue_test.go | New tests for overdue and grace-expiry failure behavior. |
| internal/workflow/manager.go | Adds overdue step count to execution status summary. |
| internal/workflow/executor.go | Adds per-step due dates, retry initialization behavior, and failure propagation to dependents. |
| internal/workflow/executor_test.go | Updates mocks for new executor initialization behavior. |
| internal/workflow/evidence.go | Adds evidence generation for execution failure. |
| internal/workflow/constants.go | Adds StatusOverdue to orchestration-layer step status constants. |
| internal/workflow/assignment.go | Allows reassignment for overdue steps. |
| internal/workflow/assignment_test.go | Tests reassignment for overdue steps. |
| internal/service/worker/service.go | Wires OverdueService + config flag into scheduler worker construction. |
| internal/service/relational/workflows/workflow_step_definition_service.go | Validates non-negative step grace override. |
| internal/service/relational/workflows/workflow_step_definition.go | Adds per-step GracePeriodDays override field. |
| internal/service/relational/workflows/workflow_instance_service.go | Validates non-negative instance grace override. |
| internal/service/relational/workflows/workflow_instance.go | Adds/renames instance grace-period JSON field. |
| internal/service/relational/workflows/workflow_execution_service.go | Adds execution status-transition validation and overdue timestamping. |
| internal/service/relational/workflows/workflow_execution_service_test.go | Tests overdue transitions and overdue->completed transitions. |
| internal/service/relational/workflows/workflow_execution.go | Adds OverdueAt, step OverdueAt/DueDate, and a unique index for step executions. |
| internal/service/relational/workflows/step_execution_service.go | Adds step status-transition validation, overdue timestamping, and includes overdue in assignment queries. |
| internal/service/relational/workflows/step_execution_service_test.go | Adjusts tests for uniqueness + adds overdue transition coverage. |
| internal/service/relational/workflows/constants.go | Adds overdue to execution + step status enums. |
| internal/service/relational/workflows/workflow_definition_service.go | Validates non-negative definition grace override. |
| internal/service/relational/workflows/workflow_definition.go | Adds/renames definition grace-period JSON field. |
| internal/api/handler/workflows/workflow_step_definition_integration_test.go | Adds integration coverage for step grace-period field. |
| internal/api/handler/workflows/workflow_step_definition.go | Accepts/updates step grace-period field in API. |
| internal/api/handler/workflows/workflow_instance_integration_test.go | Adds integration coverage for instance grace-period field. |
| internal/api/handler/workflows/workflow_instance.go | Accepts/updates instance grace-period field in API. |
| internal/api/handler/workflows/workflow_execution_integration_test.go | Adjusts fixture to avoid step execution uniqueness conflicts. |
| internal/api/handler/workflows/workflow_definition_integration_test.go | Adds integration coverage for definition grace-period field. |
| internal/api/handler/workflows/workflow_definition.go | Accepts/updates definition grace-period field in API. |
| internal/api/handler/workflows/step_execution_integration_test.go | Adds test for invalid overdue->in_progress transition; adjusts fixtures for uniqueness. |
| internal/api/handler/workflows/step_execution.go | Maps invalid step transitions to 400 and routes “fail” through transition service. |
| docs/swagger.yaml | Documents new fields (overdue counts, grace-period-days, due/overdue timestamps). |
| docs/swagger.json | Generated Swagger updates for new fields. |
| docs/docs.go | Generated docs template updates for new fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/service/relational/workflows/step_execution_service.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
internal/workflow/overdue.go:1
- The function name 'markExecutionsOverdueFromStepOverdue' is repetitive with 'overdue' appearing three times. Consider renaming to 'promoteStepOverdueToExecution' or 'markExecutionsOverdueFromSteps' for better clarity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/service/relational/workflows/step_execution_service.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
internal/service/relational/workflows/step_execution_service.go:116
AddStepStartedEvidenceis called before the compare-and-swap update. If the CAS update fails (RowsAffected==0 due to a concurrent status change), this can still create “started” evidence even though the status transition did not occur. Consider only emitting evidence after a successful update (or make evidence creation idempotent / part of the same transaction) to avoid duplicate/incorrect audit records under concurrency.
case "in_progress":
updates["started_at"] = now
if s.evidenceCreator != nil {
if err := s.evidenceCreator.AddStepStartedEvidence(ctx, id); err != nil {
// Log error but don't fail the status update
s.logger.Warnw("Failed to create step started evidence",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.