Implement Background CSV Export for Case Retention Logs with Async Download#8760
Merged
sanjacornelius merged 4 commits intoepic/FOUR-29101from Mar 27, 2026
Merged
Implement Background CSV Export for Case Retention Logs with Async Download#8760sanjacornelius merged 4 commits intoepic/FOUR-29101from
sanjacornelius merged 4 commits intoepic/FOUR-29101from
Conversation
Add async CSV export for case retention logs: introduces DownloadCaseRetentionLogExport job to stream query results to disk, two broadcast events (CaseRetentionLogExportReady / CaseRetentionLogExportFailed) to notify users, and controller endpoints to queue the export and serve a signed download URL. The controller uses CaseRetentionLogQueryFilter to apply the current filter when queuing and downloading; temporary signed URLs are generated with a 24-hour TTL. Frontend changes wire a button to hit the queue endpoint and session sync listeners show success/failure alerts with the download link. A feature test was added to verify job dispatch, filter propagation, and signed download streaming.
Introduce two new utilities for CaseRetention logs: - CaseRetentionLogCsvWriter: streams a query to a writable stream as CSV (no header), prepends a UTF-8 BOM, chunks results (500 rows), JSON-encodes array case_ids when present, and normalizes date columns using a csvDateColumn helper (returns empty string for nulls, formats DateTimeInterface as 'Y-m-d H:i:s'). - CaseRetentionLogQueryFilter: provides applyIfFilled (no-op for empty input) and apply methods to filter a Builder by term across id, process_id, numeric columns, and JSON case_ids; uses driver-specific SQL (ILIKE for pg, CAST to CHAR otherwise).
Contributor
|
QA server K8S was successfully deployed https://ci-0d8e061f9a.engk8s.processmaker.net |
Delete two event classes: CaseRetentionLogExportReady and CaseRetentionLogExportFailed. Both implemented ShouldBroadcastNow and broadcasted export status to a PrivateChannel for a user with payload {success, message, link}. These removals clean up legacy broadcasting events related to case retention log exports.
Introduce CaseRetentionLogExportNotification and switch the export job to send database + broadcast notifications (notifyNow) with the signed download URL instead of firing events. Update notification strings in config. Adjust frontend notification handling: de-duplicate pushes, add showNavbarAlert resolver so export/download toasts include the download link, and update the Vue notification component to consider local unread counts for badge/display. Add a test to assert the export job sends a notification containing a download URL. Minor docblock tweaks in the controller.
|
Contributor
|
QA server K8S was successfully deployed https://ci-0d8e061f9a.engk8s.processmaker.net |
mcraeteisha
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




This PR introduces a background CSV export for Case Retention Policy logs. Since exporting large datasets can be slow, this moves the process to an async job so it doesn’t block the UI. Users can trigger the export, continue working, and download the file once it’s ready, aligned with how other admin exports (e.g. security logs) behave.
Solution
GET /api/1.0/cases-retention/logs/exportDownloadCaseRetentionLogExportjobCaseRetentionLogQueryFilter) and writer (CaseRetentionLogCsvWriter)CaseRetentionLogExportReadywith a temporary signed download URL (24h TTL)CaseRetentionLogExportFailedand cleans up any partial filescase_retention_policy_logs.csv.CaseRetentionLogExportReady/.CaseRetentionLogExportFailedCasesRetentionLogsExportTestcovers:How to Test
phpunit tests/Feature/Api/CasesRetentionLogsExportTest.phpRelated Tickets & Packages
ci:deploy
Code Review Checklist