Answer the question
In order to leave comments, you need to log in
How to track changes in the logic of the code in third-party modules?
First, a rather long introduction to make it clear what the problem is.
There is a site that hosts text materials in the form of articles. An article is just a title, text, and an id (slug). There is a control panel for creating, editing and deleting articles. Article management is moved to a separate module, which is done by external developers.
The article module is connected to the site (main application), and event handlers can be hung on the events of this module. For example, so that when adding an article, the site map, search index, etc. are automatically updated.
Once upon a time, the functionality of notifying all site users when a new article was added was added. As soon as a new article is added in the admin panel, the articles module emits a certain event (article_create
). The code of the main site, subscribed to this event, starts sending notifications to all users that a new article has been released (for example, by e-mail or via browser notifications).
All this worked well and for a long time, and then one day a new functionality was added to the articles module: the articles got a is_published
"published / hidden" flag (published by default). Now the article can first be created as a draft, which is not visible to users, and later edited and published.
However, no changes were made in the code of the main site (stupidly forgot because of prescription). Module tests passed correctly. Tests of the main application - too. And the situation became possible when the article is created, the event is article_create
emitted, but the flagis_published
this article is set to false, and no one needs to be notified about such an article. However, the code subscribed to this event was not changed, and as a result, a notification about the draft article was sent to users.
That is, it is obvious that there was an inconsistency between the logic of the external module, where the isPublished flag was added, and the code of the main application using this module, in which no logic refinements associated with this flag were added.
Actually the question is: how, with the help of what possible tests or architectural approaches, it would be possible to identify and prevent such a problem? In the direction of what topic to dig? It is clear that this may be a communication failure between the developers of the module and the main site and a mistake by the developers of the main site. But are there any programming approaches that will show that the logic of the external module has changed, but the logic of the application using it has not?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question