{ "uuid": [ { "value": "4e0d5cba-13d4-497e-a320-d1236df4dce2" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:00:20+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "Defining boundaries between custom Drupal modules" } ], "created": [ { "value": "2024-02-09T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:20+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2024\/02\/09\/defining-boundaries-between-custom-drupal-modules", "langcode": "en" } ], "body": [ { "value": "\n

I recently made a change to a Drupal project with several custom modules.<\/p>\n\n

As part of the change, there was a method that was no longer being used, so I went ahead and removed it.<\/p>\n\n

There were no tests for this part of the codebase, and the existing tests were still passing.<\/p>\n\n

My change was successfully finished and deployed, including removing the unused method.<\/p>\n\n

A few days later, we noticed cron jobs were no longer running on the website.<\/p>\n\n

The method I'd removed was attempting to be called from within a different module.<\/p>\n\n

Because it no longer existed, it was causing an error and stopping the cron job from running successfully.<\/p>\n\n

When I re-added the method, the cron jobs worked again.<\/p>\n\n

There were no dependencies<\/code> set in either module's .info.yml file, though that would only prevent you from uninstalling either module.<\/p>\n\n

It wouldn't prevent me from deleting code used by another module.<\/p>\n\n

Here's the thing<\/h2>\n\n

This is why I've been experimenting with architectural testing<\/a>. To ensure that modules only use their own code and to start enforcing layers within each module.<\/p>\n\n

Then, if I had the same situation again, I'd know straight away that there was an issue and not have to wait for the bug to be deployed to production.<\/p>\n\n ", "format": "full_html", "processed": "\n

I recently made a change to a Drupal project with several custom modules.<\/p>\n\n

As part of the change, there was a method that was no longer being used, so I went ahead and removed it.<\/p>\n\n

There were no tests for this part of the codebase, and the existing tests were still passing.<\/p>\n\n

My change was successfully finished and deployed, including removing the unused method.<\/p>\n\n

A few days later, we noticed cron jobs were no longer running on the website.<\/p>\n\n

The method I'd removed was attempting to be called from within a different module.<\/p>\n\n

Because it no longer existed, it was causing an error and stopping the cron job from running successfully.<\/p>\n\n

When I re-added the method, the cron jobs worked again.<\/p>\n\n

There were no dependencies<\/code> set in either module's .info.yml file, though that would only prevent you from uninstalling either module.<\/p>\n\n

It wouldn't prevent me from deleting code used by another module.<\/p>\n\n

Here's the thing<\/h2>\n\n

This is why I've been experimenting with architectural testing<\/a>. To ensure that modules only use their own code and to start enforcing layers within each module.<\/p>\n\n

Then, if I had the same situation again, I'd know straight away that there was an issue and not have to wait for the bug to be deployed to production.<\/p>\n\n ", "summary": null } ] }