Epic: DO_WHILE iteration cleanup and Timeline UI rendering fixes (Q4 Roadmap 1.2)
DO_WHILE Iteration Cleanup and Timeline UI Rendering
Context
DO_WHILE tasks accumulate iterations indefinitely in the database without cleanup, causing database bloat, memory exhaustion, and production outages. Additionally, the Timeline UI becomes blank when viewing DO_WHILE workflows with nested SWITCH defaultCase or FORK_JOIN_DYNAMIC tasks, creating a critical user experience issue.
Current State vs. Desired State
Current:
- DO_WHILE iterations accumulate indefinitely in database
- No cleanup mechanism for completed iterations
- Timeline UI renders blank for DO_WHILE with nested SWITCH defaultCase
- Timeline UI renders blank for DO_WHILE with nested FORK_JOIN_DYNAMIC
- Production outages due to database bloat and memory exhaustion
Desired:
- Configurable iteration cleanup with
keepLastNparameter - Database remains stable even with 1000+ iterations
- Timeline UI renders correctly for all DO_WHILE workflow patterns
- Opt-in cleanup behavior, fully backward compatible
Technical Scope
What Needs to Be Implemented
- [ ] Implement
removeIterations()method in DO_WHILE task handler - [ ] Add ExecutionDAO dependency for database cleanup operations
- [ ] Add
keepLastNparameter to control iteration retention (configurable, opt-in) - [ ] Fix Timeline UI rendering for DO_WHILE with SWITCH defaultCase
- [ ] Fix Timeline UI rendering for DO_WHILE with FORK_JOIN_DYNAMIC
- [ ] Add configuration options for cleanup behavior
Implementation Approach
Implement iteration cleanup logic in the DO_WHILE task handler with configurable retention policy. Fix Timeline UI rendering issues for nested task scenarios. Ensure all changes are backward compatible and opt-in.
Files/Components Affected
- Backend:
DoWhile.java(add cleanup logic ~50 lines) - Backend: ExecutionDAO integration
- Frontend: Timeline UI rendering logic
- Configuration: Add cleanup parameters
Dependencies
- No blocking dependencies on other issues
- Builds foundation for Phase 2 DO_WHILE list iteration (#624)
Related Issues
- Fixes #534 - Timeline UI blank with DO_WHILE loop
- Fixes #613 - DO_WHILE database bloat and memory issues
Success Criteria
- [ ] DO_WHILE workflows can run 1000+ iterations without database bloat
- [ ] Database performance remains stable with iteration cleanup enabled
- [ ] Timeline UI renders correctly for DO_WHILE with nested SWITCH defaultCase
- [ ] Timeline UI renders correctly for DO_WHILE with nested FORK_JOIN_DYNAMIC
- [ ] Cleanup is configurable via
keepLastNparameter - [ ] Backward compatibility maintained - existing workflows work unchanged
- [ ] No performance regression for workflows not using cleanup
Testing Requirements
- [ ] Unit tests for
removeIterations()method - [ ] Integration tests with 100+ iterations verifying cleanup
- [ ] UI tests verifying Timeline rendering with SWITCH scenarios
- [ ] UI tests verifying Timeline rendering with FORK_JOIN_DYNAMIC scenarios
- [ ] Database compatibility tests across supported databases
- [ ] Performance validation for large iteration counts
- [ ] Backward compatibility tests with existing DO_WHILE workflows
Documentation Needs
- [ ] Documentation for
keepLastNparameter configuration - [ ] Configuration guide for iteration cleanup behavior
- [ ] Release notes highlighting database bloat fix
- [ ] Release notes highlighting Timeline UI rendering fixes
- [ ] Migration guide for enabling cleanup on existing workflows
- [ ] Best practices for choosing
keepLastNvalues
Notes
Backward Compatibility: Cleanup is opt-in via keepLastN parameter. Workflows without this parameter behave exactly as before, ensuring zero breaking changes.
UI Impact: Fixing Timeline rendering is critical for user experience and perception. Blank UI creates impression of broken software.
Foundation for Phase 2: This cleanup mechanism must work correctly with Phase 2's DO_WHILE list iteration feature (#624).