phetsims / fourier-making-waves

"Fourier: Making Waves" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

CT: computed state did not match expected state #231

Closed pixelzoom closed 1 year ago

pixelzoom commented 1 year ago
fourier-making-waves : phet-io-fuzz : unbuilt
http://127.0.0.1/continuous-testing/ct-snapshots/1682883231824/fourier-making-waves/fourier-making-waves_en.html?continuousTest=%7B%22test%22%3A%5B%22fourier-making-waves%22%2C%22phet-io-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1682883231824%22%2C%22timestamp%22%3A1682883774919%7D&ea&brand=phet-io&phetioStandalone&fuzz&memoryLimit=1000
Query: ea&brand=phet-io&phetioStandalone&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: computed state did not match expected state
Error: Assertion failed: computed state did not match expected state
at window.assertions.assertFunction (http://127.0.0.1/continuous-testing/ct-snapshots/1682883231824/assert/js/assert.js:28:13)
at assert (phetioEngine.ts:341:20)
at listener (TinyEmitter.ts:119:8)
at emit (ReadOnlyProperty.ts:315:22)
at _notifyListeners (ReadOnlyProperty.ts:266:13)
at unguardedSet (ReadOnlyProperty.ts:250:11)
at set (Property.ts:54:10)
at (Sim.ts:927:56)
id: Sparky Puppeteer
Snapshot from 4/30/2023, 1:33:51 PM
pixelzoom commented 1 year ago

This failure recently started in CT, and it's occurring on every cycle. There has been some conversion of Fourier to TypeScript, but no PhET-iO changes that I'm aware of. I can't diagnose this problem from the stack trace, and I don't really know where to begin.

@samreid @zepumph thoughts?

zepumph commented 1 year ago

Looks like these items are in the "normal" getState but not in the "initial" state.

    "fourierMakingWaves.discreteScreen.model.waveforms.sinusoid": null,
    "fourierMakingWaves.discreteScreen.model.waveforms.triangle": null,
    "fourierMakingWaves.discreteScreen.model.waveforms.square": null,
    "fourierMakingWaves.discreteScreen.model.waveforms.sawtooth": null,
    "fourierMakingWaves.discreteScreen.model.waveforms.wavePacket": null,
    "fourierMakingWaves.discreteScreen.model.waveforms.custom": null,

I see that Waveform is marked as phetioState:false so it looks like a bug that this is bleeding into the state after startup.

Perhaps this fixes things?

Subject: [PATCH] supress assertion when not validating, https://github.com/phetsims/fourier-making-waves/issues/231
---
Index: js/discrete/model/Waveform.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/discrete/model/Waveform.ts b/js/discrete/model/Waveform.ts
--- a/js/discrete/model/Waveform.ts (revision 25d19d09bc351ea8ae0b45a286968a0c9d2f8db1)
+++ b/js/discrete/model/Waveform.ts (date 1683147426369)
@@ -154,7 +154,7 @@
       phetioState: false
     }, providedOptions );

-    super( providedOptions );
+    super( options );

     this.getAmplitudes = options.getAmplitudes;
     this.getInfiniteHarmonicsDataSet = options.getInfiniteHarmonicsDataSet;
pixelzoom commented 1 year ago

Excellent thanks, I've applied that patch.

But how did you get from the reported stack trace to that diagnosis? I see no mention of any of those tandems in the stack trace.

zepumph commented 1 year ago

I started by just trying to load the "phet-io-fuzz" test to reproduce locally. This is the "standalone" version of the the phet-io sim.

It produced the same error on startup, but the console showed this log:

image

So I was taken to Waveform.

pixelzoom commented 1 year ago

Thanks for the clarification @zepumph.

CT shows that that the problem has been resolved for 2 test cycles, so closing.