phetsims / density

"Density" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 6 forks source link

CT MigrationReport problem: stateSchemaIncompatible #196

Closed KatieWoe closed 4 months ago

KatieWoe commented 4 months ago

density : migration : 1.1->main : assert http://128.138.93.172/continuous-testing/ct-snapshots/1713961184254/phet-io-wrappers/migration/?sim=density&oldVersion=1.1&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22density%22%2C%22migration%22%2C%221.1-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1713961184254%22%2C%22timestamp%22%3A1713961971822%7D Assertion failed: MigrationReport problem: stateSchemaIncompatible

``` density : migration : 1.1->main : assert http://128.138.93.172/continuous-testing/ct-snapshots/1713961184254/phet-io-wrappers/migration/?sim=density&oldVersion=1.1&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22density%22%2C%22migration%22%2C%221.1-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1713961184254%22%2C%22timestamp%22%3A1713961971822%7D Assertion failed: MigrationReport problem: stateSchemaIncompatible { "clientMessages": [], "stateSchemaIncompatible": [ { "phetioID": "density.introScreen.model.blocks.blockA", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.introScreen.model.blocks.blockB", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameMass.yellowBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameMass.blueBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameMass.greenBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameMass.redBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameVolume.yellowBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameVolume.blueBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameVolume.greenBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameVolume.redBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameDensity.yellowBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameDensity.blueBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameDensity.greenBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.compareScreen.model.blockSets.sameDensity.redBlock", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set1.block1D", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set1.block1B", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set1.block1E", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set1.block1C", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set1.block1A", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set2.block2D", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set2.block2A", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set2.block2E", "problem": [ "incorrect, state schema values are not the same!!", { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE" ] }, { "type": "StateValueList", "parameterIOTypes": [], "parameterValues": [ "BLOCK", "ELLIPSOID", "VERTICAL_CYLINDER", "HORIZONTAL_CYLINDER", "CONE", "INVERTED_CONE", "DUCK" ] } ] }, { "phetioID": "density.mysteryScreen.model.blockSets.set2.block2C", "problem": [ "incorrect, state schema values are not the same!!", ```
zepumph commented 4 months ago

Some notes in https://github.com/phetsims/buoyancy/issues/101#issuecomment-2071165912

samreid commented 4 months ago

Here is a working patch that expands the definition of "compatible" parameter values from "has to be equal" to "new versions can add new members". This is working well in the density wrapper. I wrote 2 nit-picky TODOs that would be good to check in on. @zepumph can you please take next steps?

```diff Subject: [PATCH] Add ChipperVersion and ReleaseBranch to tsconfig/all, see https://github.com/phetsims/chipper/issues/1424 --- Index: common/js/migration/stateSchemaParser.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/common/js/migration/stateSchemaParser.ts b/common/js/migration/stateSchemaParser.ts --- a/common/js/migration/stateSchemaParser.ts (revision 562d5d6026aa0af352dcf75e1548fbe41940b7e9) +++ b/common/js/migration/stateSchemaParser.ts (date 1714649181077) @@ -276,7 +276,12 @@ if ( !!oldParsedStateSchema.parameterValues !== !!newParsedStateSchema.parameterValues ) { return false; } - if ( oldParsedStateSchema.parameterValues && newParsedStateSchema.parameterValues && oldParsedStateSchema.parameterValues.length !== newParsedStateSchema.parameterValues.length ) { + + // The results are compatible if the old values are a subset of the new values + if ( oldParsedStateSchema.parameterValues && newParsedStateSchema.parameterValues && + + // TODO: Why do we need an exclamation point there? See https://github.com/phetsims/density/issues/196 + !oldParsedStateSchema.parameterValues.every( oldParameter => newParsedStateSchema.parameterValues!.includes( oldParameter ) ) ) { return false; } if ( oldParsedStateSchema.orderedParameters !== newParsedStateSchema.orderedParameters ) { @@ -285,7 +290,11 @@ if ( oldParsedStateSchema.orderedParameters && !_.isEqual( oldParsedStateSchema.parameterValues, newParsedStateSchema.parameterValues ) ) { return false; } - if ( !oldParsedStateSchema.orderedParameters && !_.isEqual( new Set( oldParsedStateSchema.parameterValues ), new Set( newParsedStateSchema.parameterValues ) ) ) { + + // The results are compatible if the old values are a subset of the new values + // TODO: This looks somewhat duplicated with the new code above, see https://github.com/phetsims/density/issues/196 + if ( !oldParsedStateSchema.orderedParameters && + !oldParsedStateSchema.parameterValues.every( oldParameter => newParsedStateSchema.parameterValues!.includes( oldParameter ) ) ) { return false; } }
zepumph commented 4 months ago

I love this solution. Thanks so much. I went down a bit of a rabbit hole making sure everything was working as expected. MapIO wasn't ordered, so I fixed that. I also wrote unit tests to help boost my confidence. Anything more you want to talk about here?

samreid commented 4 months ago

@zepumph and I reviewed CT and it was very nice. We made another improvement, re-tested and it seems good. Closing.