feat: Add archived status for workflows older than 30 days
Summary
Implements an archived status for workflows that are older than 30 days, making them read-only in the UI while maintaining their visibility for historical reference.
Context
Following the implementation of daily time-based partitioning for the duo_workflows_checkpoints table (#470469 (closed)), we automatically drop workflow checkpoints after 30 days. This feature aligns the UI behavior with this data retention policy.
Problem Statement
Currently, workflows older than 30 days appear as if they can be restarted or modified, even though their underlying checkpoint data has been removed. This creates a confusing user experience.
Changes Made
Backend Changes:
-
Added
archivedvirtual field to Workflow model- A workflow is considered archived if it's older than 30 days
- Added
archived?method to determine archived status - Added scope
archivedto filter archived workflows
-
Updated GraphQL schema
- Added
archivedboolean field toDuoWorkflowType - Field indicates whether the workflow is archived
- Added
-
Updated API responses
- Added
archivedfield to workflow entity - REST API now includes archived status in responses
- Added
-
Added presenter logic
-
WorkflowPresenterhandles archived status calculation - Consistent archived status across all interfaces
-
Technical Implementation:
-
Archived Logic: A workflow is archived if
created_at < 30.days.ago - Performance: Uses database-level date comparison for efficiency
- Backward Compatibility: No database schema changes required
- Consistent API: Both GraphQL and REST APIs return archived status
Testing
- Added comprehensive unit tests for archived status logic
- Added GraphQL tests for archived field
- Added API tests for archived field in responses
- Added presenter tests for archived status calculation
Related Issues
Closes #555330 (closed)
Acceptance Criteria
-
Workflows older than 30 days are automatically marked as archived -
GraphQL API returns archived status -
REST API returns archived status -
Archived status is calculated consistently across all interfaces -
No performance impact on workflow queries
Future Work
Frontend changes to display archived workflows as grayed out and non-clickable will be implemented in a follow-up MR.