-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate using project directories instead of project instances #654
Conversation
…ectories rather than project objects.
@csadorf @jennyfothergill apologies in advance if the quality isn’t up to my usual standard. It’s been hard to dedicate a significant block of time, so I’ve been working on this in very brief fits and starts and I figured at this point it would be better to just get feedback on what I had rather than wait longer. |
Codecov Report
@@ Coverage Diff @@
## master #654 +/- ##
=======================================
Coverage 78.42% 78.42%
=======================================
Files 65 65
Lines 7119 7129 +10
Branches 1564 1564
=======================================
+ Hits 5583 5591 +8
- Misses 1226 1230 +4
+ Partials 310 308 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a handful of comments. I think this looks pretty good overall. It's unfortunate that the logic for migrations is so complex, but I can't envision a simpler design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov is complaining a lot about missing tests. Maybe we can restructure the existing tests to more systematically cover those additional cases?
…ke consistent use of parsed versions.
… add tests of more exceptional cases.
Thanks for pointing this out. I've gone through the untested cases and improved test coverage where appropriate. The remaining untested cases fall into two buckets:
In general the lack of coverage just reflects that we've added migration logic before we had a need for it in anticipation of future use cases. I made these changes on master because they would have cluttered the PR actually introducing the v1->v2 migration and made them hard to review, and the lack of testability is the tradeoff. We should see that improve with #643 (and I'm sure we'll find additional bugs then, but at least the core logic in place now seems sound). There is one other change of note that I introduced. While attempting to improve coverage, I realized that because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this PR. As noted before, it's a little hard to review these changes because we don't actually have a migration defined yet. The code looks stable and general enough, and there is a significant benefit to having this merged to help unblock other work. Let's find the remaining sharp edges when we introduce a real migration!
@csadorf let me know if you'd like to re-review this. It would be fine IMO to merge this, then work out any further kinks in the context of #643 since that will give us our first real migration to stress test this with anyway, but if you see other issues that you think are worth addressing in the context of this PR we can deal with them first. |
Thanks, I will review it right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good overall, just a few minor questions.
@csadorf I'm treating our discussion at the meeting as approval and I'm going to go ahead and merge this PR now. |
Description
This PR changes the schema migration code to operate in terms of a project's root directory rather than a project class instance. Additionally, loading and checking the schema version of a project is done using a cascade of multiple schema loaders that support different schemas.
Motivation and Context
The current schema migration logic makes some easily invalidated assumptions about what operations are valid in the course of a migration. The two most problematic assumptions are that 1)
config.load_config
can load schemas of any schema version, and 2) a validProject
can be created from any schema version by simply skipping the schema compatibility check. The former is invalidated by, for instance, a change in the format of the config file like the one planned for schema version 2. The latter would be invalidated by any change to theProject
constructor that assumes the existence of certain keys in the config. The migration to schema version 2 does not immediately break this logic since we are removing project ids, not adding them (see #643 and #644), but there is no reason to assume that we will not make changes in the opposite direction in future schema versions. This PR protects us against such changes.Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary: