Fix silent no-op in Queue::addJob when task does not queue a job#478
Merged
dereuromark merged 1 commit intomasterfrom Apr 22, 2026
Merged
Fix silent no-op in Queue::addJob when task does not queue a job#478dereuromark merged 1 commit intomasterfrom
dereuromark merged 1 commit intomasterfrom
Conversation
AddInterface::add() returns void and may silently skip queuing a job when required configuration is missing — most notably EmailTask, which does nothing when Config.adminEmail is not set. Previously the controller showed a green success flash regardless, making it look like the admin UI had queued a job when it hadn't. Now we count QueuedJobs before/after invoking the task. If the count did not increase, we show an error flash pointing the operator at the likely config gap, instead of falsely reporting success.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #478 +/- ##
============================================
- Coverage 77.22% 77.14% -0.08%
- Complexity 949 950 +1
============================================
Files 45 45
Lines 3196 3216 +20
============================================
+ Hits 2468 2481 +13
- Misses 728 735 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Problem
The admin UI has a "Trigger Jobs" panel that lets operators add demo jobs via
Queue::addJob(). For tasks implementingAddInterface, the action calls$object->add(null)and then unconditionally shows$this->Flash->success('Job X added').But
add()returnsvoid. Some tasks silently do nothing when required configuration is missing. The canonical case isEmailTask::add():When
Config.adminEmailis not set:add()writes a warning via$this->io(ConsoleIo — invisible in a web request)Result: the operator sees "Job Queue.Email added" but no row appears in the queue. Very confusing to debug.
Fix
Measure the
QueuedJobscount before and after invoking the task. If the count didn't change, show an error flash instead of a success flash — and point the operator at the likely config gap.This keeps
AddInterface::add()non-breaking (stillvoid). It's a small count delta check that handles any future task with similar silent-no-op behavior.