Skip to content

Test backwards compatibility of analyses with DB data#1075

Open
kasbah wants to merge 1 commit intomainfrom
kb/backwards-compat-test
Open

Test backwards compatibility of analyses with DB data#1075
kasbah wants to merge 1 commit intomainfrom
kb/backwards-compat-test

Conversation

@kasbah
Copy link
Member

@kasbah kasbah commented Feb 23, 2026

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.

@kasbah kasbah changed the title Test backwards compatibility of analyses width DB data Test backwards compatibility of analyses with DB data Feb 23, 2026
@kasbah kasbah force-pushed the kb/backwards-compat-test branch 5 times, most recently from 2307985 to 7354a87 Compare March 5, 2026 12:13
@kasbah kasbah force-pushed the kb/backwards-compat-test branch 8 times, most recently from 659bfa7 to f9c6709 Compare March 5, 2026 15:05
@kasbah kasbah marked this pull request as ready for review March 5, 2026 15:10
@kasbah kasbah requested a review from jmoggr as a code owner March 5, 2026 15:10
@kasbah kasbah requested a review from epatters March 5, 2026 15:10
@kasbah kasbah force-pushed the kb/backwards-compat-test branch 2 times, most recently from f2621bd to 322a018 Compare March 5, 2026 15:28
@kasbah kasbah marked this pull request as draft March 9, 2026 17:33
@kasbah kasbah force-pushed the kb/backwards-compat-test branch from 322a018 to a88167a Compare March 11, 2026 16:37
@kasbah kasbah marked this pull request as ready for review March 11, 2026 16:38
@epatters epatters added the build CI/CD, linting, deployments, and anything Nix label Mar 11, 2026
@jmoggr
Copy link
Collaborator

jmoggr commented Mar 16, 2026

Code looks fine and does what it sets out to do. Some notes/comments:

  • It might be good to document somewhere in this code how this is meant to be run. It's not obvious looking at the code that this will be run in a separate repo. Someone could look at this and reasonably come to the conclusion that it is dead code.

  • 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 don't love how this complicates our build and testing pipeline, since we are now splitting stuff across multiple repositories. The only idea I've had:

    • don't print the test logs and instead create private artifacts. This adds the additional step of needing to download the artifacts to view the logs when tests fail.
      • It's not obvious to me if this is better or worse than a separate repo. I lean towards better, but am sympathetic to the other perspective.

Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

@epatters epatters Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Member

@epatters epatters Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here about duplicating logic for elaborating diagrams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI/CD, linting, deployments, and anything Nix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants