Skip to content

Add Detailed Logging to Cases Retention Evaluation Job#8740

Open
sanjacornelius wants to merge 10 commits intoepic/FOUR-29101from
task/FOUR-29113
Open

Add Detailed Logging to Cases Retention Evaluation Job#8740
sanjacornelius wants to merge 10 commits intoepic/FOUR-29101from
task/FOUR-29113

Conversation

@sanjacornelius
Copy link
Contributor

@sanjacornelius sanjacornelius commented Feb 24, 2026

Issue & Reproduction Steps

This PR enhances observability of the Cases Retention evaluation job by introducing structured logging throughout its execution. Both informational messages and error conditions are now logged to improve traceability, debugging, and operational monitoring.

Solution

  • Added logging for key execution steps within the cases:retention:evaluate job
  • Added error logging to capture and surface failures during job execution

How to Test

  1. Execute the retention evaluation job for a tenant:
    TENANT=[tenant_id] php artisan cases:retention:evaluate

  2. Open the corresponding tenant logs.

  3. Verify that:

  • Execution progress messages are logged.
  • Any errors (if triggered) are properly recorded.
  • Logs provide sufficient context for troubleshooting.

Related Tickets & 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.

Note

Medium Risk
Touches case-retention deletion execution by excluding template and system-category processes and adding additional early-exit conditions, which could change what data is eligible for deletion. The rest is primarily structured logging/metrics, but it runs in a background job and could affect operations if the filtering is incorrect.

Overview
Case retention evaluation now avoids system/template processes and is more observable. The cases:retention:evaluate command filters out template processes and any process assigned to system categories (via process_category_id or category assignments), then reports how many EvaluateProcessRetentionJobs were queued.

EvaluateProcessRetentionJob adds structured start/end logging (including retention settings, cutoff dates, per-chunk deletion counts, and execution time) and explicitly skips template and system-category processes; tests add coverage to ensure retention does not run for those excluded process types.

Written by Cursor Bugbot for commit 9579d01. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Duplicate comment about retention period default
    • Removed the out-of-context duplicate comment above job count initialization and kept the single contextual comment before dispatching jobs.

Create PR

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

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.

2 participants