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(orcreatedAtif not completed) + 30 days — matchingformatExportExpiresAt()andserializeDataExportRun.tsfallback 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 onexpiresAt. - 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.tsxusesformatExportExpiresAt()and displaysrun.expiresAtdirectly when present; fallback derives fromrun.completedAt ?? run.createdAt+ 30 days. - On the backend,
attik-backend/src/util/functions/dataExports/serializeDataExportRun.tspasses through storedexpiresAtvalues without correcting invalid ones, and only derives a fallback when the field is absent (samecompletedAt ?? createdAtbase). - The completion write path in
attik-backend/src/util/functions/dataExports/runDataExportJob.tssetsexpiresAttodayjs().add(30, 'day')on success alongsidecompletedAt; 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.
Scope
Backend
- Inspect how export runs are written and serialized in
attik-backend/src/util/functions/dataExports/runDataExportJob.tsandattik-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 dayswhen storedexpiresAtis 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
expiresAtvalues, including the existingtests/unit/dataExport.serializeRun.test.tspath.
Frontend
- Verify the export run list in
attik-frontend/src/app/tools/data-exports/components/ExportRunsSection.tsxdisplays the corrected expiration value in Your exports. - Confirm the same behavior in consumers of the export run API, including
DataExportsListClient.tsxandRunReportClient.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
Status: Planned
Log in to comment and vote
No comments yet
Be the first to share your thoughts.