phetsims / equality-explorer

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

CT: Assertion failed: term is disposed #201

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

This assertion failure is occuring for all sims in the suite, for all Term subclasses. This problem was likely introduced by TypeScript conversion and PhET-iO instrumentation. It looks like this started around 11/2/2022 8:13:10 PM, but I'm not certain, because CT history does not go back very far.

For example, ConstantTerm:

equality-explorer : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667500361891/equality-explorer/equality-explorer_en.html?continuousTest=%7B%22test%22%3A%5B%22equality-explorer%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1667500361891%22%2C%22timestamp%22%3A1667505652468%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Uncaught Error: Assertion failed: term is disposed: ConstantTerm: 1/1
Error: Assertion failed: term is disposed: ConstantTerm: 1/1
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667500361891/assert/js/assert.js:28:13)
at assert (TermCreator.ts:360:14)
at manageTerm (TermCreator.ts:429:11)
at putTermOnPlate (TermCreator.ts:590:54)
at Array.forEach
at forEach (TermCreator.ts:590:24)
at restoreSnapshot (Plate.ts:356:29)
at restoreSnapshot (Snapshot.ts:48:31)
at restore (SnapshotsCollection.ts:89:13)
at restoreSelectedSnapshot (SnapshotsAccordionBox.ts:121:48)
id: Bayes Puppeteer
Snapshot from 11/3/2022, 12:32:41 PM

ObjectTerm:

equality-explorer-basics : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667559805061/equality-explorer-basics/equality-explorer-basics_en.html?continuousTest=%7B%22test%22%3A%5B%22equality-explorer-basics%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1667559805061%22%2C%22timestamp%22%3A1667570001913%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Uncaught Error: Assertion failed: term is disposed: ObjectTerm: 1/1 Variable: symbol=sphere value=1
Error: Assertion failed: term is disposed: ObjectTerm: 1/1 Variable: symbol=sphere value=1
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667559805061/assert/js/assert.js:28:13)
at assert (TermCreator.ts:360:14)
at manageTerm (TermCreator.ts:429:11)
at putTermOnPlate (TermCreator.ts:590:54)
at Array.forEach
at forEach (TermCreator.ts:590:24)
at restoreSnapshot (Plate.ts:356:29)
at restoreSnapshot (Snapshot.ts:48:31)
at restore (SnapshotsCollection.ts:89:13)
at restoreSelectedSnapshot (SnapshotsAccordionBox.ts:121:48)
id: Bayes Puppeteer
Snapshot from 11/4/2022, 5:03:25 AM

VariableTerm:

equality-explorer-two-variables : fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667528634026/equality-explorer-two-variables/equality-explorer-two-variables_en.html?continuousTest=%7B%22test%22%3A%5B%22equality-explorer-two-variables%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1667528634026%22%2C%22timestamp%22%3A1667532639546%7D&brand=phet&ea&fuzz&memoryLimit=1000
Query: brand=phet&ea&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: term is disposed: VariableTerm: 1/1 Variable: symbol=‪x‬ value=1
Error: Assertion failed: term is disposed: VariableTerm: 1/1 Variable: symbol=‪x‬ value=1
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1667528634026/assert/js/assert.js:28:13)
at assert (TermCreator.ts:360:14)
at manageTerm (TermCreator.ts:429:11)
at putTermOnPlate (TermCreator.ts:590:54)
at Array.forEach
at forEach (TermCreator.ts:590:24)
at restoreSnapshot (Plate.ts:356:29)
at restoreSnapshot (Snapshot.ts:48:31)
at restore (SnapshotsCollection.ts:89:13)
at restoreSelectedSnapshot (SnapshotsAccordionBox.ts:121:48)
id: Bayes Puppeteer
Snapshot from 11/3/2022, 8:23:54 PM
pixelzoom commented 2 years ago

In all cases... While restoring a snapshot, a Term that was previously disposed is being put on the plate by TermCreator.putTermOnPlate. This was introduced by #199 (revise snapshot implementation), where a snapshot now consists of copies of Term. So why is a snapshot making a copy of a disposed Term, and why is a disposed Term on the plate at the time that a snapshot is taken?

pixelzoom commented 2 years ago

To reproduce manually:

  1. Start sim, go to Basics screen
  2. Put 1 sphere on the plate, take a snapshot (snapshot1)
  3. Select snapshot1 and restore it.
  4. Press the clear button on the balance scale.
  5. Select snapshot1 and restore it. This will trigger the failure.

The problem is that the snapshot Terms are being put on the scale, then disposed when the clear button is pressed. When restoring a snapshot, we need to put copies of the snapshot Terms on the scale.

pixelzoom commented 2 years ago

Fixed in the above commit, by making a copy of each Term when restoring a snapshot.

Closing.