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

Update XEP-0050: Ad-Hoc Commands #4043

Merged
merged 5 commits into from
Jun 28, 2023
Merged

Update XEP-0050: Ad-Hoc Commands #4043

merged 5 commits into from
Jun 28, 2023

Conversation

pawlooss1
Copy link
Member

@pawlooss1 pawlooss1 commented Jun 22, 2023

This PR updates support for XEP-0050. The actual change that has to be made comes from Chapter 3.4 - Command Actions. More precisely these sentences:

  • "The action "execute" is equivalent to the action specified in the "execute" attribute. If the "execute" attribute is absent, it defaults to "next". A form which has an element and an "execute" attribute which evaluates (taking the default into account if absent) to an action which is not allowed is therefore invalid."
  • "As user-agents treat the absence of an "execute" attribute as equivalent to "next", when the element is provided, it is invalid to return a command that has no "execute" attribute, an actions element, and no action"

In adhoc module's API we need to make sure that we won't ever return result as described.

In addition to those changes I did a minor refactor so the new logic is clear.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jun 22, 2023

small_tests_24 / small_tests / 06c5b94
Reports root / small


small_tests_25 / small_tests / 06c5b94
Reports root / small


small_tests_25_arm64 / small_tests / 06c5b94
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 06c5b94
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 06c5b94
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 06c5b94
Reports root/ big
OK: 4185 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 06c5b94
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 06c5b94
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 06c5b94
Reports root/ big
OK: 4208 / Failed: 0 / User-skipped: 85 / Auto-skipped: 0

muc_light_http_api_SUITE:end_per_suite
{error,
 {{unregistering_failed,
   {amount,1},
   {unregistered_items,
  [{{<<"_invite_to_room_2583">>,
     [{escalus_event_mgr,<0.16846.2>},
    {tc_name,invite_to_room},
    {escalus_cleaner,<0.16845.2>},
    {watchdog,<0.16844.2>},
    {mim_data_dir,
     "/home/circleci/project/big_tests/tests/muc_light_http_api_SUITE_data"},
    {preset,"odbc_mssql_mnesia"},
    {tc_logfile,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4043/178491/odbc_mssql_mnesia.25.3-amd64/big/ct_run.test%408758c638b3b0.2023-06-22_08.35.40/big_tests.tests.muc_light_http_api_SUITE.logs/run.2023-06-22_08.47.56/muc_light_http_api_suite.invite_to_room.203266.html"},
    {tc_group_properties,[{name,positive},parallel]},
    {tc_group_path,[]},
    {data_dir,
     "/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/muc_light_http_api_SUITE_data/"},
    {priv_dir,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4043/178491/odbc_mssql_mnesia.25.3-amd64/big/ct_run.test%408758c638b3b0.2023-06-22_08.35.40/big_tests.tests.muc_light_http_api_SUITE.logs/run.2023-06-22_08.47.56/log_private/"},
    {{saved_modules,mongooseim@localhost,<<"test type">>},
     #{mod_adhoc => #{iqdisc => one_queue,report_commands_node => false},
       mod_amp => #{},
       mod_bosh =>
      #{backend => mnesia,inactivity => 30,max_pause => 120,
        max_wait => infinity,server_acks => false},
       mod_cache_users =>
      #{number_of_segments => 5,strategy => fifo,time_to_live => 2},
       mod_carboncopy => #{iqdisc => no_queue},
       mod_disco =>
      #{extra_domains => [],iqdisc => one_que...

Report log


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 06c5b94
Reports root/ big
OK: 2755 / Failed: 0 / User-skipped: 659 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 06c5b94
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 06c5b94
Reports root/ big
OK: 2395 / Failed: 0 / User-skipped: 680 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 06c5b94
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 06c5b94
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 92 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 06c5b94
Reports root/ big
OK: 4580 / Failed: 0 / User-skipped: 103 / Auto-skipped: 0

@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (6021247) 83.80% compared to head (a14fb58) 83.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4043      +/-   ##
==========================================
+ Coverage   83.80%   83.82%   +0.02%     
==========================================
  Files         526      526              
  Lines       33129    33133       +4     
==========================================
+ Hits        27764    27774      +10     
+ Misses       5365     5359       -6     
Impacted Files Coverage Δ
src/adhoc.erl 97.14% <100.00%> (+22.94%) ⬆️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@JanuszJakubiec JanuszJakubiec left a comment

Choose a reason for hiding this comment

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

There is something wrong with types

src/adhoc.erl Outdated Show resolved Hide resolved
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

I like the refactor, but I think there are some issues with the rest of this PR. Apart from the specific comments, I would add that a change in functionality should be covered by tests.

src/adhoc.erl Outdated Show resolved Hide resolved
src/adhoc.erl Outdated Show resolved Hide resolved
src/adhoc.erl Outdated Show resolved Hide resolved
src/adhoc.erl Show resolved Hide resolved
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Requesting changes to avoid accidental merge.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jun 26, 2023

small_tests_24 / small_tests / 15c3102
Reports root / small


small_tests_25_arm64 / small_tests / 15c3102
Reports root / small


small_tests_25 / small_tests / 15c3102
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 15c3102
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 15c3102
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 15c3102
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 15c3102
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 15c3102
Reports root/ big
OK: 4185 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 15c3102
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 15c3102
Reports root/ big
OK: 4208 / Failed: 0 / User-skipped: 85 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 15c3102
Reports root/ big
OK: 2755 / Failed: 0 / User-skipped: 659 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 15c3102
Reports root/ big
OK: 2395 / Failed: 0 / User-skipped: 680 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 15c3102
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 15c3102
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 92 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 15c3102
Reports root/ big
OK: 4580 / Failed: 0 / User-skipped: 103 / Auto-skipped: 0

Copy link
Contributor

@JanuszJakubiec JanuszJakubiec left a comment

Choose a reason for hiding this comment

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

I've added two minor suggestions

Co-authored-by: JanuszJakubiec <54719269+JanuszJakubiec@users.noreply.github.com>
@mongoose-im
Copy link
Collaborator

mongoose-im commented Jun 27, 2023

small_tests_24 / small_tests / a14fb58
Reports root / small


small_tests_25_arm64 / small_tests / a14fb58
Reports root / small


small_tests_25 / small_tests / a14fb58
Reports root / small


ldap_mnesia_24 / ldap_mnesia / a14fb58
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / a14fb58
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / a14fb58
Reports root/ big
OK: 4208 / Failed: 0 / User-skipped: 85 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / a14fb58
Reports root/ big
OK: 4211 / Failed: 0 / User-skipped: 82 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / a14fb58
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / a14fb58
Reports root/ big
OK: 4185 / Failed: 0 / User-skipped: 108 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / a14fb58
Reports root/ big
OK: 2249 / Failed: 0 / User-skipped: 826 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / a14fb58
Reports root/ big
OK: 2395 / Failed: 0 / User-skipped: 680 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / a14fb58
Reports root/ big
OK: 2755 / Failed: 0 / User-skipped: 659 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / a14fb58
Reports root/ big
OK: 4580 / Failed: 0 / User-skipped: 103 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / a14fb58
Reports root/ big
OK: 4594 / Failed: 0 / User-skipped: 89 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / a14fb58
Reports root/ big
OK: 4589 / Failed: 2 / User-skipped: 92 / Auto-skipped: 0

mam_SUITE:rdbms_async_cache_prefs_cases:run_set_and_get_prefs_cases
{error,{{badmatch,0},
    [{escalus_story,drop_presences,2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,191}]},
     {escalus_story,'-start_ready_clients/2-fun-0-',3,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,135}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
     {escalus_story,start_ready_clients,2,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,128}]},
     {lists,flatmap_1,2,[{file,"lists.erl"},{line,1335}]},
     {lists,flatmap_1,2,[{file,"lists.erl"},{line,1335}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,69}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]}]}}

Report log

mam_SUITE:rdbms_async_cache_prefs_cases:messages_filtered_when_prefs_default_policy_is_always
{error,
  {{assertion_failed,assert,is_iq_result,
     [{xmlel,<<"iq">>,
        [{<<"type">>,<<"set">>},
         {<<"id">>,<<"2f66d914934532cb7a87dbf07110475c">>}],
        [{xmlel,<<"prefs">>,
           [{<<"xmlns">>,<<"urn:xmpp:mam:1">>},
          {<<"default">>,<<"always">>}],
           [{xmlel,<<"always">>,[],[]},{xmlel,<<"never">>,[],[]}]}]}],
     {xmlel,<<"iq">>,
       [{<<"from">>,
         <<"alice_messages_filtered_when_prefs_default_policy_is_always_2158@localhost">>},
        {<<"to">>,
         <<"alice_messages_filtered_when_prefs_default_policy_is_always_2158@localhost/res1">>},
        {<<"id">>,<<"pushb5b8ca52654b6090">>},
        {<<"type">>,<<"set">>}],
       [{xmlel,<<"query">>,
          [{<<"xmlns">>,<<"jabber:iq:roster">>}],
          [{xmlel,<<"item">>,
             [{<<"subscription">>,<<"both">>},
            {<<"jid">>,
             <<"bob_messages_filtered_when_prefs_default_policy_is_always_2158@localhost">>}],
             []}]}]},
     "<iq from='alice_messages_filtered_when_prefs_default_policy_is_always_2158@localhost' to='alice_messages_filtered_when_prefs_default_policy_is_always_2158@localhost/res1' id='pushb5b8ca52654b6090' type='set'><query xmlns='jabber:iq:roster'><item subscription='both' jid='bob_messages_filtered_when_prefs_default_policy_is_always_2158@localhost'/></query></iq>"},
   [{escalus_new_assert,assert_true,2,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.er...

Report log


mssql_mnesia_25 / odbc_mssql_mnesia / a14fb58
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 92 / Auto-skipped: 0

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@chrzaszcz chrzaszcz merged commit 59c0fe5 into master Jun 28, 2023
@chrzaszcz chrzaszcz deleted the update-xep-0050 branch June 28, 2023 10:04
@chrzaszcz chrzaszcz added this to the 6.2.0 milestone Dec 11, 2023
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.

4 participants