Refactoring the load system

Perhaps a good moment to share some retrospect thoughts :]

Agree there’s frustration/boilerplate left. However, this initiative/refactor started because the previous version was impossible spaghetti, where all the tests would break if you change how the pipeline itself worked. (Such as breaking up the mirror+graph step into two separate steps).

Introducing such pipeline changes have gone from nightmare to doable now, for example Expose a ReferenceDetector to createPluginGraphs made a change in the pipeline.

Something that I feel became more effortful is having to declare a Loader interface and object for every plugin. While more work, I think it’s an improvement over the before-situation of directly depending on plugin-internal functionality in the load pipeline.

Another trade-off that creates more effort, is how LoadContext is required to be a “dumb” composition class, not allowed to implement any logic. It makes for way more robust and easier testing, but is also an extra step and not the most intuitive abstraction.


A main source of frustration I experience still (before the refactor as well) is how configuration values propagate in multiple formats throughout the entire system. From src/cli to src/core to src/backend to src/plugins.

Having the instance system, reworked CLI and a better configuration abstraction, I think will greatly reduce code churn here.

Possibly some of these points will be included in Productivity / Quality of Life for instance maintainers. However:

This initiative is to save time and make it easier to maintain a SourceCred instance.

I’ve deliberately not included easier / time saving for developers here. So if these further refactors are time consuming and don’t help instance maintainers much, I’m inclined to punt on it for a while.

1 Like