Explicitly disable Mustache partials#138944
Merged
joegallo merged 9 commits intoelastic:mainfrom Dec 3, 2025
Merged
Conversation
Collaborator
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
rjernst
approved these changes
Dec 2, 2025
| public void partial(TemplateContext tc, String variable, String indent) { | ||
| // throwing a mustache exception here is important because this gets caught, handled (closing readers, etc), | ||
| // and re-thrown in the mustache parser itself | ||
| throw new MustacheException("partial templates are not supported"); |
Member
There was a problem hiding this comment.
Should the exception message contain the variable name for additional context? Something like Cannot expand 'foobar' because partial templates are not supported
Contributor
Author
There was a problem hiding this comment.
Member
There was a problem hiding this comment.
Personally I think "not found" is a little confusing because it's not that if we "found" it we would support it, it's that we don't support these at all.
Contributor
Author
There was a problem hiding this comment.
No worries, I'll make it like you had originally suggested.
Contributor
Author
|
I can't get CI to pass because of some ESQL failures, so I'm merging in |
4 tasks
This was referenced Dec 3, 2025
Collaborator
joegallo
added a commit
to joegallo/elasticsearch
that referenced
this pull request
Dec 3, 2025
joegallo
added a commit
to joegallo/elasticsearch
that referenced
this pull request
Dec 3, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Dec 3, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Dec 3, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Dec 3, 2025
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.
They're already documented as being unsupported, this just makes them be unsupported more officially by rejecting them in the template compilation rather than 'merely' having it not work. This allows us to have a better error message.
In preparation for upgrading to
mustache.java0.9.14, I also expanded two test exception message regexes to be more accepting. That'll help me on the BWC test side of the house on #138923.Note: I intend to backport this pretty widely, but I haven't completely figured out the destinations for it just yet.