[go: up one dir, main page]

Skip to content

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:

  1. Added archived virtual 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 archived to filter archived workflows
  2. Updated GraphQL schema

    • Added archived boolean field to DuoWorkflowType
    • Field indicates whether the workflow is archived
  3. Updated API responses

    • Added archived field to workflow entity
    • REST API now includes archived status in responses
  4. Added presenter logic

    • WorkflowPresenter handles 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.

Merge request reports

Loading