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

Added ceremonial break. #3517

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Added ceremonial break. #3517

merged 1 commit into from
Oct 1, 2024

Conversation

mitchell-as
Copy link
Contributor

@mitchell-as mitchell-as commented Oct 1, 2024

BugDX-3088 Buildexpression unmarshalling may be dropping args

Function calls in JSON have a single argument object with a list of values. We already assert that the object is of length 1 (the list of args;

// m is a mapping of function name to arguments. There should only be one
// set of arguments. Since the arguments are key-value pairs, it should be
// a map[string]interface{}.
if len(m) > 1 {
return nil, errs.New("Function call has more than one argument mapping")
}
), but a cursory glance at a later loop in the code may lead one to believe there is more than one object. I've added a ceremonial break with a comment for clarity.

We're not dropping any args; the interface contains a list of all arguments.

@mitchell-as mitchell-as marked this pull request as ready for review October 1, 2024 18:42
Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

This doesn't seem like it's solving anything. It's now defaulting to the first entry rather than the last. The issue here seems to be that it's not considering all arguments, which so far is a non-issue as no function calls exist at this level (yet!) that have more than one argument.

@mitchell-as
Copy link
Contributor Author

mitchell-as commented Oct 1, 2024

No, this "non-fix" is making a point that the length of m is expected to be 1 (thanks to the assertion above). It is impossible for there to be more than one "argument". What you take to be an argument is actually a list of arguments (which you can see being processed below).

This is not a bug. If there will be more than one "thing" in the argument object, then we will have to file a task to expand what we're doing here.

Or am I completely missing something?

Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

My bad; I missed the comment about m>1.

@mitchell-as mitchell-as merged commit 851072a into version/0-47-0-RC1 Oct 1, 2024
16 of 20 checks passed
@mitchell-as mitchell-as deleted the mitchell/dx-3088 branch October 1, 2024 20:57
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.

2 participants