phetsims / fluid-pressure-and-flow

"Fluid Pressure and Flow" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
8 stars 5 forks source link

CT item not found in Array #334

Closed KatieWoe closed 3 years ago

KatieWoe commented 3 years ago
fluid-pressure-and-flow : fuzz : unbuilt : assertSlow
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/fluid-pressure-and-flow/fluid-pressure-and-flow_en.html?continuousTest=%7B%22test%22%3A%5B%22fluid-pressure-and-flow%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22assertSlow%22%5D%2C%22snapshotName%22%3A%22snapshot-1608476209113%22%2C%22timestamp%22%3A1608508241865%7D&brand=phet&eall&fuzz&memoryLimit=1000
Query: brand=phet&eall&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: item not found in Array
Error: Assertion failed: item not found in Array
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/assert/js/assert.js:25:13)
at arrayRemove (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/phet-core/js/arrayRemove.js:19:13)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/axon/js/createObservableArray.js:349:34
at Array.forEach (<anonymous>)
at Proxy.removeAll (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/axon/js/createObservableArray.js:349:14)
at WaterTowerModel.stepInternal (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/fluid-pressure-and-flow/js/watertower/model/WaterTowerModel.js:330:24)
at WaterTowerModel.step (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/fluid-pressure-and-flow/js/watertower/model/WaterTowerModel.js:195:14)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/joist/js/Sim.js:282:22
at Action.execute (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/axon/js/Action.js:225:18)
at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1608476209113/joist/js/Sim.js:1026:31)
id: Bayes Chrome
Snapshot from 12/20/2020, 7:56:49 AM
samreid commented 3 years ago

We discussed whether the ObservableArray remove functions should be graceful as part of https://github.com/phetsims/axon/issues/332.

Maybe add a guard that only removes drops that are in the list?

(patch is untested)

Index: js/watertower/model/WaterTowerModel.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/watertower/model/WaterTowerModel.js b/js/watertower/model/WaterTowerModel.js
--- a/js/watertower/model/WaterTowerModel.js    (revision 4801c3562942091369b95b20372a8326df9a0a9c)
+++ b/js/watertower/model/WaterTowerModel.js    (date 1615223075256)
@@ -327,9 +327,7 @@
       this.tankFullLevelDurationProperty.value = 0;
     }

-    if ( this.dropsToRemove.length > 0 ) {
-      this.faucetDrops.removeAll( this.dropsToRemove );
-    }
+    this.faucetDrops.removeAll( this.dropsToRemove.filter( drop => this.faucetDrops.includes( drop ) ) );

     this.dropsToRemove = [];
     for ( let i = 0, numberOfDrops = this.waterTowerDrops.length; i < numberOfDrops; i++ ) {
zepumph commented 3 years ago

Excellent!

zepumph commented 3 years ago

I'll check back in on CT soon.

pixelzoom commented 3 years ago

@jbphet’s PSA about “item not found in Array” was in https://github.com/phetsims/balancing-act/issues/126.

zepumph commented 3 years ago

CT Clear