Closed bethesque closed 2 weeks ago
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1303). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.
See our documentation for more information.
I spent a while attempting to make zeitwerk work, and got stuck with problems that I couldn't fix which there were no docs for (I can't remember the specifics now). I don't think it's worth continuing with this unless we happen to get someone on the team who is very experienced in this area and is motivated to make it happen.
The consequence of this not being done is that every now and again, there is a missing require in a file that makes it to production, and depending on the file loading order, it may cause a run time issue. This doesn't happen very often however.
I am closing this for now, as it seems unlikely that we'll get to it any time in the foreseeable future.
Currently, we require files manually, and this can lead to bugs when requires are missing.
The zeitwerk code loader could be used to avoid having to do manual requires.
Good article on it here: https://www.honeybadger.io/blog/ruby-code-loader-zeitwerk/
Something that needs to be taken into account is that all the Sequel::Model classes (and all the classes that depend on them) can only be loaded after the database connection has been made, so there are the "pre db connection" files and the "post db connection files".
require "pact_broker" (no db required) => make database connection require "pact_broker/api" (db required)