-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
CI Cleanup #20682
CI Cleanup #20682
Conversation
Something probably broke/got lost along the way then. The point of
The reason it has to be tested separately is the flag is the be set before Ember is loaded and it gets consumed by module level code and cannot be unset (or set later) |
Yes, debug and prod-with-inspector were already being tested and are still being tested. Prod-without-inspector was never actually being tested because of the way the test suite works. It can run against the ember bundle built for prod mode. But it also always loads the template compiler bundle, and that is always built in dev mode, and it always mutates EmberENV to enable debug-render-tree. I am planning to implement the improved API for runtime template compilation from RFC 931, which will let us stop loading the older template-compiler bundle and all its quirks into the test suite. I think that would be a reasonable way to implement coverage for prod-without-inspector. |
I understand that it is currently/already broken on main today, and likely have been broken from quite some time (I think @kategengler noticed it and mentioned to me a while back). However, I am not sure about that it never worked. For example:
I think it would have been difficult/unusual for someone to notice these kind of differences and went out of their way to fix them if the tests never worked correctly (who runs prod tests locally?), and I am pretty sure it was working when I originally added it. Anyway, as long as it is understood that the scenario is definitely important to test (essentially we are not testing the most common production scenario right now), and as long as that is tracked (we should probably open an issue?) and there is a plan to restore it soon-ish, that seems good to me. |
Actually, based on your description of the problem I think there can be a relatively easy fix without waiting for the other refactor to be complete. I think something about how the scripts-loading works have probably changed, which is not surprising given the build refactors. In tests/index.html we do load It seems like something must have changed to cause the modules from the template compiler bundler to sometimes stomp over the For this particular case though, we can probably force a require to that module before loading the template compiler as a quick fix, which seems worth doing for now to regain the pretty important test coverage that we apparently lost for some time. |
Ah, my educated guess would be that this broke when we switch from ember having its internal loader to being "real modules" in the global/shared loader. It was probably the case that those internal modules were kept separate ( That seems like it would have real world implications/consequences to apps as well – essentially if you load the template compiler in production, it have some chance of stomping over some of the ember modules and replacing them with the debug version of the same module.. so you're running a mix of production and debug modules.. which certainly.. can't be good? I suppose too few people actually use the runtime compiler, and the chance of things going wrong this way are slim, and when it does, probably nobody could figure out what is happening 🤷🏼 |
Thanks for investigating. I will open an issue to track the lack of test coverage before merging this. |
I'll add that there's no reason we couldn't build the template compiler bundle with the prevailing DEBUG mode, we just don't, and I have been hesitant to make changes because I'd rather keep it as stable as possible and then migrate people off it entirely when the new API ships. |
tests/index.html
Outdated
var edition = QUnit.urlParams.edition || 'octane'; | ||
|
||
if (edition === 'octane') { | ||
EmberENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This defaults to false https://github.com/emberjs/ember.js/blob/main/packages/%40ember/-internals/environment/lib/env.ts#L97
I suspect the others also default to their "classic" values. There are other tests that set the optional flags one way or another and probably what we need to do is remove the optional features we no longer support, but at the very least, our tests should keep the octane version of tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I'm pretty sure it's impossible for a real app to set these to the non-octane values because of the assertions in lib/index.js. So we can probably just rip these flags out and hard-code the octane behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it is just missed cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually looks like there's no assertion on async observers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should deprecate synchronous observers. Whether by 6 or by 7 I don't have a strong opinion, it would depend on how prevalent the community dependence still is.
I'm going to separately land cleanup for the octane-mandatory optional features and then rebase this PR. |
I searched through our entire dependency graph and couldn't find anything consuming DISABLE_SOURCE_MAPS or BROCCOLI_ENV. I think they are entirely vestigial. DEBUG_RENDER_TREE was being set in an irrelevant place, because it doesn't take effect during the build, it takes effect during the test run. But when I tried to enable it there, I found that it never has any effect anyway. The issue is that DEBUG_RENDER_TREE is always enabled in dev mode, and even when the test suite is built in prod mode it still loads ember-template-compiler.js, which always includes dev-mode code that forces DEBUG_RENDER_TREE to on. So there's no way to run the test suite with DEBUG_RENDER_TREE off, so there's no need to have an extra test that tries to turn it on.
Ok, so I've now separately removed the unreachable optional features post-4.0. As Katie pointed out, the default-async-observers is still a legitimate option. In terms of how we test it, it doesn't need separate test runs with the global flag in different states, because the tests ask explicitly for async vs sync observers where they care, and the flag only changes the default for that argument. No test does anything different under the different flag values. |
The expected-but-incomplete test that CI is showing is removed in this PR and I removed it from the GitHub configuration but existing PRs don't reflect that. |
I'm tracking the DEBUG_RENDER_TREE tests in emberjs/rfcs#933 because that is tracking the work for the new runtime template compiler API. |
I searched through our entire dependency graph and couldn't find anything consuming
DISABLE_SOURCE_MAPS
orBROCCOLI_ENV
. I think they are entirely vestigial.DEBUG_RENDER_TREE
was being set in an irrelevant place, because it doesn't take effect during the build, it takes effect during the test run. But when I tried to enable it there, I found that it never has any effect anyway. The issue is that DEBUG_RENDER_TREE is always enabled in dev mode, and even when the test suite is built in prod mode it still loads ember-template-compiler.js, which always includes dev-mode code that forces DEBUG_RENDER_TREE to on. So there's no way to run the test suite with DEBUG_RENDER_TREE off, so there's no need to have an extra test that tries to turn it on.edition=classic
: we dropped this at ember 4, but we're still doing extra test runs for it.