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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep builtin_console actions not complain args #11617

Merged
merged 5 commits into from
Sep 18, 2023

Conversation

zhongwencool
Copy link
Member

@zhongwencool zhongwencool commented Sep 15, 2023

Fixes https://emqx.atlassian.net/browse/EMQX-10992
Don't need changelog, v5.2.0 is ok.

There was previously a bug allowing invalid fields:

The API for creation/update did not validate the args field, and rules were being created with default args.

The configuration file also did not validate the args field.

Now after being fixed, validation has been enabled:

This causes any rules/configurations saved earlier with invalid args to no longer work.

We fixed the validate here:
78c5a77#diff-5799d1ec01ad3359596ab22f7781d2b34e8f7909194bb0785f7d1dbe677a0d88L202-L208

compatibility with actions. args

rule_engine {
  ignore_sys_message = true
  jq_function_default_timeout = 10s
  rules {
    rule_u54w {
      actions = [
        {
          args {}
          function = console
        }
      ]
      description = ""
      enable = true
      metadata {created_at = 1694748634418}
      name = ""
      sql = "SELECT\n  *\nFROM\n  \"t/#\" \n  WHERE payload.message.header.function='pmMsgReq'"
    }
  }
}

And
image

Summary

馃 Generated by Copilot at d72348c

Fix a validation bug for the builtin_action_console rule action and update the emqx_rule_engine version. The bug caused the console action to fail validation when saving the rule config due to an invalid args field. The fix removes the args field from the console action config and adds it to the schema as a deprecated and ignored field. The version update reflects the bug fix and other changes in the application.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

kjellwinblad
kjellwinblad previously approved these changes Sep 15, 2023
Copy link
Contributor

@kjellwinblad kjellwinblad left a comment

Choose a reason for hiding this comment

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

Looks ok to me but would be great with a test case to ensure that we don't break this in the future!

zmstone
zmstone previously approved these changes Sep 15, 2023
zmstone
zmstone previously approved these changes Sep 15, 2023
thalesmg
thalesmg previously approved these changes Sep 15, 2023
Copy link
Contributor

@thalesmg thalesmg left a comment

Choose a reason for hiding this comment

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

Nit: maybe this could have a test case?

@@ -647,7 +647,7 @@ set_keepalive(put, #{bindings := #{clientid := ClientID}, body := Body}) ->
error ->
{400, 'BAD_REQUEST', "Interval Not Found"};
{ok, Interval} ->
case emqx_mgmt:set_keepalive(emqx_mgmt_util:urldecode(ClientID), Interval) of
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: is this change intended for this PR? Seems unrelated. 馃

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, It's not related, I just fix this incidentally, because keepalive api is hidden for swagger.

Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
@zhongwencool zhongwencool dismissed stale reviews from thalesmg and zmstone via 5490807 September 18, 2023 08:11
@zhongwencool zhongwencool merged commit c868264 into emqx:release-52 Sep 18, 2023
131 checks passed
@zhongwencool zhongwencool deleted the rule-engine-console-args branch September 18, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants