tildeio / ember-element-helper

Dynamic element helper for Glimmer templates.
MIT License
44 stars 23 forks source link

bumping 1 addon's version of ember-element-helper to 0.6.1 causes downstream test failures #84

Closed angelayanpan closed 2 years ago

angelayanpan commented 2 years ago

Hi, I bumped 1 addon's dependency on ember-element-helper from 0.5.5 to 0.6.1

I also added a resolution in the addon to "ember-element-helper": "^0.6.1".

Once the PR merged, 2 other downstream addons had many test failures: Each Test failure had the same error:

global failure: Error: Assertion Failed: The `element` helper polyfill encountered an unexpected error. Please report the issue at http://github.com/tildeio/ember-element-helper with the usage and conditions that caused this error."Source:
Error: Assertion Failed: The `element` helper polyfill encountered an unexpected error. Please report the issue at http://github.com/tildeio/ember-element-helper with the usage and conditions that caused this error.
    at Object.assert (http://localhost:7357/assets/vendor.js:41738:15)
    at http://localhost:7357/assets/vendor.js:344134:32
    at http://localhost:7357/assets/vendor.js:14440:27
    at deprecateMutationsInTrackingTransaction (http://localhost:7357/assets/vendor.js:63413:9)
    at http://localhost:7357/assets/vendor.js:14439:66
    at SimpleClassicHelperManager.getValue (http://localhost:7357/assets/vendor.js:14450:14)
    at http://localhost:7357/assets/vendor.js:49844:70
    at http://localhost:7357/assets/vendor.js:54144:37
    at track (http://localhost:7357/assets/vendor.js:64057:7)
    at valueForRef (http://localhost:7357/assets/vendor.js:54143:44)"

on ember 3.26

Windvis commented 2 years ago

@angelayanpan with downstream addons you mean addons that consume the addon where you bumped ember-element-helper to v0.6.1?

If so, that is expected I think. The yarn resolutions only work for the dummy / test app of the addon, not the consumer of the addon. The real fix is making sure that only 1 version is part of the node_modules tree, either by PRing ember-element-helper 0.6.1 bumps to all nested addons where needed, or using resolutions in the final app that consumes all the addons.

It would be a lot easier if ember-element-helper was released as a v1 release though.

angelayanpan commented 2 years ago

PRing ember-element-helper 0.6.1 bumps to all nested addons where needed

this is very hard. LOL requires a lot of Orchestrating. we have very complex nested addons

SergeAstapov commented 2 years ago

@angelayanpan as discussed during Embroider office hours, I wonder if path forward would be to update addons to use as "ember-element-helper": "^0.5.0 || ^0.6.0"

That way, yarn/npm/pnpm/etc. should resolve to single version of ember-element-helper at any given point of time and prevent clobbering of two versions by Ember CLI.

angelayanpan commented 2 years ago

just wanted to give an update before closing this:

basically added resolution to 0.6.1 in all consumers first. and then that fan-ed out a bit. but eventually I was able to bump it to 0.6.1

chrismllr commented 2 years ago

I am seeing this same error on Ember 3.28, but it looks to be triggered by ember-animated:

Uncaught (in promise) Error: Assertion Failed: The `element` helper polyfill encountered an unexpected error. Please report the issue at http://github.com/tildeio/ember-element-helper with the usage and conditions that caused this error.
    at assert (index.js:129:13)
    at element.js:14:1
    at index.js:5088:25
    at deprecateMutationsInTrackingTransaction (validator.js:142:7)
    at index.js:5087:9
    at SimpleClassicHelperManager.getValue (index.js:5098:12)
    at manager.js:847:52
    at reference.js:121:35
    at track (validator.js:709:5)
    at valueForRef (reference.js:120:21)
Error occurred:

- While rendering:
  -top-level
    application
      animated-container

Versions:

    "ember-animated": "^1.0.4",
    "ember-element-helper": "^0.6.1",
Windvis commented 2 years ago

@chrismllr It's most likely the same issue where there are multiple versions of the addon in your node_modules tree. npm ls ember-element-helper should tell you which ones and https://github.com/salsify/ember-cli-dependency-lint can help you lint against it.

I would try to find out what brings in an older version and PR version bumps to those addons, and in the meanwhile you can use npm overrides or yarn resolutions to force a single version in your app.

chrismllr commented 2 years ago

Yes! was just typing up an edit to the above:

Mistakenly forgot to add context that this started occurring after updating to ember-animated latest version, which jives with OP's original issue (only updating one addon to latest version causes downstream issues).

Adding a yarn resolution to 0.6.1 seems to have fixed the issue

SergeAstapov commented 2 years ago

@chrismllr looks like you have same issue that @angelayanpan had which is actually not caused by ember-element-helper or ember-animated but rather by npm dependencies tree.

@chrismllr could you please make sure you have single ember-element-helper across the dependencies tree? I bet you have combination of two or more versions of ember-element-helper in node_modules

chrismllr commented 2 years ago

Looks like oldest version I've got is 0.6.0, with ember-basic-dropdown as the culprit:

=> Found "ember-element-helper@0.6.0"
info Has been hoisted to "ember-element-helper"
info Reasons this module exists
   - "workspace-aggregator-98065c26-008e-4a3b-9322-918f3faba17f" depends on it
   - Hoisted from "_project_#[REDACTED]#ember-basic-dropdown#ember-element-helper"
   - Hoisted from "_project_#[REDACTED]#ember-power-select#ember-basic-dropdown#ember-element-helper"
info Disk size without dependencies: "84KB"
info Disk size with unique dependencies: "35.44MB"
info Disk size with transitive dependencies: "217.44MB"
info Number of shared dependencies: 278
=> Found "[REDACTED]#ember-element-helper@0.6.1"
info This module exists because "_project_#[REDACTED]" depends on it.
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "35.42MB"
info Disk size with transitive dependencies: "217.42MB"
info Number of shared dependencies: 278
=> Found "ember-animated#ember-element-helper@0.6.1"
info This module exists because "_project_#[REDACTED]#ember-animated" depends on it.
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "35.42MB"
info Disk size with transitive dependencies: "217.42MB"
info Number of shared dependencies: 278

Will try a total clean of node_modules and see if that helps

SergeAstapov commented 2 years ago

@chrismllr as far as I can see, ember-basic-dropdown depends on "ember-element-helper": "^0.6.0" hence you need to make yarn (or pnpm or npm, whichever you use) to properly hoist single version of ember-element-helper

chrismllr commented 2 years ago

Ah, so the culprit for the message was the AST transform commit between 0.6.0 and 0.6.1, therefor even 0.6.0 will throw this error? Adding resolution now, and will see about ember-basic-dropdown's progress. Thx!