Problem/Motivation

Entity Activity Mail on 2.x-dev has two queue-worker regressions that are reproducible on Drupal 11.4.4:

  1. PrepareReportWorker::processItem() returns from the entire batch when it encounters a user who is already being processed. Any eligible users later in the same batch are skipped and their reports are not queued.
  2. ReportWorker::processItem() passes TranslatableMarkup objects to PSR-3 logger methods. Drupal 11's DrupalConsoleLogger expects a string message, so both successful and failed report delivery paths can end with TypeError: strtr(): Argument #1 ($string) must be of type string, TranslatableMarkup given.

These failures were found while testing Entity Activity 2.x-dev at commit 3484e273d87dcfd86fbc27d019ebd9181f500835 with PHP 8.3.

Steps to reproduce

  1. Enable Entity Activity Mail and configure reports to be logged.
  2. Create unsent activity logs for two eligible users.
  3. Mark the first user as already being processed, then invoke the prepare-report queue worker with both user IDs in that order.
  4. Observe that no report is queued for the second user because the worker returns instead of continuing the loop.
  5. Invoke the report worker for a valid recipient on Drupal 11, using either a successful or failed mail result.
  6. Observe the logger TypeError when the worker passes translated markup as the log message.

Proposed resolution

  • Continue to the next recipient when a user is already being processed.
  • Pass untranslated string message templates and placeholder context arrays to the logger, following Drupal logging practices.
  • Add regression coverage for a mixed processing/eligible recipient batch and for successful and failed report delivery.

Remaining tasks

  • [x] Create a merge request against 2.x with the fixes and automated regression tests.
  • [x] Confirm the GitLab CI pipeline passes.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ivrh created an issue. See original summary.

ivrh’s picture

Assigned: Unassigned » ivrh

  • ivrh committed 294ce4c0 on 2.x
    Issue #3623904 by ivrh: Fix mail queue processing and logger messages
    
ivrh’s picture

Issue summary: View changes
Status: Active » Fixed

MR !15 merged into 2.x at 294ce4c0c17637a411214586a12679edbd485e91 after merge-train pipeline #964916 passed.

  • The exact target-branch pipeline #964957 passed all blocking jobs: 845 tests, no failures, and 97.96% production PHP line coverage.
  • Regression coverage includes the mixed processing/eligible-recipient batch and the affected success, delivery-failure, and persistence-error logger paths.
  • The fixes are included in 2.0.0-beta2.

No work remains. Marking Fixed; version remains 2.x-dev.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.