Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CT: Assertion failed: openingLeft must be <= openingRight #212

Closed
pixelzoom opened this issue Nov 18, 2023 · 4 comments
Closed

CT: Assertion failed: openingLeft must be <= openingRight #212

pixelzoom opened this issue Nov 18, 2023 · 4 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Nov 18, 2023

After addressing missing dependencies in #211 and phetsims/axon#441, CT is now reporting:

gas-properties : fuzz : unbuilt
http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/gas-properties/gas-properties_en.html?continuousTest=%7B%22test%22%3A%5B%22gas-properties%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1700350076456%22%2C%22timestamp%22%3A1700350484715%7D&brand=phet&ea&fuzz
Query: brand=phet&ea&fuzz
Uncaught Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/assert/js/assert.js:28:13)
at assert (IdealGasLawContainer.ts:230:14)
at getOpeningLeft (IdealGasLawContainer.ts:248:55)
at getOpeningWidth (IdealGasLawContainer.ts:114:56)
at derivation (DerivedProperty.ts:51:11)
at getDerivedValue (DerivedProperty.ts:174:17)
at listener (TinyEmitter.ts:123:8)
at emit (ReadOnlyProperty.ts:329:22)
at _notifyListeners (ReadOnlyProperty.ts:276:13)
at unguardedSet (ReadOnlyProperty.ts:260:11)
[URL] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1700350076456%2Fgas-properties%2Fgas-properties_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz&duration=90000&testInfo=%7B%22test%22%3A%5B%22gas-properties%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1700350076456%22%2C%22timestamp%22%3A1700350484715%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1700350076456%2Fgas-properties%2Fgas-properties_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz&duration=90000&testInfo=%7B%22test%22%3A%5B%22gas-properties%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1700350076456%22%2C%22timestamp%22%3A1700350484715%7D
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/gas-properties/gas-properties_en.html?continuousTest=%7B%22test%22%3A%5B%22gas-properties%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1700350076456%22%2C%22timestamp%22%3A1700350484715%7D&brand=phet&ea&fuzz
[CONSOLE] enabling assert
[CONSOLE] continuous-test-load
[CONSOLE] Assertion failed: openingLeft -900 must be <= openingRight -2000
[PAGE ERROR] Error: Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/assert/js/assert.js:28:13)
at IdealGasLawContainer.getOpeningLeft (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:172:15)
at IdealGasLawContainer.getOpeningWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:187:56)
at http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:69:163
at getDerivedValue (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/DerivedProperty.js:30:12)
at DerivedProperty.getDerivedPropertyListener (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/DerivedProperty.js:119:17)
at TinyProperty.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/TinyEmitter.js:96:9)
at DerivedProperty._notifyListeners (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/ReadOnlyProperty.js:250:23)
at DerivedProperty.unguardedSet (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/ReadOnlyProperty.js:199:14)
at DerivedProperty.set (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/ReadOnlyProperty.js:184:12)
[CONSOLE] continuous-test-error
[CONSOLE] Assertion failed: openingLeft -900 must be <= openingRight -2000
[PAGE ERROR] Error: Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/assert/js/assert.js:28:13)
at IdealGasLawContainer.getOpeningLeft (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:172:15)
at IdealGasLawContainer.getOpeningWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:187:56)
at IdealGasLawContainer.setWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:124:33)
at IdealGasLawContainer.step (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:101:12)
at ExploreModel.stepSystem (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:236:20)
at ExploreModel.stepModelTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:212:10)
at ExploreModel.stepRealTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/BaseModel.js:108:10)
at ExploreModel.step (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/BaseModel.js:96:12)
at http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/joist/js/Sim.js:339:22
[CONSOLE] continuous-test-error
[CONSOLE] Assertion failed: openingLeft -900 must be <= openingRight -2000
[PAGE ERROR] Error: Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/assert/js/assert.js:28:13)
at IdealGasLawContainer.getOpeningLeft (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:172:15)
at IdealGasLawContainer.getOpeningWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:187:56)
at IdealGasLawContainer.setWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:124:33)
at IdealGasLawContainer.step (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:101:12)
at ExploreModel.stepSystem (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:236:20)
at ExploreModel.stepModelTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:212:10)
at ExploreModel.stepRealTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/BaseModel.js:108:10)
at ExploreModel.step (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/BaseModel.js:96:12)
at http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/joist/js/Sim.js:339:22
[CONSOLE] continuous-test-error
[CONSOLE] Assertion failed: openingLeft -900 must be <= openingRight -2000
[PAGE ERROR] Error: Error: Assertion failed: openingLeft -900 must be <= openingRight -2000
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/assert/js/assert.js:28:13)
at IdealGasLawContainer.getOpeningLeft (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:172:15)
at IdealGasLawContainer.getOpeningWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:187:56)
at IdealGasLawContainer.setWidth (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:124:33)
at IdealGasLawContainer.step (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawContainer.js:101:12)
at ExploreModel.stepSystem (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:236:20)
at ExploreModel.stepModelTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/IdealGasLawModel.js:212:10)
at ExploreModel.stepRealTime (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/model/BaseModel.js:108:10)
at listener (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/gas-properties/js/common/view/BaseScreenView.js:50:19)
at TinyEmitter.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1700350076456/chipper/dist/js/axon/js/TinyEmitter.js:96:9)
[CONSOLE] continuous-test-error

id: "Sparky Node Puppeteer"
Snapshot from 11/18/2023, 4:27:56 PM
@pixelzoom pixelzoom self-assigned this Nov 18, 2023
@pixelzoom pixelzoom changed the title CT: Assertion failed: openingLeft -900 must be <= openingRight -2000 CT: Assertion failed: openingLeft must be <= openingRight Dec 14, 2023
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 15, 2023

The failure occurs in IdealGasLawContainer getOpeningLeft, see below. In the above commit, I added more info to the assertion message, to tell whether the if or else code path is failing. It's the if path that's failing, when the lid is "on".
`

  public getOpeningLeft(): number {

    let openingLeft = null;

    if ( this.lidIsOnProperty.value ) {
      openingLeft = this.left - this.wallThickness + this.lidWidthProperty.value;

      // Round to nearest pm to avoid floating-point error, see https://github.com/phetsims/gas-properties/issues/63
      openingLeft = Utils.roundSymmetric( openingLeft );
    }
    else {
      openingLeft = this.left + this.openingLeftInset;
    }
    assert && assert( openingLeft <= this.getOpeningRight(),
      `openingLeft ${openingLeft} must be <= openingRight ${this.getOpeningRight()}, lidIsOn=${this.lidIsOnProperty.value}` );

    return openingLeft;
  }

So lidWidthProperty probably has not been updated when this derivation happens, also in IdealGasLawContainer:

    this.isOpenProperty = new DerivedProperty(
      [ this.lidIsOnProperty, this.lidWidthProperty, this.boundsProperty ],
      ( lidIsOn, lidWidth, bounds ) => !lidIsOn || this.getOpeningWidth() !== 0
    );

@pixelzoom
Copy link
Contributor Author

IdealGasLawContainerNode.ts confirms that the lid is being put on (lidIsOnProperty) before it is width is changed (lidWidthProperty):

    container.lidIsOnProperty.link( lidIsOn => {
      if ( lidIsOn ) {

        // restore the lid to the fully-closed position
        container.lidWidthProperty.value = container.getMaxLidWidth();

@pixelzoom
Copy link
Contributor Author

Fixed in the above commit by simplifying the derivation of isOpenProperty, so that it no longer involves calling getOpeningLeft. I'll leave this open for a few CT cycles to confirm.

@pixelzoom
Copy link
Contributor Author

CT looks good. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant