Report export shows created time as expiration

Objective

  • Fix the Report Export Your exports list so the Expires column always shows the correct expiration date.
  • Ensure export runs display expiration as completedAt (or createdAt if not completed) + 30 days β€” matching formatExportExpiresAt() and serializeDataExportRun.ts fallback logic.
  • Correct the displayed expiration date for all rows, including rows that already have incorrect persisted values.

Background

  • Product feedback is that the Report Export list used to show expiration roughly 30 days out, but now displays the same date and time as when the export was created in the Expires column.
  • Export files are intended to remain available for 30 days, aligned with DATA_EXPORT_RUN_TTL_DAYS, S3 lifecycle behavior, and the MongoDB TTL on expiresAt.
  • Code review confirmed this is a bug, not a training or permission issue.
  • On the frontend, attik-frontend/src/app/tools/data-exports/components/ExportRunsSection.tsx uses formatExportExpiresAt() and displays run.expiresAt directly when present; fallback derives from run.completedAt ?? run.createdAt + 30 days.
  • On the backend, attik-backend/src/util/functions/dataExports/serializeDataExportRun.ts passes through stored expiresAt values without correcting invalid ones, and only derives a fallback when the field is absent (same completedAt ?? createdAt base).
  • The completion write path in attik-backend/src/util/functions/dataExports/runDataExportJob.ts sets expiresAt to dayjs().add(30, 'day') on success alongside completedAt; affected rows may still contain bad persisted values that bypass both serializer and UI fallback logic.
  • This behavior appears related to background export history introduced in ATT-1405.
  • Existing screenshot and Slack report show the user-visible regression.

Slack report

Scope

Backend

  • Inspect how export runs are written and serialized in attik-backend/src/util/functions/dataExports/runDataExportJob.ts and attik-backend/src/util/functions/dataExports/serializeDataExportRun.ts.
  • Ensure API responses for export runs return an expiration value that matches the canonical rule of (completedAt ?? createdAt) + 30 days when stored expiresAt is missing or invalid.
  • Correct behavior for rows that already contain invalid stored expiration values so they display the right expiration date.
  • Confirm consistency anywhere export run expiration is used, including attik-backend/src/util/functions/dataExports/sendDataExportReadyEmail.ts.
  • Add or update coverage for invalid stored expiresAt values, including the existing tests/unit/dataExport.serializeRun.test.ts path.

Frontend

  • Verify the export run list in attik-frontend/src/app/tools/data-exports/components/ExportRunsSection.tsx displays the corrected expiration value in Your exports.
  • Confirm the same behavior in consumers of the export run API, including DataExportsListClient.tsx and RunReportClient.tsx.
  • The implementation approach is intentionally open to engineering judgment.

Data correctness

  • This fix includes rows that are already displaying incorrect expiration dates.
  • The outcome is not limited to newly generated exports; existing incorrect rows should also display the correct expiration date as part of this work.

References

  • Slack report
  • Frontend display: attik-frontend/src/app/tools/data-exports/components/ExportRunsSection.tsx
  • API serialization: attik-backend/src/util/functions/dataExports/serializeDataExportRun.ts
  • Completion write: attik-backend/src/util/functions/dataExports/runDataExportJob.ts
  • Runs API: attik-backend/src/routes/dataExport.ts
  • Email usage: attik-backend/src/util/functions/dataExports/sendDataExportReadyEmail.ts
  • Related shipped work: ATT-1405

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

About 3 hours ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.