Unify error structure across WorkflowInstance and TaskExecution#9
Merged
ricardozanini merged 24 commits intomainfrom Apr 29, 2026
Merged
Unify error structure across WorkflowInstance and TaskExecution#9ricardozanini merged 24 commits intomainfrom
ricardozanini merged 24 commits intomainfrom
Conversation
Add comprehensive design specification for unifying error handling between workflow instances and task executions. Key changes: - Rename WorkflowInstanceError → Error (reusable type) - Add error structure to TaskExecution domain model - Add 5 error columns to task_instances table - Update PostgreSQL trigger to extract error fields - Create ErrorFilter for GraphQL error filtering - Create IntFilter for integer field filtering - Update both WorkflowInstanceFilter and TaskExecutionFilter Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comprehensive implementation plan with 21 tasks covering: - Database schema updates (error columns + trigger) - Domain model refactoring (Error type unification) - JPA entity updates (ErrorEntity embedding) - GraphQL filter enhancements (IntFilter, ErrorFilter) - Integration tests (error structure + filtering) - Documentation updates Each task broken into 2-5 minute TDD steps with exact commands. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add 5 error columns (error_type, error_title, error_detail, error_status, error_instance) to task_instances table and update normalize_task_event() trigger to extract error fields from JSONB events. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Rename to generic Error type that can be used by both WorkflowInstance and TaskExecution domain models. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updates WorkflowInstance to use the renamed Error class instead of WorkflowInstanceError. This fixes compilation errors from Task 3. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replaces the simple errorMessage string with the complex Error object to match WorkflowInstance error structure and align with SW 1.0.0 spec. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Renames JPA entity to be generic and reusable by both WorkflowInstanceEntity and TaskInstanceEntity. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updates field type and methods to use the renamed ErrorEntity class. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…n TaskInstanceEntity Replaces the five individual error columns with an @Embedded ErrorEntity to match WorkflowInstanceEntity structure. JPA maps the embedded fields to the existing error_type, error_title, error_detail, error_status, error_instance columns. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…tityMapper Renames mapper to be generic and reusable by both WorkflowInstanceEntityMapper and TaskInstanceEntityMapper. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ityMapper Updates @Mapper uses annotation to reference the renamed ErrorEntityMapper. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds ErrorEntityMapper to @Mapper uses so TaskExecution.error field can be mapped from TaskInstanceEntity.error. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add IntFilter to support integer field filtering in GraphQL queries with eq, gt, gte, lt, lte, and in operations. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds nested ErrorFilter to support filtering on error fields (type, title, detail, status, instance). Used by both WorkflowInstanceFilter and TaskExecutionFilter. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ilter Remove simple errorMessage StringFilter and add structured ErrorFilter to enable nested error field filtering. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add error field with ErrorFilter to enable error filtering for workflow instances (was previously missing). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…rter Add addIntFilters() and addErrorFilters() methods to convert nested error filter fields to database column names. Update both convert() methods to handle error filtering. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add faulted workflow instance and failed task instance with error objects for testing error structure in GraphQL queries. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify that both workflow instance and task execution error objects are correctly exposed in GraphQL API with all error fields. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify that ErrorFilter works correctly for both workflow instances and task executions with nested field filtering. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Document Error type unification, field name mappings, and GraphQL error filtering capabilities. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Complete verification of error structure unification feature: - Clean build: BUILD SUCCESS (24.479s) - Test suite: 23/23 tests passing (57.803s) - Git status: clean working tree - Code changes: 17 files, +476 lines - All 20 implementation commits verified Feature branch ready for PR. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive documentation for KIND deployment and manual verification: - QUICK_START.md: 30-second test commands - KIND_CLUSTER_ACCESS.md: Complete cluster access guide - DEPLOYMENT_SUMMARY.md: Full deployment details and results - data-index/docs/verification/: E2E verification reports Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unifies error handling across
WorkflowInstanceandTaskExecutionto align with Serverless Workflow 1.0.0 Error specification (RFC 9457 Problem Details).Previously,
TaskExecutionhad a simpleerrorMessagestring field whileWorkflowInstancehad a complexErrorobject. This PR makes both use the same structuredErrortype with five fields:type,title,detail,status, andinstance.Changes
Database Layer
task_instancestable:error_type,error_title,error_detail,error_status,error_instancenormalize_task_event()to extract error fields from JSONB eventsDomain Model
WorkflowInstanceError→Error(reusable by both types)Errorfield toTaskExecution(replacederrorMessagestring)Storage Layer (JPA)
WorkflowInstanceErrorEntity→ErrorEntity(embeddable)ErrorEntityfield toTaskInstanceEntityWorkflowInstanceErrorEntityMapper→ErrorEntityMapperErrorEntityMapperGraphQL API
IntFilterfor integer field filteringErrorFilterfor nested error structure filteringTaskExecutionFilter: replacederrorMessagewitherrorfielderrorfield toWorkflowInstanceFilterFilterConverterto handle error filtering with all operatorsTesting
testWorkflowInstanceWithErrorStructure()- verifies error object structuretestTaskExecutionWithErrorStructure()- verifies task error structuretestErrorFiltering()- verifies filtering by error fieldsDocumentation
CLAUDE.mdwith unified error handling guidanceBreaking Changes
The
TaskExecutiontype has changed:errorMessage: Stringerror: Error(with fields:type,title,detail,status,instance)Existing clients querying
errorMessagewill need to update their queries to use the new nestederrorstructure.Before:
After:
Verification
✅ Clean build:
mvn clean install✅ All tests pass: 23/23 tests (0 failures)
✅ E2E verification in KIND cluster
✅ GraphQL error queries working
✅ Error filtering working (all operators)
✅ Database triggers extracting error fields
Test Results
eq,gte, and other operatorsRelated Issues
Closes #9 (if applicable - update issue number)
Checklist
Screenshots/Examples
GraphQL Query with Error Structure:
Error Filtering:
🤖 Generated with Claude Code