Currently, the SalesforcePushAllowedEvent::disallowPush() and SalesforcePullEvent::disallowPull() methods only allow blocking operations without
providing context about why they were blocked. This makes debugging and logging difficult when multiple event subscribers might be involved.

Proposed changes

  • Add optional array $reasons = [] parameter to both disallowPush() and disallowPull() methods
  • Add getReasons() method to both event classes to retrieve the accumulated reasons

Example usage

  // In an event subscriber
  $event->disallowPush(['Entity is archived', 'Missing required field']);

  // Later, for debugging/logging
  $reasons = $event->getReasons();
CommentFileSizeAuthor
#8 Selection_999(5202).jpg108.28 KBamitaibu

Issue fork salesforce-3543350

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

amitaibu created an issue. See original summary.

amitaibu’s picture

Status: Active » Needs review

Working on an MR. Let's see if Claude AI gets the tests close to working :)

amitaibu’s picture

Status: Needs review » Needs work

amitaibu’s picture

Status: Needs work » Needs review

Tests seem to pass on the MR, but I want to ensure it's indeed working. How do you execute those tests locally?
Maybe worth adding something like what we have on Organic groups? (provided by https://github.com/ddev/ddev-drupal-contrib)

amitaibu’s picture

Issue summary: View changes
amitaibu’s picture

Maybe worth adding something like what we have on Organic groups? (provided by https://github.com/ddev/ddev-drupal-contrib)

Added via https://www.drupal.org/project/salesforce/issues/3543367

amitaibu’s picture

StatusFileSize
new108.28 KB

Using https://www.drupal.org/project/salesforce/issues/3543367 I've confirmed tests are indeed passing locally, and they are

ddev phpunit --filter SalesforcePullEventTest 
ddev phpunit --filter SalesforcePushAllowedEventTest

phpunit tests

aaronbauman’s picture

Status: Needs review » Reviewed & tested by the community

This is great, thank you.

I would love to see a followup that adds these reasons to existing log message in modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php

And also adds logging in salesforce_push_entity_crud_mapping

I think those are the only 2 places this is invoked.

aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.