fix(modules): do not enable a module whose installation failed
The record of a module was written before its migrations ran and never taken back when
they failed. A migration that stopped halfway — a typo in the schema, a timeout on a
modest host — left the module recorded as installed and switched on, and the cache
invalidation at the end of the operation meant the next request compiled a container with
its services and its routes in it, over half a schema. Installing again was refused with
"already installed", so the only way out was an uninstall the administrator had to think
of on their own, from a site that might no longer answer.
The record still has to come first: a module's migrations are found through it, so
without one the migrator has no directory to run. What it now carries is that the
installation was begun and did not finish. Such a module is not loaded — the registry
gives it a state of its own — while its migrations stay a source, which is what lets the
job be finished by installing again. The mark comes off once the installer of the module
has returned; a failure after that, in the assets or the demo data, leaves a working
module and a failed step, which is what those are worth.
Switching such a module on, off or updating it is refused. Uninstalling is not: it is the
way out when installing again cannot help.
The field is written only while it stands, so the state file of a site where nothing ever
failed reads as it did before, and a file from an earlier release is read as "nothing was
interrupted".
they failed. A migration that stopped halfway — a typo in the schema, a timeout on a
modest host — left the module recorded as installed and switched on, and the cache
invalidation at the end of the operation meant the next request compiled a container with
its services and its routes in it, over half a schema. Installing again was refused with
"already installed", so the only way out was an uninstall the administrator had to think
of on their own, from a site that might no longer answer.
The record still has to come first: a module's migrations are found through it, so
without one the migrator has no directory to run. What it now carries is that the
installation was begun and did not finish. Such a module is not loaded — the registry
gives it a state of its own — while its migrations stay a source, which is what lets the
job be finished by installing again. The mark comes off once the installer of the module
has returned; a failure after that, in the assets or the demo data, leaves a working
module and a failed step, which is what those are worth.
Switching such a module on, off or updating it is refused. Uninstalling is not: it is the
way out when installing again cannot help.
The field is written only while it stands, so the state file of a site where nothing ever
failed reads as it did before, and a file from an earlier release is read as "nothing was
interrupted".