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

Dev UI: Add strictRendering=false to Qute engine #18416

Merged
merged 2 commits into from
Jul 7, 2021
Merged

Dev UI: Add strictRendering=false to Qute engine #18416

merged 2 commits into from
Jul 7, 2021

Conversation

phillip-kruger
Copy link
Member

Fix #18413

Signed-off-by:Phillip Kruger [email protected]

Copy link
Member

@sberyozkin sberyozkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phillip-kruger Thanks for a quick fix :-), LGTM, though indeed lets wait for more approvals before merging

@gastaldi
Copy link
Contributor

gastaldi commented Jul 5, 2021

I think that's okay for the DevConsole, but I'll let @mkouba have the final say here 😉

gsmet
gsmet previously requested changes Jul 5, 2021
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's the right fix. Why is the property not defined? I would rather fix the issue with this property rather than changing this globally (and thus miss potential errors).

@phillip-kruger
Copy link
Member Author

The default has changed (see #18227) but I can investigate some more.

@sberyozkin
Copy link
Member

@gsmet This fix only affects the dev console templates, it is not doing it globally - the user templates are not affected

@stuartwdouglas
Copy link
Member

@mkouba was the intention of this to completely ban null values? We do:

                TemplateInstance devTemplateInstance = devTemplate
                        .data("currentExtensionName", extName)
                        .data("flash", FlashScopeUtil.getFlash(ctx))
                        .data("currentRequest", ctx.request());

where extName may be null, but there is now no way to check for a null value in the template.

@phillip-kruger
Copy link
Member Author

Some more info: I am not sure if what case that var is null. In my basic tests there is always a value.
We use it when we build the page to create the title and the heading. In the template we check it like this:

{#if currentExtensionName}

So if it would be null, the title will be a default value.

@geoand
Copy link
Contributor

geoand commented Jul 6, 2021

If null can't be used, then what should be used and can be checked for in the templates?

@stuartwdouglas
Copy link
Member

I think we should merge this for now, as it is better than the current state of affairs, however I do have reservations about making strict rendering the default, as it makes working with null values almost impossible.

I have pushed a smoke test to this PR so we don't accidentally break the main page again, when it passes we should merge it.

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 7, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 7376972

Status Name Step Test failures Logs Raw logs
JVM Tests - JDK 11 Build Test failures Logs Raw logs
JVM Tests - JDK 11 Windows Build Test failures Logs Raw logs
JVM Tests - JDK 16 Build Test failures Logs Raw logs
Native Tests - Misc4 Build ⚠️ Check → Logs Raw logs

Full information is available in the Build summary check run.

Test Failures

⚙️ JVM Tests - JDK 11 #

📦 extensions/vertx-http/deployment

io.quarkus.vertx.http.devconsole.DevConsoleSmokeTest.testDevConsoleNotBroken line 23 - More details - Source on GitHub


⚙️ JVM Tests - JDK 11 Windows #

📦 extensions/vertx-http/deployment

io.quarkus.vertx.http.devconsole.DevConsoleSmokeTest.testDevConsoleNotBroken line 23 - More details - Source on GitHub


⚙️ JVM Tests - JDK 16 #

📦 extensions/vertx-http/deployment

io.quarkus.vertx.http.devconsole.DevConsoleSmokeTest.testDevConsoleNotBroken line 23 - More details - Source on GitHub

@mkouba
Copy link
Contributor

mkouba commented Jul 7, 2021

@mkouba was the intention of this to completely ban null values?

@stuartwdouglas Not at all. null is a valid value that should be treated as falsy in the {#if} section. Strict rendering is about throwing an exception if no value is found, i.e. if the engine was not able to evaluate the expression correctly. Previously, we did throw an exception for "standalone" expressions, e.g. {foo.bar}. strictRendering=false means that we extend this behavior to any expression used, including section params such as {#if foo.bar}.

I need to check the original error though. It might be that we have some bug in there. In general, if a map has a key=null pair then {#if map.key}nok{#else}null{/if} should render null.

@mkouba
Copy link
Contributor

mkouba commented Jul 7, 2021

I'm not sure it's the right fix. Why is the property not defined? I would rather fix the issue with this property rather than changing this globally (and thus miss potential errors).

@gsmet I'm going to create a separate issue to verify all DEV UI templates and switch to strict rendering eventually. For now it's probably safer to disable it globally.

@gsmet
Copy link
Member

gsmet commented Jul 7, 2021

OK yeah, let's fix the issues first and reconsider later.

But what I would like is to enable it at some point and ALSO to have simple tests for Dev UI just checking that the pages of every extension don't return a 500. That should be relatively easy and allow to catch at least some errors with a small investment.

@sberyozkin
Copy link
Member

@gsmet, So can your change request be dismissed at this stage ?

@gsmet gsmet dismissed their stale review July 7, 2021 13:27

Let's do this for now.

@gsmet gsmet merged commit 043f807 into quarkusio:main Jul 7, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jul 7, 2021
@phillip-kruger phillip-kruger deleted the dev-ui-qute-fix branch July 8, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessing DevConsole fails with InternalServerError in the current snapshot
7 participants