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

Change actor tests for requirement 9.2.0.0-* to only apply to cmi5 defined statements. #6

Merged
merged 2 commits into from
Jan 18, 2022

Conversation

gavbaa
Copy link

@gavbaa gavbaa commented Dec 27, 2021

Addressing https://rusticisoftware.slack.com/archives/C025TQVHG/p1640101691047000

We were incorrectly testing 9.2.0.0 requirements against cmi5 allowed statements, since that section specifically only applies to cmi5 defined statements. This uses a cmi5 defined statement for the actor corruption tests.

Copy link
Member

@brianjmiller brianjmiller left a comment

Choose a reason for hiding this comment

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

I'm fine with this, since it follows the letter of the law (even if the law doesn't make a lot of sense to me).

alter: (st) => {
st.actor.objectType = "Group";
}
},
{
// statement with actor objectType set to an invalid value
// defined statement with actor objectType set to an invalid value
Copy link
Member

Choose a reason for hiding this comment

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

Here the actor itself is invalid, so Engine returns a http 400 on failure to deserialize the actor before even getting to cmi5 validations.

So the change to this being a defined statement isn't enough, we should also accept 400 (and indeed, I'm not sure we should accept 403, because xAPI seems to demand 400):

400 Bad Request - Indicates an error condition caused by an invalid or missing argument. The term "invalid arguments" includes malformed JSON or invalid Object structures.

And although the spec could be clearer here, where xAPI defines the "Actor" property it also indicates that the actor can be an agent, in which case the objectType is optional but must be "agent" if present, or a group, in which case the object type is required and must be "group"

https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#242-actor

Copy link
Author

Choose a reason for hiding this comment

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

This really boils down to an argument of "does the cmi5 spec supercede the xAPI spec, or vice-versa?"

Since cmi5 says explicitly: The Actor property for all "cmi5 defined" statements MUST be of objectType "Agent"., if the cmi5 spec has priority (and one could argue it might as a superset of xAPI rules), then 403 would be relevant. Otherwise, if xAPI is the dominant spec, 400 would be correct.

To me, the right answer is "both". Since we can't easily determine which one is the superset, we make the test suite accept both.

Copy link
Author

Choose a reason for hiding this comment

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

I've updated this and helpers.js to reflect this opinion. Back to you!

Copy link
Member

@bscSCORM bscSCORM left a comment

Choose a reason for hiding this comment

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

see comment about "unknown" object type

…ctor type is invalid (LTS test 005-1-invalid-au).
Copy link
Author

@gavbaa gavbaa left a comment

Choose a reason for hiding this comment

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

Changed to include both statuses.

alter: (st) => {
st.actor.objectType = "Group";
}
},
{
// statement with actor objectType set to an invalid value
// defined statement with actor objectType set to an invalid value
Copy link
Author

Choose a reason for hiding this comment

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

I've updated this and helpers.js to reflect this opinion. Back to you!

@gavbaa gavbaa requested a review from bscSCORM January 17, 2022 13:32
@bscSCORM bscSCORM merged commit 240fb57 into RusticiSoftware:main Jan 18, 2022
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.

3 participants