Skip to content

[WIP] EPIC / FOUR-29101: Cases Retention Policy#8734

Open
sanjacornelius wants to merge 84 commits intodevelopfrom
epic/FOUR-29101
Open

[WIP] EPIC / FOUR-29101: Cases Retention Policy#8734
sanjacornelius wants to merge 84 commits intodevelopfrom
epic/FOUR-29101

Conversation

@sanjacornelius
Copy link
Copy Markdown
Contributor

wip
ci:deploy

Issue & Reproduction Steps

Describe the issue this ticket solves and describe how to reproduce the issue (please attach any fixtures used to reproduce the issue).

Solution

  • List the changes you've introduced to solve the issue.

How to Test

Describe how to test that this solution works.

Related Tickets & Packages

  • Link to any related FOUR tickets, PRDs, or packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

mcraeteisha and others added 30 commits February 3, 2026 16:04
FOUR-29105 | Add Case Retention Configuration Section to Process Configuration (Feature-Flagged)
Implement Scheduled Case Retention Evaluation and Automated Case Deletion
@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-10ba163098.engk8s.processmaker.net

@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-10ba163098.engk8s.processmaker.net

FOUR-29116 | Add “Retention Policy” option under Admin > Logs
@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-10ba163098.engk8s.processmaker.net

Introduce CasesRetentionController with a logs() action to expose case retention policy logs. The endpoint supports text filtering, validated ordering (whitelisted columns), order direction, and paginated results (per_page default 10); when no valid order_by is provided it falls back to created_at descending. The controller uses DB::raw to transform dotted column notation into JSON extraction for ordering and returns results as an ApiCollection. Also registers the GET api/1.0/cases-retention/logs route under the existing authenticated API middleware group.
Treat case_ids as a native array across backend and frontend. Add a $casts entry on CaseRetentionPolicyLog and stop json-encoding case_ids in EvaluateProcessRetentionJob and the factory; update the unit test to assert the array value. On the UI side, introduce a dedicated CaseIdsTableCell Vue component (with preview + popover for overflow) and wire it into CasesRetentionLogs, replacing fake data with an API fetch and adjusting sorting/preview behavior.
Introduce applyLogsFilter to perform flexible searching across id, process_id, numeric columns (deleted_count, total_time_taken) and JSON case_ids, using driver-specific casting (ILIKE for pgsql, CAST(... AS CHAR) otherwise). Use request->filled('filter') and trim empty terms to avoid spurious queries. Replace the previous lowercase process_id-only filter with this broader implementation and remove unused imports (Response, DB, Log).
Connect Audit Logs UI to Case Retention API with Sorting, Search, and Overflow Handling
@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-10ba163098.engk8s.processmaker.net

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).
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.
Implement Background CSV Export for Case Retention Logs with Async Download
@processmaker-sonarqube
Copy link
Copy Markdown

@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-10ba163098.engk8s.processmaker.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants