phetsims / function-builder

"Function Builder" is an educational simulation in HTML5, by PhET Interactive Simulations at the University of Colorado Boulder.
GNU General Public License v3.0
4 stars 4 forks source link

CT: adjacent times should have been collapsed #127

Closed pixelzoom closed 5 years ago

pixelzoom commented 5 years ago

The occurred once, never seen it before, probably a corner case:

function-builder : fuzz : require.js-canvas : run
Query: brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000
Uncaught Error: Assertion failed: adjacent times should have been collapsed
Error: Assertion failed: adjacent times should have been collapsed
    at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/assert/js/assert.js:22:13)
    at new HelpfulEquationNode (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/function-builder/js/common/view/equations/HelpfulEquationNode.js?bust=1558941697900:184:21)
    at EquationPanel.updateEquations (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/function-builder/js/common/view/equations/EquationPanel.js?bust=1558941697900:151:34)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/function-builder/js/common/view/equations/EquationPanel.js?bust=1558941697900:115:14
    at TinyEmitter.emit (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/axon/js/TinyEmitter.js?bust=1558941697900:58:55)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/axon/js/Emitter.js?bust=1558941697900:46:31
    at Emitter.execute (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/axon/js/Action.js?bust=1558941697900:177:20)
    at Emitter.emit (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/axon/js/Emitter.js?bust=1558941697900:61:20)
    at MathBuilder.addFunctionInstance (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/function-builder/js/common/model/builder/Builder.js?bust=1558941697900:153:35)
    at MathBuilder.addFunctionInstance (https://bayes.colorado.edu/continuous-testing/snapshot-1558937250855/function-builder/js/common/model/builder/MathBuilder.js?bust=1558941697900:45:45)
id: Bayes Chrome
Approximately 5/27/2019, 12:07:30 AM

Relevant code is in HelpfulEquationNode constructor:

        else if ( currentOperator === FBSymbols.TIMES ) {

          // TIMES ----------------------------------------------------------------------------

184       assert && assert( !previousOperator || previousOperator !== FBSymbols.TIMES,
            'adjacent times should have been collapsed' );
pixelzoom commented 5 years ago

Not obvious why this happened, and the assertion messages don't contain enough info. I've added more details to the assertion messages and will have another look if it happens again. Until then, deferred.

pixelzoom commented 5 years ago

Finally happened in CT on 6/22, here's the stack trace with more detailed assertion message. The equation in this case is 1(1‪x‬), which should be simplified to x.

function-builder : fuzz : require.js-canvas : run
Query: brand=phet&ea&fuzz&rootRenderer=canvas
Uncaught Error: Assertion failed: adjacent times should have been collapsed: 1(1‪x‬)
Error: Assertion failed: adjacent times should have been collapsed: 1(1‪x‬)
    at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/assert/js/assert.js:22:13)
    at new HelpfulEquationNode (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/function-builder/js/common/view/equations/HelpfulEquationNode.js?bust=1561227512705:184:21)
    at EquationPanel.updateEquations (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/function-builder/js/common/view/equations/EquationPanel.js?bust=1561227512705:151:34)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/function-builder/js/common/view/equations/EquationPanel.js?bust=1561227512705:115:14
    at TinyEmitter.emit (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/axon/js/TinyEmitter.js?bust=1561227512705:59:55)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/axon/js/Emitter.js?bust=1561227512705:46:31
    at Emitter.execute (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/axon/js/Action.js?bust=1561227512705:177:20)
    at Emitter.emit (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/axon/js/Emitter.js?bust=1561227512705:71:21)
    at MathBuilder.addFunctionInstance (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/function-builder/js/common/model/builder/Builder.js?bust=1561227512705:153:35)
    at MathBuilder.addFunctionInstance (https://bayes.colorado.edu/continuous-testing/snapshot-1561207571677/function-builder/js/common/model/builder/MathBuilder.js?bust=1561227512705:45:45)
id: Bayes Chrome
Approximately 6/22/2019, 8:46:11 AM
pixelzoom commented 5 years ago

This hasn't happened in CT again, and I have not been able to reproduce manually or with ?ea&fuzz. So this is probably some very rare corner case. If it does happen, it won't crash the sim, it will just show a non-simplified form of an equation. I'm going to close this, and we can reopen if it occurs again.