🐛 Fix mql failure for customGroup defined implicit arrays#6273
Merged
Conversation
Contributor
Author
|
@tas50 I'm proposing a fix here, but it needs testing to make sure nothing breaks. |
Contributor
network.routes.first{*}
network.routes.first{*}network.routes.first{*}
network.routes.first{*}network.routes.first{*}
network.routes.first{*}
Bajusz15
commented
Dec 8, 2025
Comment on lines
+262
to
+266
| { | ||
| Code: "customGroups.first.name", | ||
| ResultIndex: 0, | ||
| Expectation: "group1", | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
Without the fix, this would fail with the following error:
--- FAIL: TestResource_List_Builtins (0.01s)
--- FAIL: TestResource_List_Builtins/customGroups.first.name (0.00s)
/Users/matebajusz/go/src/go.mondoo.com/cnquery/mql/testutils.go:107: failed to compile code: cannot find field 'name' in customGroups
Same problem that @tas50 noticed with network.routes
jaym
approved these changes
Dec 9, 2025
Contributor
jaym
left a comment
There was a problem hiding this comment.
Tested. Compiled code makes more sense now
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem with list resource when defined as implicit array (when defined like []element, there is no failure).
The following query doesn't work as expected:
With this change, the query works as expected. Below is explanation:
compileResourceChildAccessreturns the wrong type, and then the it fails to access.list.compileResourceChildAccessshould return the child element type, not the implicit array type.Alternatively, we can use
network.routes.list.first{*}for now, butnetwork.routes.list.first.list: no data availabledoesn't look right.