phetsims / natural-selection

"Natural Selection" is an educational simulation in HTML5, by PhET Interactive Simulations
GNU General Public License v3.0
3 stars 7 forks source link

CT: Error: Assertion failed: counts out of sync #361

Closed pixelzoom closed 3 months ago

pixelzoom commented 3 months ago

This CT error started at 5/1/2024 2:58:57pm. It's present on every CT cycle since then. I'm still unable to understand this "mismatched index" type of error, so assigning to @zepumph for assistance.

natural-selection : migration : 1.5->main : dev
http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=dev&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D
Uncaught Error: Assertion failed: mismatched index, possible start/end mismatch. Likely this is downstream of another error, try pausing on caught exceptions.
Error: Assertion failed: mismatched index, possible start/end mismatch. Likely this is downstream of another error, try pausing on caught exceptions.
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at assert (dataStream.ts:299:14)
at end (PhetioObject.ts:514:29)
at phetioEndEvent (phetioCommandProcessor.ts:254:17)
[URL] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1714595909807%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Ddev%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1714595909807%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Ddev%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D
[ATTACHED]
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=dev&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D
[ATTACHED]
[NAVIGATED] about:blank
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/studio/?sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D&phetioMigrationReport=dev&fuzz&locales=*
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/natural-selection/natural-selection_en.html?brand=phet-io&ea&postMessageOnError&sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D&phetioMigrationReport=dev&fuzz&locales=*&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/wrappers/studio/?phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D&phetioMigrationReport=dev&fuzz&exposeStandardPhetioWrapper
[CONSOLE] enabling assert
[ATTACHED]
[NAVIGATED] about:blank
[NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/natural-selection_all_phet-io_debug.html?ea&postMessageOnError&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1714595909807%22%2C%22timestamp%22%3A1714596223750%7D&phetioMigrationReport=dev&fuzz&exposeStandardPhetioWrapper&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[CONSOLE] continuous-test-wrapper-load
[CONSOLE] Dev Report: Congratulations, there are no reported problems
[CONSOLE] Assertion failed: counts out of sync
[CONSOLE] Assertion failed: mismatched index, possible start/end mismatch. Likely this is downstream of another error, try pausing on caught exceptions.
[PAGE ERROR] Error: Error: Assertion failed: mismatched index, possible start/end mismatch. Likely this is downstream of another error, try pausing on caught exceptions.
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at DataStream.end (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/phet-io/js/dataStream.js:253:15)
at PhetioCommandProcessor.phetioEndEvent (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/tandem/js/PhetioObject.js:439:30)
at http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/phet-io/js/phetioCommandProcessor.js:135:18
[PAGE ERROR] Error: Error: Assertion failed: counts out of sync
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/createBunnyArray.js:49:15
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/Emitter.js:52:22)
at http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/createObservableArray.js:112:58
at Proxy.setNotificationsDeferred (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/createObservableArray.js:420:37)
at http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/createObservableArray.js:241:27
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
[PAGE ERROR] Error: Error: Assertion failed: mismatched index, possible start/end mismatch. Likely this is downstream of another error, try pausing on caught exceptions.
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at DataStream.end (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/phet-io/js/dataStream.js:253:15)
at PhetioCommandProcessor.phetioEndEvent (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/tandem/js/PhetioObject.js:439:30)
at http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/phet-io/js/phetioCommandProcessor.js:135:18
[CONSOLE] Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1
[PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15)
at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20)
at IntroModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26)
at IntroModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10)
at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15)
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/Emitter.js:52:22)
at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23)
[CONSOLE] continuous-test-wrapper-error
[CONSOLE] continuous-test-wrapper-error
[PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15)
at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20)
at IntroModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26)
at IntroModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10)
at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15)
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/Emitter.js:52:22)
at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23)
[CONSOLE] continuous-test-wrapper-error
[CONSOLE] Assertion failed: there should only be 1 live bunny
[PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at IntroModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15)
at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29)
at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17)
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/Emitter.js:52:22)
at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23)
at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16)
at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
[PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/assert/js/assert.js:28:13)
at IntroModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15)
at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29)
at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17)
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/Emitter.js:52:22)
at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23)
at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16)
at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1714595909807/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
[CONSOLE] continuous-test-wrapper-error

id: "Bayes Node Puppeteer"
Snapshot from 5/1/2024, 2:38:29 PM
samreid commented 3 months ago

@zepumph and I will investigate this

zepumph commented 3 months ago

Likely similar to the current cck problem. from observable array state changes. Ill take a look.

zepumph commented 3 months ago

Seems related to https://github.com/phetsims/phet-io/issues/1661. I'll fix it up next week. Thanks for the report.

The assertion that fails things is:

[CONSOLE] Assertion failed: counts out of sync

That is right where we were working in that issue. My best guess right now is that we will need a solution similar to

https://github.com/phetsims/gas-properties/blob/c63b7615f90182ae5e9f63ef3844130a387af109/js/common/model/ParticleSystem.ts#L164-L171

Since now there is time between when ObservableArrays have their new values set, and then later when notifications about them occur.

pixelzoom commented 3 months ago

My best guess right now is that we will need a solution similar to

https://github.com/phetsims/gas-properties/blob/c63b7615f90182ae5e9f63ef3844130a387af109/js/common/model/ParticleSystem.ts#L164-L171

How timely... and unfortunate. I'm working on instrumenting particles in gas-properties, and (less than 5 minutes ago) was scratching my head about that very bit of code. I still don't understand it, why it's only needed (or present, anyway) in 1 of 2 particle systems, and I'll need to do a deep dive into the issue noted in the code comments, https://github.com/phetsims/gas-properties/issues/178.

zepumph commented 3 months ago

@samreid and my proposal is this, but we want to sync discuss with @pixelzoom before committing.

FYI issue renamed after changes from https://github.com/phetsims/phet-io/issues/1986

```diff Subject: [PATCH] fdsaf --- Index: js/common/model/createBunnyArray.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/js/common/model/createBunnyArray.ts b/js/common/model/createBunnyArray.ts --- a/js/common/model/createBunnyArray.ts (revision c1ca0613815c700922cde046dcf963e0cf51abbe) +++ b/js/common/model/createBunnyArray.ts (date 1715027082794) @@ -15,6 +15,7 @@ import naturalSelection from '../../naturalSelection.js'; import Bunny from './Bunny.js'; import BunnyCounts from './BunnyCounts.js'; +import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js'; // Additional properties that will be added to ObservableArray type AdditionalProperties = { @@ -57,14 +58,20 @@ // Update counts when a bunny is added. removeItemAddedListener is not necessary. bunnyArray.addItemAddedListener( bunny => { - countsProperty.value = countsProperty.value.plus( bunny ); - assert && assert( countsProperty.value.totalCount === bunnyArray.length, 'counts out of sync' ); + + if ( !isSettingPhetioStateProperty.value ) { + countsProperty.value = countsProperty.value.plus( bunny ); + assert && assert( countsProperty.value.totalCount === bunnyArray.length, 'counts out of sync' ); + } } ); // Update counts when a bunny is removed. removeItemAddedListener is not necessary. bunnyArray.addItemRemovedListener( bunny => { - countsProperty.value = countsProperty.value.minus( bunny ); - assert && assert( countsProperty.value.totalCount === bunnyArray.length, 'counts out of sync' ); + + if ( !isSettingPhetioStateProperty.value ) { + countsProperty.value = countsProperty.value.minus( bunny ); + assert && assert( countsProperty.value.totalCount === bunnyArray.length, 'counts out of sync' ); + } } ); bunnyArray.dispose = () => {
zepumph commented 3 months ago
Error: Assertion failed: counts out of sync
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13)
at assert (createBunnyArray.ts:67:14)
at listener (TinyEmitter.ts:213:6)
at notifyLoop (TinyEmitter.ts:196:13)
at emit (Emitter.ts:64:21)
at emit (createObservableArray.ts:169:58)
at (createObservableArray.ts:502:38)
at setNotificationsDeferred (createObservableArray.ts:318:26)
at listener (TinyEmitter.ts:213:6)
at notifyLoop (TinyEmitter.ts:196:13)
zepumph commented 3 months ago
natural-selection : migration : 1.5->main : assert
http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D
Assertion failed: counts out of sync
Error: Assertion failed: counts out of sync
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13)
at assert (createBunnyArray.ts:67:14)
at listener (TinyEmitter.ts:213:6)
at notifyLoop (TinyEmitter.ts:196:13)
at emit (Emitter.ts:64:21)
at emit (createObservableArray.ts:169:58)
at (createObservableArray.ts:502:38)
at setNotificationsDeferred (createObservableArray.ts:318:26)
at listener (TinyEmitter.ts:213:6)
at notifyLoop (TinyEmitter.ts:196:13)
[URL] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Dassert%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Dassert%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D
[ATTACHED]
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D
[ATTACHED]
[NAVIGATED] about:blank
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/studio/?sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D&phetioMigrationReport=assert&fuzz&locales=*
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/natural-selection/natural-selection_en.html?brand=phet-io&ea&postMessageOnError&sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D&phetioMigrationReport=assert&fuzz&locales=*&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/wrappers/studio/?phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D&phetioMigrationReport=assert&fuzz&exposeStandardPhetioWrapper
[CONSOLE] enabling assert
[ATTACHED]
[NAVIGATED] about:blank
[NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/natural-selection_all_phet-io_debug.html?ea&postMessageOnError&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025960284%7D&phetioMigrationReport=assert&fuzz&exposeStandardPhetioWrapper&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[CONSOLE] continuous-test-wrapper-load
[CONSOLE] Assertion failed: counts out of sync
[PAGE ERROR] Error: Error: Assertion failed: counts out of sync
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13)
at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/createBunnyArray.js:49:15
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22)
at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:111:58
at Proxy.setNotificationsDeferred (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:419:37)
at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:240:27
at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14)
[CONSOLE] continuous-test-wrapper-error

id: "Sparky Node Puppeteer"
``` Snapshot from 5/6/2024, 1:55:07 PM ---------------------------------- natural-selection : migration : 1.5->main : dev http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=dev&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D Assertion failed: counts out of sync Error: Assertion failed: counts out of sync at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at assert (createBunnyArray.ts:67:14) at listener (TinyEmitter.ts:213:6) at notifyLoop (TinyEmitter.ts:196:13) at emit (Emitter.ts:64:21) at emit (createObservableArray.ts:169:58) at (createObservableArray.ts:502:38) at setNotificationsDeferred (createObservableArray.ts:318:26) at listener (TinyEmitter.ts:213:6) at notifyLoop (TinyEmitter.ts:196:13) [URL] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Ddev%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D [NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dnatural-selection%26oldVersion%3D1.5%26phetioMigrationReport%3Ddev%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D [ATTACHED] [NAVIGATED] about:blank [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/migration/?sim=natural-selection&oldVersion=1.5&phetioMigrationReport=dev&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D [ATTACHED] [NAVIGATED] about:blank [ATTACHED] [NAVIGATED] about:blank [CONSOLE] enabling assert [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/studio/?sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D&phetioMigrationReport=dev&fuzz&locales=* [ATTACHED] [NAVIGATED] about:blank [CONSOLE] enabling assert [NAVIGATED] about:blank [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/natural-selection/natural-selection_en.html?brand=phet-io&ea&postMessageOnError&sim=natural-selection&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D&phetioMigrationReport=dev&fuzz&locales=*&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false [CONSOLE] enabling assert [NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/wrappers/studio/?phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D&phetioMigrationReport=dev&fuzz&exposeStandardPhetioWrapper [CONSOLE] enabling assert [ATTACHED] [NAVIGATED] about:blank [NAVIGATED] https://phet-io.colorado.edu/sims/natural-selection/1.5/natural-selection_all_phet-io_debug.html?ea&postMessageOnError&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22migration%22%2C%221.5-%3Emain%22%2C%22dev%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715026055959%7D&phetioMigrationReport=dev&fuzz&exposeStandardPhetioWrapper&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false [CONSOLE] enabling assert [CONSOLE] continuous-test-wrapper-load [CONSOLE] Dev Report: Congratulations, there are no reported problems [CONSOLE] Standard PhET-iO Wrapper version 1.5.6 upgraded to 1.6.0-dev.1. For more information, please check the browser console. [CONSOLE] Dev Report: Congratulations, there are no reported problems [CONSOLE] Assertion failed: counts out of sync [PAGE ERROR] Error: Error: Assertion failed: counts out of sync at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/createBunnyArray.js:49:15 at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:111:58 at Proxy.setNotificationsDeferred (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:419:37) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:240:27 at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) [CONSOLE] continuous-test-wrapper-error [CONSOLE] Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 [PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15) at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20) at IntroModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26) at IntroModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) [PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15) at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20) at IntroModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26) at IntroModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) [CONSOLE] continuous-test-wrapper-error [CONSOLE] Assertion failed: there should only be 1 live bunny [PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at IntroModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15) at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16) at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) [PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at IntroModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15) at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16) at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) [CONSOLE] continuous-test-wrapper-error id: "Sparky Node Puppeteer" Snapshot from 5/6/2024, 1:55:07 PM ---------------------------------- natural-selection : phet-io-state-fuzz : unbuilt http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/state/?sim=natural-selection&locales=*&phetioWrapperDebug=true&fuzz&phetioDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D Uncaught Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at assert (BunnyCollection.ts:611:14) at assertValidCounts (BunnyCollection.ts:228:19) at reset (NaturalSelectionModel.ts:280:25) at startOver (NaturalSelectionModel.ts:265:9) at reset (NaturalSelectionScreenView.ts:177:14) at listener (TinyEmitter.ts:213:6) at notifyLoop (TinyEmitter.ts:196:13) at emit (Emitter.ts:64:21) at emit (PushButtonModel.ts:201:22) [URL] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fstate%2F%3Fsim%3Dnatural-selection%26locales%3D*%26phetioWrapperDebug%3Dtrue%26fuzz%26phetioDebug%3Dtrue&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D [NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715025307059%2Fphet-io-wrappers%2Fstate%2F%3Fsim%3Dnatural-selection%26locales%3D*%26phetioWrapperDebug%3Dtrue%26fuzz%26phetioDebug%3Dtrue&testInfo=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D [ATTACHED] [NAVIGATED] about:blank [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/phet-io-wrappers/state/?sim=natural-selection&locales=*&phetioWrapperDebug=true&fuzz&phetioDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D [ATTACHED] [NAVIGATED] about:blank [ATTACHED] [NAVIGATED] about:blank [CONSOLE] enabling assert [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/natural-selection/natural-selection_en.html?brand=phet-io&ea&postMessageOnError&sim=natural-selection&locales=*&phetioWrapperDebug=true&fuzz&phetioDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D&frameTitle=source [NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/natural-selection/natural-selection_en.html?brand=phet-io&ea&postMessageOnError&sim=natural-selection&locales=*&phetioWrapperDebug=true&fuzz&phetioDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22natural-selection%22%2C%22phet-io-state-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1715025307059%22%2C%22timestamp%22%3A1715025700939%7D&frameTitle=destination [CONSOLE] enabling assert [CONSOLE] enabling assert [CONSOLE] continuous-test-wrapper-load [CONSOLE] continuous-test-wrapper-load [CONSOLE] Assertion failed: counts out of sync [PAGE ERROR] Error: Error: Assertion failed: counts out of sync at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/createBunnyArray.js:49:15 at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:111:58 at Proxy.setNotificationsDeferred (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:419:37) at http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/createObservableArray.js:240:27 at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) [CONSOLE] continuous-test-wrapper-error [CONSOLE] continuous-test-wrapper-error [CONSOLE] Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 [PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15) at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20) at LabModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26) at LabModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) [PAGE ERROR] Error: Error: Assertion failed: bunny counts are out of sync, live=0, dead=0, total=0 bunnyGroupLength=1 at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at BunnyCollection.assertValidCounts (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:542:15) at BunnyCollection.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/BunnyCollection.js:180:20) at LabModel.startOver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:207:26) at LabModel.reset (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:196:10) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/NaturalSelectionScreenView.js:136:15) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) [CONSOLE] continuous-test-wrapper-error [CONSOLE] continuous-test-wrapper-error [CONSOLE] Assertion failed: there should only be 1 live bunny [PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at LabModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15) at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16) at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) [PAGE ERROR] Error: Error: Assertion failed: there should only be 1 live bunny at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/assert/js/assert.js:28:13) at LabModel.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/model/NaturalSelectionModel.js:245:15) at Object.addAMate (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/EnvironmentPanel.js:65:29) at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/natural-selection/js/common/view/PlayButtonGroup.js:34:17) at TinyEmitter.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:161:14) at Emitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/Emitter.js:52:22) at PushButtonModel.fire (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:145:23) at downPropertyObserver (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/sun/js/buttons/PushButtonModel.js:91:16) at TinyProperty.notifyLoop (http://128.138.93.172/continuous-testing/ct-snapshots/1715025307059/chipper/dist/js/axon/js/TinyEmitter.js:176:7) [CONSOLE] continuous-test-wrapper-error [CONSOLE] continuous-test-wrapper-error id: "Sparky Node Puppeteer" Snapshot from 5/6/2024, 1:55:07 PM
zepumph commented 3 months ago

I think I finally cracked this, thanks for help from @samreid and @pixelzoom. We needed more objects to be phetioState:true and handle their own state, since we could no longer depend on ObservableArray to fire notifications eagerly to update them during state set. I'll check back on CT later.

zepumph commented 3 months ago

CT is happy in the state wrapper, but is complaining about two more things:

  1. Migration. We totally changed how state works, and so will likely need a processor that can make sure that the old unstateful things are still getting state set correctly.
  2. Wrapper unit tests. I am hacking a setState that looks like { activeProperty: { value: true } }. This involves clearing arrays without resetting them. I'll need to figure out how to do a better unit test hack.
zepumph commented 3 months ago

@samreid and I discussed (1), and think the next step is a custom migration rule that adds the bunny lists and countsProperties into the state manually, by looking at the list of bunnies in the PhetioGroup state.

zepumph commented 3 months ago

Unit tests fixed above, all that is left is to handle migration

zepumph commented 3 months ago

Pretty close to a test point here.

``` Subject: [PATCH] Don't setState again after an error, https://github.com/phetsims/gas-properties/issues/240 --- Index: repos/natural-selection/js/natural-selection-migration-processors.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/repos/natural-selection/js/natural-selection-migration-processors.ts b/repos/natural-selection/js/natural-selection-migration-processors.ts --- a/repos/natural-selection/js/natural-selection-migration-processors.ts (revision 949798923497e8dc4921297572c32b968cf0fdcb) +++ b/repos/natural-selection/js/natural-selection-migration-processors.ts (date 1715642402473) @@ -8,12 +8,71 @@ import { MigrationProcessors } from '../../../../phet-io-wrappers/common/js/migration/MigrationEngine.js'; import { uninstrumentAboutDialogDetails } from '../../../js/migration-common/joistProcessors.js'; import ChangePhetioElementValue from '../../../../phet-io-wrappers/common/js/migration/processors/ChangePhetioElementValue.js'; +import MigrationProcessor, { ProcessorIdentifier } from '../../../../phet-io-wrappers/common/js/migration/processors/MigrationProcessor.js'; +import MigrationPhetioAPI from '../../../../phet-io-wrappers/common/js/migration/MigrationPhetioAPI.js'; +import { PhetioState } from '../../../../tandem/js/TandemConstants.js'; +import MigrationReport from '../../../../phet-io-wrappers/common/js/migration/MigrationReport.js'; +import IntentionalAny from '../../../../phet-core/js/types/IntentionalAny.js'; window.phetio = window.phetio || {}; // Use ${simName} in processors that are general and might be usable for other sims const simName = 'naturalSelection'; + +class BunnyListsStateChange extends MigrationProcessor { + + protected override processProtected( migratingAPI: MigrationPhetioAPI, migratingState: PhetioState, newAPI: MigrationPhetioAPI, report: MigrationReport ): void { + + const x = [ + 'liveBunnies', + 'deadBunnies', + 'recessiveMutants' + ]; + const bunnyList: string[] = []; + const screens: string[] = []; + Object.keys( migratingState ).forEach( phetioID => { + if ( phetioID.match( /bunnyCollection.bunnyGroup.bunny_\d+$/ ) ) { + console.log( phetioID ); + bunnyList.push( phetioID ); + const screen = phetioID.split( 'bunnyCollection' )[ 0 ]; + if ( !screens.includes( screen ) ) { + screens.push( screen ); + } + } + } ); + + const myState: Record = {}; + + screens.forEach( screen => { + const liveBunnies = `${screen}bunnyCollection.liveBunnies`; + myState[ liveBunnies ] = { array: [] }; + const deadBunnies = `${screen}bunnyCollection.deadBunnies`; + myState[ deadBunnies ] = { array: [] }; + bunnyList.forEach( bunny => { + if ( bunny.startsWith( screen ) ) { + const list = ( migratingState[ bunny ].isAlive ? myState[ liveBunnies ] : myState[ deadBunnies ] ).array; + list.push( { + phetioID: bunny + } ); + } + } ); + console.log( myState ); + + const liveBunnyCounts = `${screen}bunnyCollection.liveBunnies.countsProperty`; + myState[ liveBunnyCounts ] = { validValues: null, units: null }; + const deadBunnyCounts = `${screen}bunnyCollection.deaBunnies.countsProperty`; + myState[ deadBunnyCounts ] = { validValues: null, units: null }; + // compute counts based on bunnies + } ); + + } + + protected getProcessorIdentifierTokens(): ProcessorIdentifier { + return [ 'BunnyListsStateChange' ]; + } +} + const migrationProcessors: MigrationProcessors = { '1.6.0': [ @@ -42,7 +101,8 @@ } } ), - new DeleteUninstrumentedPhetioElement( `${simName}.general.model.fallbackLocalesProperty` ) + new DeleteUninstrumentedPhetioElement( `${simName}.general.model.fallbackLocalesProperty` ), + new BunnyListsStateChange() ] };
zepumph commented 3 months ago

Good progress plus a bug fix for Migration Report processing bug.

```diff Subject: [PATCH] Don't setState again after an error, https://github.com/phetsims/gas-properties/issues/240 --- Index: phet-io-wrappers/common/js/migration/analyzeMigration.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-wrappers/common/js/migration/analyzeMigration.ts b/phet-io-wrappers/common/js/migration/analyzeMigration.ts --- a/phet-io-wrappers/common/js/migration/analyzeMigration.ts (revision 94d53dd612008102429043da1d55997fa22d4b47) +++ b/phet-io-wrappers/common/js/migration/analyzeMigration.ts (date 1715709408710) @@ -107,7 +107,7 @@ // Handle any alterations that should be made to the final report before reporting. This "postprocessing" step // allows for some migration "problems" (that aren't actually problems) to be "handled" by being silenced in the // report instead of fixed by a MigrationProcessor. - report.reportProcessors.forEach( reportProcessor => reportProcessor.processReport( report ) ); + report.reportProcessors.forEach( reportProcessor => reportProcessor.processReport( report, migratedState ) ); } /** @@ -451,7 +451,8 @@ migratedState: PhetioState, report: MigrationReport ): void { report.initialStatesAreIncompatible.push( { phetioID: phetioID, migratedInitialState: migratedInitialState, newInitialState: newInitialState } ); - delete migratedState[ phetioID ]; + report.gracefullyDeletedState[ phetioID ] = migratedState[ phetioID ]; + delete migratedState[ phetioID ]; // grace step // TODO: Investigate staging a delete for later instead of handling the delete eagerly. But then things are less atomic. } /** Index: phet-io-wrappers/common/js/migration/MigrationReport.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-wrappers/common/js/migration/MigrationReport.ts b/phet-io-wrappers/common/js/migration/MigrationReport.ts --- a/phet-io-wrappers/common/js/migration/MigrationReport.ts (revision 94d53dd612008102429043da1d55997fa22d4b47) +++ b/phet-io-wrappers/common/js/migration/MigrationReport.ts (date 1715709528782) @@ -24,7 +24,7 @@ * @author Sam Reid (PhET Interactive Simulations) */ -import { IOTypeName, PhetioElementState, PhetioID } from '../../../../tandem/js/TandemConstants.js'; +import { IOTypeName, PhetioElementState, PhetioID, PhetioState } from '../../../../tandem/js/TandemConstants.js'; import IntentionalAny from '../../../../phet-core/js/types/IntentionalAny.js'; import { MigrationPhetioTypes } from './MigrationPhetioAPI.js'; import ReportProcessor from './processors/report-processors/ReportProcessor.js'; @@ -118,6 +118,9 @@ // that processor acted upon (migrated in some way). public readonly allWorkDone: Record = {}; + // TODO: still in the dev report. + public readonly gracefullyDeletedState: PhetioState = {}; + public constructor( public readonly reportingContext: ReportingContext = 'dev' ) {} /** Index: phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.ts b/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.ts --- a/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.ts (revision 94d53dd612008102429043da1d55997fa22d4b47) +++ b/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.ts (date 1715707556551) @@ -16,7 +16,7 @@ import optionize from '../../../../../../phet-core/js/optionize.js'; import MigrationReport from '../../MigrationReport.js'; -import { PhetioID } from '../../../../../../tandem/js/TandemConstants.js'; +import { PhetioID, PhetioState } from '../../../../../../tandem/js/TandemConstants.js'; import arrayRemove from '../../../../../../phet-core/js/arrayRemove.js'; import IntentionalAny from '../../../../../../phet-core/js/types/IntentionalAny.js'; import ReportProcessor, { ReportProcessorOptions } from './ReportProcessor.js'; @@ -62,7 +62,7 @@ return [ 'RemoveExpectedReportErrors', JSON.stringify( { expectedReportErrors: this.expectedReportErrors } ) ]; } - public processReport( report: MigrationReport ): void { + public processReport( report: MigrationReport, migratingState: PhetioState ): void { // Subtract out the expected errors from the completed report let key: keyof ExpectedReportError; @@ -90,6 +90,10 @@ assert && assert( phetioID, `we need a phetioID here, ${phetioID}` ); if ( expectedReportedPhetioIDs.includes( phetioID ) ) { + if ( report.gracefullyDeletedState.hasOwnProperty( phetioID ) ) { + migratingState[ phetioID ] = report.gracefullyDeletedState[ phetioID ]; + } + arrayRemove( oneProblemList, reportedProblem ); // Remove from the report i--; // we just mutated our list, so update the index accordingly } Index: phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrorsTests.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrorsTests.ts b/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrorsTests.ts --- a/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrorsTests.ts (revision 94d53dd612008102429043da1d55997fa22d4b47) +++ b/phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrorsTests.ts (date 1715707556556) @@ -25,12 +25,12 @@ phetioIDNotInNewAPI: [ myPhetioID ] } } ); - processor.processReport( report ); + processor.processReport( report, {} ); assert.ok( report.phetioIDNotInNewAPI.length === 0 ); // @ts-expect-error typescript handles this, but it is still nice to know that there is a runtime assertion - window.assert && assert.throws( () => new RemoveExpectedReportErrors( { expectedReportErrors: { processedNothing: [ 'hi' ] } } ).processReport( report ) ); + window.assert && assert.throws( () => new RemoveExpectedReportErrors( { expectedReportErrors: { processedNothing: [ 'hi' ] } } ).processReport( report, {} ) ); } ); @@ -44,7 +44,7 @@ stateSchemaIncompatible: [ myPhetioID ] } } ); - processor.processReport( report ); + processor.processReport( report, {} ); assert.ok( report.phetioIDNotInNewAPI.length === 0 ); } ); @@ -58,7 +58,7 @@ stateSchemaIncompatible: [ myPhetioID ] } } ); - processor.processReport( report ); + processor.processReport( report, {} ); assert.ok( report.stateSchemaIncompatible.length === 0 ); } ); @@ -76,7 +76,7 @@ stateSchemaIncompatible: [ myPhetioID, myPhetioID2 ] } } ); - processor.processReport( report ); + processor.processReport( report, {} ); assert.ok( report.stateSchemaIncompatible.length === 1 ); assert.ok( report.stateSchemaIncompatible[ 0 ].phetioID === myPhetioID3 ); Index: phet-io-wrappers/common/js/migration/processors/report-processors/ReportProcessor.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-wrappers/common/js/migration/processors/report-processors/ReportProcessor.ts b/phet-io-wrappers/common/js/migration/processors/report-processors/ReportProcessor.ts --- a/phet-io-wrappers/common/js/migration/processors/report-processors/ReportProcessor.ts (revision 94d53dd612008102429043da1d55997fa22d4b47) +++ b/phet-io-wrappers/common/js/migration/processors/report-processors/ReportProcessor.ts (date 1715707556545) @@ -49,5 +49,5 @@ /** * Implement this function to mutate the report in the desired way before it is reported. */ - public abstract processReport( report: MigrationReport ): void; + public abstract processReport( report: MigrationReport, migratingState: PhetioState ): void; } \ No newline at end of file Index: phet-io-sim-specific/repos/natural-selection/js/natural-selection-migration-processors.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-io-sim-specific/repos/natural-selection/js/natural-selection-migration-processors.ts b/phet-io-sim-specific/repos/natural-selection/js/natural-selection-migration-processors.ts --- a/phet-io-sim-specific/repos/natural-selection/js/natural-selection-migration-processors.ts (revision 951c9e4a8c3a06dd380052ebf526b86142cc9600) +++ b/phet-io-sim-specific/repos/natural-selection/js/natural-selection-migration-processors.ts (date 1715709408684) @@ -8,12 +8,98 @@ import { MigrationProcessors } from '../../../../phet-io-wrappers/common/js/migration/MigrationEngine.js'; import { uninstrumentAboutDialogDetails } from '../../../js/migration-common/joistProcessors.js'; import ChangePhetioElementValue from '../../../../phet-io-wrappers/common/js/migration/processors/ChangePhetioElementValue.js'; +import MigrationProcessor, { ProcessorIdentifier } from '../../../../phet-io-wrappers/common/js/migration/processors/MigrationProcessor.js'; +import MigrationPhetioAPI from '../../../../phet-io-wrappers/common/js/migration/MigrationPhetioAPI.js'; +import { PhetioState } from '../../../../tandem/js/TandemConstants.js'; +import MigrationReport from '../../../../phet-io-wrappers/common/js/migration/MigrationReport.js'; +import IntentionalAny from '../../../../phet-core/js/types/IntentionalAny.js'; +import RemoveExpectedReportErrors from '../../../../phet-io-wrappers/common/js/migration/processors/report-processors/RemoveExpectedReportErrors.js'; window.phetio = window.phetio || {}; // Use ${simName} in processors that are general and might be usable for other sims const simName = 'naturalSelection'; + +class BunnyListsStateChange extends MigrationProcessor { + + protected override processProtected( migratingAPI: MigrationPhetioAPI, migratingState: PhetioState, newAPI: MigrationPhetioAPI, report: MigrationReport ): void { + + const bunnyList: string[] = []; + const screens: string[] = []; + Object.keys( migratingState ).forEach( phetioID => { + if ( phetioID.match( /bunnyCollection.bunnyGroup.bunny_\d+$/ ) ) { + console.log( phetioID ); + bunnyList.push( phetioID ); + const screen = phetioID.split( 'bunnyCollection' )[ 0 ]; + if ( !screens.includes( screen ) ) { + screens.push( screen ); + } + } + } ); + + const myState: Record = {}; + + screens.forEach( screen => { + const liveBunniesPhetioID = `${screen}bunnyCollection.liveBunnies`; + myState[ liveBunniesPhetioID ] = { array: [] }; + const deadBunniesPhetioID = `${screen}bunnyCollection.deadBunnies`; + myState[ deadBunniesPhetioID ] = { array: [] }; + bunnyList.forEach( bunnyPhetioID => { + if ( bunnyPhetioID.startsWith( screen ) ) { + const list = ( migratingState[ bunnyPhetioID ].isAlive ? myState[ liveBunniesPhetioID ] : myState[ deadBunniesPhetioID ] ).array; + list.push( { + phetioID: bunnyPhetioID + } ); + } + } ); + + [ + liveBunniesPhetioID, + deadBunniesPhetioID + ].forEach( bunniesListPhetioID => { + const countsPropertyPhetioID = `${bunniesListPhetioID}.countsProperty`; + migratingAPI.phetioElements[ bunniesListPhetioID ]._metadata.phetioState = true; + migratingAPI.phetioElements[ countsPropertyPhetioID ]._metadata.phetioState = true; + const countsState = { + // TODO: delete one of these and ensure a failure of state schema (for maintaintability) + totalCount: 0, + whiteFurCount: 0, + brownFurCount: 0, + straightEarsCount: 0, + floppyEarsCount: 0, + shortTeethCount: 0, + longTeethCount: 0 + }; + myState[ countsPropertyPhetioID ] = { validValues: null, units: null, value: countsState }; + + myState[ bunniesListPhetioID ].array.forEach( bunnyReferenceState => { + const bunnysPhenotypeState = migratingState[ `${bunnyReferenceState.phetioID}.phenotype` ]; + this.updateCountsForBunny( bunnysPhenotypeState, countsState ); + } ); + + } ); + } ); + console.log( myState ); + _.extend( migratingState, myState ); + } + + private updateCountsForBunny( phenotypeState, countsState ): void { + const delta = 1; + countsState.totalCount += delta; + countsState.whiteFurCount += ( phenotypeState.furAllele.phetioID.includes( 'white' ) ? delta : 0 ); + countsState.brownFurCount += ( phenotypeState.furAllele.phetioID.includes( 'brown' ) ? delta : 0 ); + countsState.straightEarsCount += ( phenotypeState.earsAllele.phetioID.includes( 'straight' ) ? delta : 0 ); + countsState.floppyEarsCount += ( phenotypeState.earsAllele.phetioID.includes( 'floppy' ) ? delta : 0 ); + countsState.shortTeethCount += ( phenotypeState.teethAllele.phetioID.includes( 'short' ) ? delta : 0 ); + countsState.longTeethCount += ( phenotypeState.teethAllele.phetioID.includes( 'long' ) ? delta : 0 ); + } + + protected getProcessorIdentifierTokens(): ProcessorIdentifier { + return [ 'BunnyListsStateChange' ]; + } +} + const migrationProcessors: MigrationProcessors = { '1.6.0': [ @@ -42,7 +128,23 @@ } } ), - new DeleteUninstrumentedPhetioElement( `${simName}.general.model.fallbackLocalesProperty` ) + new DeleteUninstrumentedPhetioElement( `${simName}.general.model.fallbackLocalesProperty` ), + new BunnyListsStateChange(), + // TODO: just handle the initialStates in the above custom rule, don't silence the report (duh) -Sam + new RemoveExpectedReportErrors( { + expectedReportErrors: { + initialStatesAreIncompatible: [ + 'naturalSelection.introScreen.model.bunnyCollection.liveBunnies', + 'naturalSelection.introScreen.model.bunnyCollection.deadBunnies', + 'naturalSelection.introScreen.model.bunnyCollection.liveBunnies.countsProperty', + 'naturalSelection.introScreen.model.bunnyCollection.deadBunnies.countsProperty', + 'naturalSelection.labScreen.model.bunnyCollection.liveBunnies', + 'naturalSelection.labScreen.model.bunnyCollection.deadBunnies', + 'naturalSelection.labScreen.model.bunnyCollection.liveBunnies.countsProperty', + 'naturalSelection.labScreen.model.bunnyCollection.deadBunnies.countsProperty' + ] + } + } ) ] };
pixelzoom commented 3 months ago

@zepumph Please elaborate (in the code comments) on the change shown below that you made in https://github.com/phetsims/natural-selection/commit/db44f84fa0a55ad86b3b7a66599d6acc6c114b8f. This is something I have never encountered, I don't understand it, and I could not maintain it.

  // State may set in an unexpected order, but by the end, we must have the right counts.
  if ( assert && Tandem.PHET_IO_ENABLED ) {
    phet.phetio.phetioEngine.phetioStateEngine.stateSetEmitter.addListener( ( state: PhetioState, scopeTandem: Tandem ) => {
      if ( countsProperty.tandem.hasAncestor( scopeTandem ) ) {
        assert && assert( countsProperty.value.totalCount === bunnyArray.length, 'counts out of sync' );
      }
    } );
  }
pixelzoom commented 3 months ago

I tracked scopeTandem down to this code in PhetioStateEngine.ts. It's doc makes no sense to me -- "returns if... "? This method's return is void. I also have no idea what a "partial state" is, or what it means to be "in the scope of a partial state".

  /**
   * Sets the state from an object that represents the state.
   *
   * @param state - a json object (not a string) that specifies the values to set
   * @param scopeTandem - returns if the given Tandem is in the scope of a (partial) state
   */
  public setState( state: FullPhetioState, scopeTandem: Tandem ): void {
zepumph commented 3 months ago

Updated doc above. I originally thought that would be useful to add so that we didn't assert for all bunnyCollections if we only just setState on a single screen (like when pressing the resetAllButton in a standard PhET-iO Wrapper from studio), but I don't actually think it is necessary. I'd be happy to delete it for this pattern generally, because I don't mind an assertion that says, "if you just set another screen, my counts should still be correct".

All other work for this issue has been done. I found a bug over in https://github.com/phetsims/phet-io-wrappers/issues/641 that has been fixed, but isn't effecting NS migration after the above commits. CT is clear, and I'll go ahead and commit the removal of the scopeTandem stuff now.

zepumph commented 3 months ago

@pixelzoom feel free to close or reach out to discuss anything further.

phet-dev commented 3 months ago

Reopening because there is a TODO marked for this issue.

zepumph commented 3 months ago

What a fun bug in the TODO checker. Here is the comment:

/**
 * In https://github.com/phetsims/natural-selection/issues/361, elements were set to phetioState:true:
 * liveBunnies
 * deadBunnies
 * liveBunnies.countsProperty
 * deadBunnies.countsProperty
 *
 * These used to be derived from the bunnies themselves in the sim, and so this rule derives these values from the
 * bunny states, and creates the needed state for these derived stateful values.
 *
 * NOTE: IntentionalAny is used quite a bit here, to prevent importing over into the main sim codebase. Be careful!
 *
 * TODO: Handle recessiveMutants?, https://github.com/phetsims/natural-selection/issues/362
 */

The TODO is for another issue. Closing

zepumph commented 3 months ago

This is still failing because we need to create some default for recessiveMutants, so that it actually is getting set. This will mostly be a stop gap until we determine how to proceed with https://github.com/phetsims/natural-selection/issues/362, so I'll keep that TODO in place.

zepumph commented 3 months ago

This commit adds all recessive mutants into the migrated stateful list, even if they have already been mated with. As I was reviewing these changes, I was wondering if I should have stop-gapped by just having an empty list/counts in the state. Anywho, let's see how CT does tonight.

zepumph commented 3 months ago

Ok excellent. This has fixed the assertion, though it doesn't transfer state of the recessiveMutants or anything (see other issue for that).

pixelzoom commented 3 months ago

Reopening.

This commit adds all recessive mutants into the migrated stateful list, even if they have already been mated with.

That will result in incorrect behavior. Some recessive mutants may "mate eagerly" twice, resulting in a significantly diffferent population that displays more of the recessive gene than it should.

For correct behavior: For each bunny that passes isRecessiveMutant, add it to recessiveMutants if no other bunny has the mutant as its father or mother.

zepumph commented 3 months ago

That makes a lot of sense! There is a TODO in this processor to support recessveMutants over in https://github.com/phetsims/natural-selection/issues/362. In that issue we will decide how important it is to fix this state bug in older version of NS, and how to support migration with it. Reclosing