Add a Composer script handler which automatically uninstalls Experience Builder whenever it is updated

Created on 22 January 2025, about 1 month ago

Overview

Drupal CMS intends to include a bare-bones, locked-down, pre-release demo of Experience Builder in its forthcoming 1.1.0 release. The problem with this is that Experience Builder is still pre-alpha and does not have any update path, which introduces the possibility of Experience Builder suddenly introducing a change that breaks a Drupal CMS site that has it installed.

Proposed resolution

In discussion with @effulgentsia, me and @pameeela agreed that Drupal CMS 1.1.0 should include some kind of automation to always uninstall Experience Builder when it's being updated from any version older than 1.0.0-beta1, which is when Experience Builder will likely begin to maintain a stable update path.

At the moment, this automation takes the form of a Composer script handler that is part of the Drupal CMS project template. It's in this file and this one, which are in our 1.x (development) branch.

@catch has, however, rightfully pointed out that putting it there makes it non-updatable, since the project template is not something that is ever "updated" like any other dependency. So the script handler needs to be part of some other package.

We could split it out into its own independent package, but that seems pointless -- this script handler is only meant to facilitate a read-only demo of Experience Builder for sites that want to get an early taste of it. Having it be its own package adds maintenance burden for us, and it means we could never remove it from the internet when it becomes obsolete.

The other option is to have the script handler be a thing shipped by Experience Builder itself. This is the best option, in my option -- it allows the script handler to be fully updatable, and it also means Experience Builder can remove it outright before tagging 1.0.0-beta1. The script handler would be exposed by an autoload section of Experience Builder's composer.json, but would not otherwise be part of its runtime code.

This will allow Experience Builder to support Drupal CMS's demo use case, and easily get rid of it when we're ready for prime time.

User interface changes

None.

✨ Feature request
Status

Active

Version

0.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Merge request !575Add demo script handler β†’ (Open) created by phenaproxima
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    about 1 month ago
    Total: 941s
    #402246
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Success
    about 1 month ago
    Total: 846s
    #402252
  • πŸ‡¬πŸ‡§United Kingdom longwave UK
        // Delete all xb_page entities and uninstall XB.
        $run_drush(['entity:delete', 'xb_page']);
        $run_drush(['pm:uninstall', 'experience_builder', '--yes']);
    

    Is this guaranteed to uninstall Experience Builder? What happens if there are other dependencies on XB - let's say someone has built a view of XB pages? I feel like this risks data loss if we are just force uninstalling the module with no questions asked.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    That's more a question for @effulgentsia to answer, I think, but "complete data loss" is precisely the idea. Since XB's data storage model can't be considered stable until beta1, we want to wipe everything out.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Also this won't work for people like me who run Drupal inside ddev but who also run composer on the host, there is no workaround for that I guess.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    I think forcing data loss with no warning is surprising behaviour and should be avoided. At least we should ask "we are going to reinstall Experience Builder, are you sure you want to continue" - maybe just drop the --yes from the uninstall?

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA
    1. I agree with #10

      I think MR works well for Drupal CMS but it seems like getting testers for XB to be a pain.

      This seems like a general problem that if you are using a Alpha version of the module each update is going to risk problems, maybe very bad ones, when you update the module. But that seems to risk you would also take with using any alpha module.

      Say we have testers that are using Alpha1 they have made some complex pages, global templates changes, global css, and code component changes.

      They find a small UX bug and we fix it in Alpha2. They want to test Alpha2 and give feedback. By default they would have to rebuild everything that they had already done. what if we they rebuild everything and bug is not there. Is it not there because fixed in Alpha2 or is it not there because when they rebuilt everything they did it just slightly different and they didn't hit the bug and won't have hit in Alpha2 either.

      Upgrading between Alphas doesn't guarantee that we will break the data model and your site won't work. It just means it might. If we did this I can't imagine anyone would try to do anything complex with the alpha versions of XB, especially after we wiped their data the first time(maybe they didn't pay close attention during composer update). I think we do want risk takers to try complex with XB. That we would more confident to move onto alphas

    2. what happens if someone updates XB with Automatic Updates? They wouldn't see an option to not uninstall even if we added, right? I could see there being a large intersection of people who don't want to deal with Composer, so they use AU, and those who don't want to deal with twig templates, so they use XB.
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    I chatted with @phenaproxima about this. It seems like if the script is updated to only uninstall if experience_builder.demo_mode is true, then wiping with each update is ok. ✨ Add a code-only (not changeable via UI) "demo mode" flag that Drupal CMS can set and that future XB MRs can use to constrain XB functionality Active explicitly added this for Drupal CMS so I can't imagine others will use it. It seems like it is up to Drupal CMS to provide the message around.

    Just to be careful I think we should update the description of demo_mode in config/schema/experience_builder.schema.yml to explain this behavior. This will avoid people finding this setting and not understanding what the implications of setting is, and this issue is definitely adding more implications for setting this flag.

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    Need to check demo_mode and update demo mode description

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA
  • πŸ‡¬πŸ‡§United Kingdom catch

    This seems like a general problem that if you are using a Alpha version of the module each update is going to risk problems, maybe very bad ones, when you update the module. But that seems to risk you would also take with using any alpha module.

    I agree with this for someone that installs the alpha module themselves.

    For Drupal CMS users, the XB demo is going to be promoted as part of the default install, and I think maybe even XB was going to be installed by default without any user intervention at all.

    That means that production Drupal CMS sites would have XB enabled, and then if there are breaking changes (like a config entity type ceasing to exist), their sites may not be updateable, at all. e.g. not just loss of XB data, but a hosed site that fatal errors after update with no obvious way to restore.

    This is where the uninstall and reinstall idea came from, to avoid that situation and instead restore XB to a blank slate every time it's updated.

    But that approach then creates its own various problems that now XB keeps getting uninstalled and reinstalled, needing the composer script because that's the only place to intervene etc.

    I would re-iterate again, that I think all of this could be avoided if the energy spent here instead went into an online demo with tugboat or similar, until XB actually can provide an upgrade path for its config (e.g. reaches beta) and doesn't need these extreme measures. Trying to create an ephemeral demo on what are supposed to be production installs is just inviting catastrophic data loss or inability to update, in the various myriad forms those issues could appear.

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    @catch my general concern from #11 that you were responding to in #15, is not an issue for me if we implement #12. Basically just only do this for demo_mode, which I think practically this means only do this for Drupal CMS.

    I agree with this for someone that installs the alpha module themselves.

    So if this only affects demo_mode/Drupal CMS then I think others can use the alpha module like any other alpha module

    ...Trying to create an ephemeral demo on what are supposed to be production installs is just inviting catastrophic data loss or inability to update, in the various myriad forms those issues could appear.

    I haven't been involved in the discussion around but I can see your point.

    Is there another issue where I can see the discussion?. If demo_mode is done I want to see if there is anything we can do to lesson the risk in XB itself

  • πŸ‡¬πŸ‡§United Kingdom catch
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    This might be a wontfix (yay!) in the likely event that πŸ“Œ Remove the XB demo Active comes to pass. Postponing until we know the status of that issue.

Production build 0.71.5 2024