7.8 KiB
WorkflowTaskExecution Cleanup - Complete Removal of Deprecated Code
Date: 2026-01-27
Status: ✅ Complete
Type: Code Cleanup (Following Consolidation)
Summary
Successfully removed all deprecated code related to the workflow_task_execution table consolidation. The WorkflowTaskExecutionRepository and related types have been completely eliminated from the codebase, with no backward compatibility layer maintained.
Rationale
As a pre-production project with no users, deployments, or stable releases, we removed all deprecated code immediately rather than maintaining it through a deprecation period. This approach:
- ✅ Keeps the codebase clean and focused
- ✅ Prevents accumulation of technical debt
- ✅ Eliminates confusion about which API to use
- ✅ Reduces maintenance burden
- ✅ Makes the codebase easier for new developers to understand
Git history preserves the old implementation for reference if needed.
What Was Removed
Code Deletions
File: crates/common/src/repositories/workflow.rs
- ❌ Removed
WorkflowTaskExecutionRepositorystruct (219 lines) - ❌ Removed
CreateWorkflowTaskExecutionInputtype - ❌ Removed
UpdateWorkflowTaskExecutionInputtype - ❌ Removed all trait implementations (
Repository,FindById,List,Create,Update,Delete) - ❌ Removed all deprecated methods (
find_by_workflow_execution,find_by_task_name, etc.)
File: crates/common/src/models.rs
- ❌ Removed
WorkflowTaskExecutiontype alias
File: crates/common/src/repositories/mod.rs
- ❌ Removed deprecated
pub use workflow::WorkflowTaskExecutionRepository
File: crates/common/src/workflow/mod.rs
- ❌ Removed deprecated
pub use crate::repositories::WorkflowTaskExecutionRepository
Documentation Deletions
- ❌
CONSOLIDATION_SUMMARY.md- Temporary file, work complete - ❌
NEXT_STEPS.md- Temporary file, work complete - ❌
PARENT_FIELD_ANALYSIS.md- Temporary file, work complete - ❌
docs/examples/workflow-migration.sql- Showed old schema - ❌
docs/workflow-models-api.md- Documented old API
Code Updates
File: crates/common/src/workflow/registrar.rs
- Updated cascade comment to remove reference to
workflow_task_executiontable
File: crates/executor/src/workflow/registrar.rs
- Updated cascade comment to remove reference to
workflow_task_executiontable
File: crates/api/tests/helpers.rs
- Removed attempt to delete from non-existent
workflow_task_executiontable
File: .rules
- Updated architectural changes section to note cleanup completion
File: docs/migrations/workflow-task-execution-consolidation.md
- Updated backwards compatibility section to note deprecated code removed
- Changed timeline to reflect completion
File: CHANGELOG.md
- Added comprehensive entry documenting all removals
Current State
API Usage
All workflow task operations now use ExecutionRepository with the workflow_task JSONB field:
// Creating a workflow task execution
use attune_common::repositories::{ExecutionRepository, Create};
use attune_common::models::WorkflowTaskMetadata;
let workflow_task = WorkflowTaskMetadata {
workflow_execution: workflow_exec_id,
task_name: "my_task".to_string(),
task_index: None,
task_batch: None,
max_retries: 3,
timeout_seconds: Some(300),
retry_count: 0,
next_retry_at: None,
timed_out: false,
};
let input = CreateExecutionInput {
action: action_id,
rule: Some(rule_id),
workflow_task: Some(workflow_task), // ← Workflow metadata here
// ... other fields
};
let execution = ExecutionRepository::create(&pool, input).await?;
Query Methods
All workflow-specific queries available through ExecutionRepository:
find_by_workflow_execution(workflow_execution_id)- Get all tasks for a workflowfind_workflow_task(workflow_execution_id, task_name)- Get specific taskfind_pending_retries()- Get tasks awaiting retryfind_timed_out()- Get timed-out tasksfind_all_workflow_tasks()- Get all workflow tasksfind_non_workflow_executions()- Get non-workflow executions
Verification
Compilation Check
cargo check --workspace
# Result: ✅ Success with zero deprecation warnings
Search for Deprecated Types
grep -r "WorkflowTaskExecution" --include="*.rs"
# Result: ✅ No matches (except "WorkflowExecutionState" which is unrelated)
Test Status
- ✅ All workspace crates compile successfully
- ✅ No deprecation warnings
- ✅ Test helpers updated
- ✅ Repository tests pass
Impact
Breaking Changes
- ❌
WorkflowTaskExecutionRepository- NO LONGER AVAILABLE - ❌
WorkflowTaskExecutiontype - NO LONGER AVAILABLE - ❌
CreateWorkflowTaskExecutionInput- NO LONGER AVAILABLE - ❌
UpdateWorkflowTaskExecutionInput- NO LONGER AVAILABLE
Migration Path
All code must use ExecutionRepository with workflow_task field. See:
docs/migrations/workflow-task-execution-consolidation.md- Complete migration guidedocs/execution-hierarchy.md- Execution model documentation
Benefits
- ✅ Cleaner codebase with single source of truth
- ✅ No confusion about which API to use
- ✅ Reduced code complexity (219 lines removed)
- ✅ No deprecated warnings cluttering builds
- ✅ Easier onboarding for new developers
Files Modified
Code Changes (11 files)
crates/common/src/repositories/workflow.rs- Removed deprecated section (219 lines)crates/common/src/repositories/mod.rs- Removed deprecated exportcrates/common/src/models.rs- Removed type aliascrates/common/src/workflow/mod.rs- Removed re-exportcrates/common/src/workflow/registrar.rs- Updated commentcrates/executor/src/workflow/registrar.rs- Updated commentcrates/api/tests/helpers.rs- Removed old table deletioncrates/common/src/repositories/execution.rs- Addedworkflow_taskfield to structs and updated all SQL queriescrates/common/tests/execution_repository_tests.rs- Addedworkflow_task: Noneto 26 test fixturescrates/common/tests/inquiry_repository_tests.rs- Addedworkflow_task: Noneto 20 test fixturescrates/executor/tests/policy_enforcer_tests.rs- Addedworkflow_task: Noneto test fixturecrates/executor/tests/fifo_ordering_integration_test.rs- Addedworkflow_task: Noneto test fixturecrates/api/tests/sse_execution_stream_tests.rs- Addedworkflow_task: Noneto test fixturecrates/api/src/dto/trigger.rs- Added missingconfigfield to test fixture
Documentation Changes (4 files)
.rules- Updated architectural changesdocs/migrations/workflow-task-execution-consolidation.md- Updated statusCHANGELOG.md- Added comprehensive removal entryCLEANUP_SUMMARY_2026-01-27.md- This summary document
Files Deleted (5 files)
CONSOLIDATION_SUMMARY.mdNEXT_STEPS.mdPARENT_FIELD_ANALYSIS.mddocs/examples/workflow-migration.sqldocs/workflow-models-api.md
Conclusion
The cleanup is complete. All deprecated code has been removed, all test files have been updated with the workflow_task field, and the project compiles successfully with zero deprecation warnings. The codebase is now fully transitioned to the consolidated model where workflow task metadata is stored in the execution.workflow_task JSONB column.
The workflow_task_execution table and its associated code are no longer part of the project - use git history if you need to reference the old implementation.
Build Status
- ✅
cargo check --workspace- Success with only unrelated warnings - ✅ All workspace crates compile
- ✅ Zero deprecation warnings
- ✅ All test files updated and compile successfully
Next Step: Delete this summary file after reading. It's served its purpose and the information is now in CHANGELOG.md and .rules.