Description
The existing load system was quite complex, which made it hard to change. And it needed to change, in order to support Unified reference detection
This Initiative is about biting the bullet to break the existing load system into smaller parts that aren’t as difficult to change.
Status: Completed
The refactor itself has been implemented! Switch to LoadContext based loading
Champion
Benefits
- Divides and conquers the complexity of the load system.
- More robust unit tests.
- Easier to implement changes in the future.
(better tests = more confidence, less complexity = less headaches for devs) - Many implicit features of the load system become explicit.
For example, we now have a definition of the “SourceCred data directory” we didn’t have before.
Implementation Plan
Deliverables
A design document which outlines the new concepts we’ll use to break the load system into smaller parts. And plenty of PRs to implement the refactor.
Dependencies
None at the moment.
References
Discussion / trackers
- Reduce load complexity #1559
- Static or dynamic loading refactor #1506
- Remove deprecated load functionality #1629
Related refactors, used for reference
Contributions
Design doc
LoadPlan version (concept rejected)
- Backend: introduce LoadPlan
- Discourse: implement DiscourseLoader interface
- Identity: implement IdentityLoader interface
- Github: implement GithubLoader interface
- Backend: implement pluginMirrorPlan
- Backend: implement pluginGraphPlan
- Backend: implement timelineCredPlan
- Backend: implement createPlan
- API: implement loadDefaultPlan
- Use loadDefaultPlan instead of load
LoadContext version (concept accepted)
- Backend: implement PluginLoaders.declarations
- Backend: implement PluginLoaders.updateMirror
- Backend: implement PluginLoaders.createPluginGraphs
- Backend: implement PluginLoaders.contractPluginGraphs
- Backend: add ComputeFunction
- Backend: implement LoadContext
- Switch to LoadContext based loading
Prerequisite refactoring
- Use stable stringify for cred.json & graph.json in load
- Backend: create DataDirectory class
- Backend: implement MemoryCacheProvider
- Github: add CacheProvider support for fetchGithubRepo
- Github: switch to CacheProvider for fetchGithubRepo
- Github: add fetchGithubRepoFromCache
- Github: derive mirror database name from repoId
- Add WeightedGraph.overrideWeights
- Add
identity/contractIdentities
- Generate Weights from PluginDeclarations
Cleanup
- Remove deprecated load function
- Remove github/loadGithubData
- Improve test readability of loadContext and pluginLoaders