Test backwards compatibility of analyses with DB data#1075
Test backwards compatibility of analyses with DB data#1075
Conversation
2307985 to
7354a87
Compare
659bfa7 to
f9c6709
Compare
f2621bd to
322a018
Compare
322a018 to
a88167a
Compare
|
Code looks fine and does what it sets out to do. Some notes/comments:
|
There was a problem hiding this comment.
Thanks Kaspar. It will be important for us to improve our testing infrastructure as the system grows in complexity and I'm glad you've started to work on that.
Taken together, though, I think what my comments below show is that our system is not currently architected to make this testing easy or convenient. I suspect the problem is that too much of the pipelines model -> analysis and model -> diagram -> analysis are stuck in components or are otherwise not reusable in a standalone script. We should fix that before proceeding because as is I fear that this code will itself become a maintenance problem. I'd be happy to help think through what refactoring is needed if you like.
There was a problem hiding this comment.
Jason wrote:
infrastructure/scripts/dump-notebook-fixtures uses bash and the JSON document snapshots in the DB. We'd like to be moving away from both. It feels like something that ought to be re-written in rust, since that would get rid of the bash and allow us to operate on the automerge documents instead of the snapshots.
I won't block the PR on it, but I agree with Jason's comment. Another advantage to writing it in Rust is that we'd check that the SQL queries are valid at compile time.
| runs the analysis. It exercises the same WASM deserialization path as the | ||
| component would at runtime. | ||
| */ | ||
| run?: (model: DblModel, data: T) => unknown; |
There was a problem hiding this comment.
If we're going down this route, then rather than adding a duplicative, optional field that people have to know about and remember to set, we should refactor the analyses to have a uniform interface based on run or similar. After all, every analysis we have does run something and we already have a semi-standardized set of verbs like simulate and check.
This might also help with integrating web workers in a uniform way (#1105) but I'm less sure about that.
| instantiated, | ||
| theory.theory, | ||
| modelRefId, | ||
| ); |
There was a problem hiding this comment.
I don't like that we've had to duplicate all this logic for migrating and elaborating the model here. That logic has often changed in the past and it's likely to continue to change in the future.
|
|
||
| const compiledDiagram = elaborateDiagram(diagramJudgments, theory.theory); | ||
|
|
||
| compiledDiagram.inferMissingFrom(compiledModel); |
There was a problem hiding this comment.
Ditto here about duplicating logic for elaborating diagrams.
This adds a test for backwards compatibility of analyses. We will run this test on production data in a private Github repo. I added an SSH key for that private Github repo to access production.