Closed KatieWoe closed 1 year ago
In 2/4/21 dev meeting, we established that this may be due to CT multi-touch fuzz testing ( ?fuzzPointers=2
) being enabled for phetsims/aqua#106.
build-a-molecule : multitouch-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/build-a-molecule/build-a-molecule_en.html?continuousTest=%7B%22test%22%3A%5B%22build-a-molecule%22%2C%22multitouch-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1647595636252%22%2C%22timestamp%22%3A1647597604016%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
Uncaught Error: Bond not found
Error: Bond not found
at LewisDotModel.getBondDirection (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/LewisDotModel.js:122:11)
at Kit.getBondDirection (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:329:31)
at new MoleculeBondNode (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/MoleculeBondNode.js:62:31)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/MoleculeBondContainerNode.js:22:14
at Array.map (<anonymous>)
at new MoleculeBondContainerNode (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/MoleculeBondContainerNode.js:21:37)
at KitPlayAreaNode.addMoleculeBondNodes (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/KitPlayAreaNode.js:77:39)
at addedMoleculeListener (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/BAMScreenView.js:148:30)
at addedEmitterListener (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/BAMScreenView.js:217:11)
at TinyEmitter.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/axon/js/TinyEmitter.js:68:9)
id: Bayes Chrome
Snapshot from 3/18/2022, 3:27:16 AM
----------------------------------
build-a-molecule : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/build-a-molecule/build-a-molecule_en.html?continuousTest=%7B%22test%22%3A%5B%22build-a-molecule%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1647595636252%22%2C%22timestamp%22%3A1647598695412%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Uncaught TypeError: Cannot read properties of null (reading 'atoms')
TypeError: Cannot read properties of null (reading 'atoms')
at Function.getCombinedMoleculeFromBond (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/MoleculeStructure.js:546:10)
at Kit.getPossibleMoleculeStructureFromBond (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:578:30)
at Kit.canBond (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:667:88)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:606:46
at Array.forEach (<anonymous>)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:597:18
at Array.forEach (<anonymous>)
at Kit.attemptToBondMolecule (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:595:20)
at Kit.atomDropped (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/model/Kit.js:206:14)
at DragListener.end [as _end] (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/build-a-molecule/js/common/view/BAMScreenView.js:410:20)
id: Bayes Chrome
Snapshot from 3/18/2022, 3:27:16 AM
I have a way to duplicate this manually. This requires a touch screen.
Here's a summary of what is causing this problem: If the "kit" is changed by selecting a different on in the carousel while an atom is being dragged, and that atom is subsequently released in a place where it would bond to something, the code can't find the Lewis dot model associated with the dropped atom because they are kept with the kits.
I imagine this would have been found earlier and designed differently if we were designing for multitouch when this sim was being created, but we weren't. I can think of several refactorings that would eliminate this problem, such as keeping the Lewis dot models with the bonds instead of in a separate list, but that would be an invasive change. So here is what I've done: I added some code that will check to see if the selected kit was changed while an atom was being dragged and, if so, it puts the atom back in the kit. This not only appears to fix the problem, but will also prevent atoms from bonding into molecules when they are invisible.
I'll leave this in place overnight and check if the problem disappears from CT and doesn't add anything new. I'll then review it with @jonathanolson to see if he's okay with this or would like to try something else.
At the moment, this issue still recurs on CT occasionally. @jonathanolson and I decided that I should go ahead and put the "workaround-ish" fix back in and see if everything clears up.
I've added back the code for better handling of the case where the kit is changed while the atom is being dragged. I'll keep an eye on CT and if the error doesn't appear after a day or so, this issue can be closed.
The error has not recurred on CT since the commit above. Closing.