More peace of mind when applying recipes or letting AI configure your site
More peace of mind when applying recipes or letting AI configure your site
Last week I attended the Drupal Dev Days in Leuven and many of the sessions and also conversations in the hallway and the contribution room were about Drupal CMS and AI.
The foundational engine behind Drupal CMS is the recipe system, which allows a bunch of configuration changes to be bundled and applied to your site. This is really cool, but it may do things you are not completely aware of. Unfortunately there is no way to “undo” a recipe. The same problem occurs if one is letting AI change configuration.
DDEV snapshots and git commits
The proper solution of course is to export the configuration and version it in git before starting to play with recipes, as well as periodically in between applying recipes to have more save points to go back to. Since recipes can also add default content and some configuration can not be deleted when there is content for it, it means that sometimes a previous git checkout of the configuration can not be imported. Therefore, the best solution is to create database backups and roll them back when needed. DDEV makes this very easy to do, and so that would be the first recommendation to address the problem and it will always work.
However, the ddev snapshots do not really give one a lot of information of what changed. The configuration in git is a lot better, but it requires an extra manual step to create the export and commit it to git. That may not be instinctive to most drupal users, especially not the target audience of Drupal CMS.
What if Drupal could help us with that?
It turns out that Drupal core introduced the concept of configuration checkpoints when recipes were added. The idea is that before a recipe is applied a checkpoint is set, then when the recipe application fails the configuration is rolled back to the checkpoint.
There is an issue for adding a command to revert to checkpoints but no work has even started.
I had the idea already at Drupalcon Barcelona 2024, but after discussions in Leuven I decided to implement a UI for the configuration checkpoints.
How does Config Checkpoint UI work?
So far the first version is very simple: It exposed some of the basic API to the UI. One can create new checkpoints, delete checkpoints and revert the site configuration to an older checkpoint. The reverting is done essentially the same way as the core command does: importing from the checkpoint storage. This is very similar to what Config Split does and the reason for which I thought it was a good idea to try.
The UI is pretty straight forward:
Reverting to a checkpoint is very similar to the familiar configuration import screen:
Future and Limitations
There are a few bugs in other projects to watch out for: Project browser does not set a checkpoint, and core has a bug when deleting checkpoints. Of course there may be lots of bugs in the new module itself. In particular one of the things I have ran into is that the uninstall validation is a bit broken, so some of the recipes can not be rolled back when they add fields that depend on a module added at the same time. I will have to check where exactly this bug is hiding. More advanced things could also be explored, for example merging checkpoints or deleting checkpoints without deleting everything that came before.
Comments
Comments
More exposed to the UI, thank you. "if one is letting AI change configuration" - can you add any links for this - how do I use AI to change configuration?
More exposed to the UI, thank you. "if one is letting AI change configuration" - can you add any links for this - how do I use AI to change configuration?
More exposed to the UI, thank you. "if one is letting AI change configuration" - can you add any links for this - how do I use AI to change configuration?
You can find Dries explaining it here https://youtu.be/nhPiL4g972A?feature=shared&t=1465 It is part of Drupal CMS 1.0
You can find Dries explaining it here https://youtu.be/nhPiL4g972A?feature=shared&t=1465 It is part of Drupal CMS 1.0
You can find Dries explaining it here https://youtu.be/nhPiL4g972A?feature=shared&t=1465 It is part of Drupal CMS 1.0
This is awesome (and greatly needed). Thanks!
This is awesome (and greatly needed). Thanks!
This is awesome (and greatly needed). Thanks!
aidengrayson787@gmail.com
aidengrayson787@gmail.com
aidengrayson787@gmail.com