Make ember-lts-4.12 compat scenario runnable#322
Merged
NullVoxPopuli merged 1 commit intoember-cli:nvp/its-vite-timefrom Apr 19, 2026
Merged
Conversation
83933fa to
b60d722
Compare
Two stacked runtime issues were blocking ember-lts-4.12 once the `require` import issue from ember-cli#321 cleared. Both only affect the compat path (ENABLE_COMPAT_BUILD=true, ember4 deps overrides) and are hidden for ember-source >= 6 because the upstream code was rewritten. 1. "Cannot read properties of undefined (reading 'has')" at `makeComputedDecorator` → `COMPUTED_GETTERS.has(...)`. ember-source <= 5.x's `@ember/-internals/metal` has `let COMPUTED_GETTERS; if (DEBUG) { COMPUTED_GETTERS = new WeakSet(); }` paired with `assert(..., !COMPUTED_GETTERS.has(...))`. `DEBUG` comes from `@glimmer/env`, whose published default is `DEBUG = false`. Without something resolving `DEBUG` at compile time, rollup tree-shakes the init but the `assert` predicate still runs eagerly, so `COMPUTED_GETTERS` is undefined at runtime. Conditionally add `babel-plugin-debug-macros` (only when ENABLE_COMPAT_BUILD is set) with `flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }]` so the plugin inlines `DEBUG = true` in ember-source. The init and the use stay consistent. Non-compat scenarios don't need the plugin — modern ember-source uses `isDevelopingApp()` from `@embroider/macros`, which `buildMacros()` already handles. 2. ember-qunit@8 + @ember/test-helpers@4 rely on classic-Ember globals that don't exist in a vite build: `start()` auto-calls `loadTests()` which iterates `requirejs.entries`, and `visit` reads `global.EmberENV._APPLICATION_TEMPLATE_WRAPPER`. Both were removed in ember-qunit@9 and @ember/test-helpers@5 respectively. Bump those two pins in the ember4 deps stanza so the scenario exercises the same surface modern scenarios do: ember-qunit: ^8.0.0 -> ^9.0.0 @ember/test-helpers: ^4.0.0 -> ^5.0.0 Both peer `ember-source >= 4.0.0`, so Ember 4.12 is still within the supported range. ember-qunit@9 peers `@ember/test-helpers >=3.0.3`, so the test-helpers bump stays within bounds. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
b60d722 to
0691d3f
Compare
4 tasks
f231990
into
ember-cli:nvp/its-vite-time
19 of 20 checks passed
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gets
ember-lts-4.12green locally by unblocking two stacked runtime issues that surfaced once therequireresolver fix in #321 landed. Both only affect the compat path (ENABLE_COMPAT_BUILD=true+ theember4deps overrides); ember-source >= 6 scenarios don't hit them because the upstream code was rewritten.1.
Cannot read properties of undefined (reading 'has')—COMPUTED_GETTERS.has(...)ember-source <= 5.x (
@ember/-internals/metal):@glimmer/envpublishesDEBUG = false. Without something resolvingDEBUGat compile time, rollup tree-shakes theif (DEBUG)init while theassertpredicate still runs eagerly →COMPUTED_GETTERSis undefined at runtime. ember-source >= 6 switched toisDevelopingApp()from@embroider/macros(whichbuildMacros()already handles), which is why non-compat scenarios don't hit this.Fix: add
babel-plugin-debug-macrosconditionally (only whenENABLE_COMPAT_BUILDis set) inbabel.config.mjs:The plugin inlines
DEBUG = trueat every@glimmer/envimport site in ember-source so the init and the use stay consistent. Gating onENABLE_COMPAT_BUILDkeeps the default build untouched.2. Bump
ember-qunitand@ember/test-helpersin theember4stanzaTwo additional runtime errors were classic-Ember assumptions that don't hold in a vite bundle:
ReferenceError: requirejs is not defined—ember-qunit@8'sstart()auto-callsloadTests(), which enumeratesrequirejs.entriesfrom classic Ember's loader.js.ember-qunit@9dropped that call entirely.Cannot read properties of undefined (reading '_APPLICATION_TEMPLATE_WRAPPER')—@ember/test-helpers@4'ssetup-rendering-context/visitreadsglobal.EmberENV._APPLICATION_TEMPLATE_WRAPPER; classic ember-cli seeded that global from index.html.@ember/test-helpers@5removed every reference toEmberENVand_APPLICATION_TEMPLATE_WRAPPER.Both can be worked around in the test app (passing
{ loadTests: false }toqunitStart, manually assigningglobalThis.EmberENV), but the cleaner fix is to bump the pins so the compat scenario exercises the same API surface modern scenarios already do:const ember4 = { - '@ember/test-helpers': '^4.0.0', + '@ember/test-helpers': '^5.0.0', '@ember/test-waiters': '^3.1.0', '@embroider/compat': '^4.0.3', - 'ember-qunit': '^8.0.0', + 'ember-qunit': '^9.0.0', 'ember-cli': '~4.12.0', };Both bumps peer
ember-source >= 4.0.0, so Ember 4.12 is still within the supported range.ember-qunit@9peers@ember/test-helpers >=3.0.3, so the test-helpers bump stays within bounds.Test plan
pnpm dlx @embroider/try apply ember-lts-4.12 && pnpm install --no-lockfile --ignore-scripts && pnpm --filter ember-page-title build && cd test-app && ENABLE_COMPAT_BUILD=true CI_BROWSER=chrome pnpm test:emberlocally → 31 pass, 0 failpnpm test:emberlocally → 31 pass, 0 fail (the babel plugin is not added withoutENABLE_COMPAT_BUILD)ember-lts-4.12job on CI goes greenember-lts-5.12,ember-lts-6.4,ember-latest,ember-beta,ember-alpharemain greenStill red after this PR
min-supported(ember-source~4.2.0) hits a separate, unrelated failure:@glimmer/[email protected]imports@ember/owner, which didn't ship until Ember 4.10. The scenario'sember4deps stanza will need a@glimmer/component@^1.1.2pin. Out of scope here since the user asked specifically aboutember-lts-4.12.🤖 Generated with Claude Code