phetsims / circuit-construction-kit-dc

"Circuit Construction Kit: DC" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
11 stars 8 forks source link

CT: Assertion failed: Impossible set state from iterate; unset state #205

Closed zepumph closed 6 months ago

zepumph commented 6 months ago
circuit-construction-kit-dc-virtual-lab : migration : 1.3->main : assert
http://128.138.93.172/continuous-testing/ct-snapshots/1715022464268/phet-io-wrappers/migration/?sim=circuit-construction-kit-dc-virtual-lab&oldVersion=1.3&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D
Assertion failed: Impossible set state from iterate; unset state: {
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_0.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.lightBulbNodeGroup.lightBulbNode_0.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_1.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_2.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_2.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_3.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_5.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_6.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_4.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_7.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_6.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_3.probeReadoutText.stringProperty": {
"value": "‪89980.96 A‬",
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_3.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_5.probeReadoutText.stringProperty": {
"value": "—",
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_5.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_6.probeReadoutText.stringProperty": {
"value": "—",
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_6.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_7.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_8.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_7.probeReadoutText.stringProperty": {
"value": "—",
"validValues": null,
"units": null
},
"circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_7.inputEnabledProperty": {
"value": true,
"validValues": null,
"units": null
}
}
[object Object]
Error: Assertion failed: Impossible set state from iterate; unset state: {
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1715022464268/assert/js/assert.js:28:13)
at assert (PhetioStateEngine.ts:354:18)
at iterate (PhetioStateEngine.ts:259:30)
at setState (PhetioStateEngine.ts:280:9)
at setFullState (phetioEngine.ts:1158:33)
at apply (phetioCommandProcessor.ts:424:50)
at process (phetioCommandProcessor.ts:302:35)
at getReturn (phetioCommandProcessor.ts:310:17)
at Array.map
at map (phetioCommandProcessor.ts:300:29)
[URL] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715022464268%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dcircuit-construction-kit-dc-virtual-lab%26oldVersion%3D1.3%26phetioMigrationReport%3Dassert%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/wrapper-test.html?url=..%2F..%2Fct-snapshots%2F1715022464268%2Fphet-io-wrappers%2Fmigration%2F%3Fsim%3Dcircuit-construction-kit-dc-virtual-lab%26oldVersion%3D1.3%26phetioMigrationReport%3Dassert%26locales%3D*%26phetioDebug%3Dtrue%26phetioWrapperDebug%3Dtrue%26fuzz%26migrationRate%3D5000%26&duration=80000&testInfo=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D
[ATTACHED]
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715022464268/phet-io-wrappers/migration/?sim=circuit-construction-kit-dc-virtual-lab&oldVersion=1.3&phetioMigrationReport=assert&locales=*&phetioDebug=true&phetioWrapperDebug=true&fuzz&migrationRate=5000&&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D
[ATTACHED]
[NAVIGATED] about:blank
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1715022464268/studio/?sim=circuit-construction-kit-dc-virtual-lab&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%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/1715022464268/circuit-construction-kit-dc-virtual-lab/circuit-construction-kit-dc-virtual-lab_en.html?brand=phet-io&ea&postMessageOnError&sim=circuit-construction-kit-dc-virtual-lab&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D&phetioMigrationReport=assert&fuzz&locales=*&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[NAVIGATED] https://phet-io.colorado.edu/sims/circuit-construction-kit-dc-virtual-lab/1.3/wrappers/studio/?phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D&phetioMigrationReport=assert&fuzz&exposeStandardPhetioWrapper
[ATTACHED]
[NAVIGATED] about:blank
[CONSOLE] enabling assert
[NAVIGATED] https://phet-io.colorado.edu/sims/circuit-construction-kit-dc-virtual-lab/1.3/circuit-construction-kit-dc-virtual-lab_all_phet-io_debug.html?ea&postMessageOnError&phetioWrapperDebug=true&wrapperContinuousTest=%7B%22test%22%3A%5B%22circuit-construction-kit-dc-virtual-lab%22%2C%22migration%22%2C%221.3-%3Emain%22%2C%22assert%22%5D%2C%22snapshotName%22%3A%22snapshot-1715022464268%22%2C%22timestamp%22%3A1715023278712%7D&phetioMigrationReport=assert&fuzz&exposeStandardPhetioWrapper&phetioEmitAPIBaseline&phetioCreateArchetypes&phetioEmitHighFrequencyEvents=false
[CONSOLE] enabling assert
[CONSOLE] an attempt was made to set the output level for a sound category on an uninitialized sound manager, ignoring
[CONSOLE] an attempt was made to set the output level for a sound category on an uninitialized sound manager, ignoring
[CONSOLE] continuous-test-wrapper-load
[CONSOLE] pass: 11, keys.length = 21, keys = circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_0.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.lightBulbNodeGroup.lightBulbNode_0.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_1.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_2.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_2.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.switchNodeGroup.switchNode_3.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_5.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_6.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_4.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_7.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_6.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_3.probeReadoutText.stringProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_3.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_5.probeReadoutText.stringProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_5.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_6.probeReadoutText.stringProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_6.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.wireNodeGroup.wireNode_7.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.resistorNodeGroup.resistorNode_8.inputEnabledProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_7.probeReadoutText.stringProperty,circuitConstructionKitDcVirtualLab.labScreen.view.circuitNode.seriesAmmeterNodeGroup.seriesAmmeterNode_7.inputEnabledProperty

From https://github.com/phetsims/phet-io/issues/1661

zepumph commented 6 months ago

This solved the problem, but it is horrible and we also immediately ran into a downstream issue.


Subject: [PATCH] fdsaf
---
Index: js/createObservableArray.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/createObservableArray.ts b/js/createObservableArray.ts
--- a/js/createObservableArray.ts   (revision a6b7d31a8038d1f74e493aefa648a545511fd12b)
+++ b/js/createObservableArray.ts   (date 1715029622821)
@@ -318,6 +318,40 @@
           observableArray.setNotificationsDeferred( false );
         }
       } );
+
+
+      phetioStateEngine.addSetStateHelper( ( state: PhetioState, stillToSetIDs: string[] ) => {
+
+        // if we have any deferred actions at this point, execute one. Then check back later.
+        if ( observableArray.deferredActions.length > 0 ) {
+          observableArray.deferredActions.shift()!();
+
+          return true;
+        }
+        else {
+          return false;
+        }
+
+      //   let creationNotified = false;
+      //
+      //   let iterationCount = 0;
+      //
+      //   while ( this.deferredCreations.length > 0 ) {
+      //
+      //     if ( iterationCount > 200 ) {
+      //       throw new Error( 'Too many iterations in deferred creations, stillToSetIDs = ' + stillToSetIDs.join( ', ' ) );
+      //     }
+      //
+      //     const deferredCreatedElement = this.deferredCreations[ 0 ];
+      //     if ( this.stateSetOnAllChildrenOfDynamicElement( deferredCreatedElement.tandem.phetioID, stillToSetIDs ) ) {
+      //       this.notifyElementCreatedWhileDeferred( deferredCreatedElement );
+      //       creationNotified = true;
+      //     }
+      //
+      //     iterationCount++;
+      //   }
+      //   return creationNotified;
+      } );
     }
   }
zepumph commented 6 months ago

I got to a commit point thanks to help from @samreid. We want to make sure that we do a "clear" step without notifications deferred at the beginning of state set. This is what dynamic element containers do too. This way, we never get an impossible set state assertion. I'll check back later for CT to be clear.

zepumph commented 6 months ago

CT is clear