phetsims / ph-scale

"pH Scale" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/ph-scale
GNU General Public License v3.0
0 stars 7 forks source link

CT: value should have typeof number, value=null #235

Closed KatieWoe closed 2 years ago

KatieWoe commented 2 years ago

The issue in CT is fairly long. Here is a part:

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656943905041%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656950327422%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656956349707%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656963897733%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=15, oldValue=null
Error: Assertion failed: reentry detected, value=15, oldValue=null
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
at apply (PhetioAction.ts:125:16)
at execute (DragListener.ts:459:21)
at drag (PressListener.ts:896:13)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656969810252%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656976155351%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=7, oldValue=-1
Error: Assertion failed: reentry detected, value=7, oldValue=-1
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (ReadOnlyProperty.ts:321:9)
at reset (Property.ts:60:10)
at reset (NumberProperty.ts:179:10)
at reset (MySolution.js:72:20)
at reset (MySolutionModel.js:43:18)
at reset (MySolutionScreenView.js:104:14)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656983361841%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=14.204119982655925, oldValue=null
Error: Assertion failed: reentry detected, value=14.204119982655925, oldValue=null
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
at apply (PhetioAction.ts:125:16)
at execute (DragListener.ts:459:21)
at drag (PressListener.ts:896:13)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656989303561%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=14.57978359661681, oldValue=null
Error: Assertion failed: reentry detected, value=14.57978359661681, oldValue=null
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
at apply (PhetioAction.ts:125:16)
at execute (DragListener.ts:459:21)
at drag (PressListener.ts:896:13)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1657002992933%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1657015833698%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=-1, oldValue=null
Error: Assertion failed: reentry detected, value=-1, oldValue=null
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
at apply (PhetioAction.ts:125:16)
at execute (DragListener.ts:459:21)
at drag (PressListener.ts:896:13)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : autofill-fuzz : unbuilt : query-parameters
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22autofill-fuzz%22%2C%22unbuilt%22%2C%22query-parameters%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1657029630574%7D&brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Query: brand=phet&ea&fuzz&memoryLimit=1000&autoFill=false
Uncaught Error: Assertion failed: reentry detected, value=null, oldValue=15
Error: Assertion failed: reentry detected, value=null, oldValue=15
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (ReadOnlyProperty.ts:256:14)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
at apply (PhetioAction.ts:125:16)
at execute (DragListener.ts:459:21)
at drag (PressListener.ts:896:13)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM

----------------------------------

ph-scale : fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/ph-scale/ph-scale_en.html?continuousTest=%7B%22test%22%3A%5B%22ph-scale%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1656941636348%22%2C%22timestamp%22%3A1656943238392%7D&brand=phet&ea&fuzz&memoryLimit=1000
Query: brand=phet&ea&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: validation failed:
Property value not valid: value should have typeof number, value=null
prunedValidator:
[object Object]
Error: Assertion failed: validation failed:
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1656941636348/assert/js/assert.js:28:13)
at assert (validate.ts:25:16)
at validate (ReadOnlyProperty.ts:176:33)
at listener (TinyEmitter.ts:92:8)
at emit (ReadOnlyProperty.ts:259:22)
at _notifyListeners (ReadOnlyProperty.ts:210:13)
at set (Property.ts:67:10)
at set (GraphIndicatorDragListener.js:85:21)
at _dragListener (PressListener.ts:527:9)
at call (DragListener.ts:308:35)
id: Bayes Puppeteer
Snapshot from 7/4/2022, 7:33:56 AM
pixelzoom commented 2 years ago

Reproduced in master with my working copy, using URL: http://localhost:8080/ph-scale/ph-scale_en.html?brand=phet&ea&debugger

This is specific to the My Solution screen. To reproduce:

There have been no changes to this sim, so it's likely a regression in common code.

pixelzoom commented 2 years ago

This is due to recent changes in ScientificNotationNode.ts for https://github.com/phetsims/scenery-phet/issues/747. The relevant code is in GrabDragListener, which uses ScientificNotationNode.toScientificNotation.

Bisecting commits to ScientificNotationNode.ts reveals that the problem was introduced in https://github.com/phetsims/scenery-phet/commit/5a032253.

pixelzoom commented 2 years ago

Setting a debugger in GrabDragListener drag function reveals that the sign of the exponent is incorrect. (Note that the mantissa rounding was incorrect prior to the change.)

When dragging the OH- graph indicator ...

BEFORE https://github.com/phetsims/scenery-phet/commit/5a032253:

> value
1.0484477197064377e-7
> scientificNotation
{mantissa: '1.1', exponent: '-7'}

AFTER https://github.com/phetsims/scenery-phet/commit/5a032253:

> value
11.011688753818261e-7
> scientificNotation
{mantissa: '1.0', exponent: '7'}

Here's a failing unit test for ScientificNotationNode.js:

  assert.deepEqual( ScientificNotationNode.toScientificNotation( 1.0484477197064377e-7, {
    exponent: NULL_EXPONENT,
    mantissaDecimalPlaces: 1
  } ), { mantissa: '1.0', exponent: '-7' } );
screenshot_1741
pixelzoom commented 2 years ago

In toScientificNotationNode, string parsing was incorrectly stripping the sign off of negative exponents. The sign should only be stripped off of positive exponents. Fixed in the above commit. I'll leave this open until I've verified that CT is happy.

pixelzoom commented 2 years ago

CT is happy. Closing.