-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Description
As a team we would like to refactor Limber's process for parsing its configuration files so that we can spot errors earlier.
Background
It isn't always clear what configuration keys are expected. There is some help documentation, but it does not give a complete picture.
Limber has a config:generate rake task that does many things (query Sequencescape for uuids, load config files from Limber, define barcode printers, etc.) that are ultimately written to a tempary config file on disk. This yaml config file is then read in and converted to a giant Hash containing all the settings used by Limber.
In this process, the existing strongly-typed Limber and Sequencescape config is reduced to a weakly-defined nested Hash that uses Hashie to allow hash indexing using dot-notation, as used by structs and classes. While very convenient for developers, this opens the codebase up to other implementation-specific issues such as method-name collision. See #2330 for an example of this in Limber.
There are other related issues with Hashie that are better explained in the blog posts below:
- https://code.dblock.org/2017/02/24/the-demonic-possession-of-hashie-mash.html
- https://www.schneems.com/2014/12/15/hashie-considered-harmful.html
- https://nathanherald.com/posts/legacy/why-make-a-mash/
Moving away from an all-purpose settings Hash, to a strongly-typed settings configuration object would give us better confidence that the configuration/settings are correctly defined and being used, and allow for use of docstrings to provide more detail about specific settings where required, while also allowing Hashie to removed from Limber.
Acceptance Criteria
What improvements are we expecting:
- Invalid YML structure raises an error on configuration parsing - and application aborted.
- Unknown keys in YML structure raises an error on configuration parsing - and application aborted.
- Invalid values in YML structure raises an error on configuration parsing - and application aborted.
Who the primary contacts are for this work
PSD
Knowledge or Stake holders
PSD
Additional context or information
We believe that the current process of combining config files makes it difficult to achieve the acceptance criteria.