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

Private tests cases #92

Open
Morriar opened this issue Sep 8, 2016 · 1 comment
Open

Private tests cases #92

Morriar opened this issue Sep 8, 2016 · 1 comment

Comments

@Morriar
Copy link
Owner

Morriar commented Sep 8, 2016

For now, all the test cases are public since they are returned by the API:

For each submission we can see the provided inputs:

{
    "player": { ... },
    "mission": {
        "track": { ... },
        "title": "Addition simple",
        "desc": "...,
        "parents": { ... },
        "stars": { ... },
        "path": null,
        "solve_reward": 1,
        "reward": 20,
        "testsuite": {
            "__items": [{
                "__kind": "obj",
                "__id": 10,
                "__class": "TestCase",
                "provided_input": "5\n",
                "expected_output": "15\n"
            }, {
                "__kind": "obj",
                "__id": 11,
                "__class": "TestCase",
                "provided_input": "0\n",
                "expected_output": "10\n"
            }, {
                "__kind": "obj",
                "__id": 12,
                "__class": "TestCase",
                "provided_input": "-5\n",
                "expected_output": "5\n"
            }, {
                "__kind": "obj",
                "__id": 13,
                "__class": "TestCase",
                "provided_input": "-50\n",
                "expected_output": "-40\n"
            }]
        }
    },
}

So, the question is: should we return the real TestCase object or a modified one?

This is actually a very interesting question for the popcorn framework, maybe @ppepos will be interested.

In some cases, when serializing an object to the API, we do not want to return the full object as some data can be private or with a restricted access.

Examples:

  • lists of player submission that is not self
  • player score that is not self or a friend
  • private test inputs
  • ...

How can we provide a kiss serialization mechanism with right handling?

From what I remember from the discussion with @ppepos on a related problem, here my proposal for a quick and dirty workaround:

  • by default, all data are marked as public
  • we use an annotation to mark restricted data and give them an arbitrary right level ():
class User
    # Public string
    var name: String

    # Restricted to self (and admins):
    var email: String is restricted(self)

    # Restricted to self and friends:
    var score: Int is restricted(friends)
end

And then, the JSON serialization process will take out restricted data depending on a user (lot of code to handle annotations required but somehow a clean an unified process?).

@Morriar
Copy link
Owner Author

Morriar commented Sep 8, 2016

@ALL, yes, I failed my JSON but... it highlights the parts I was talking about so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants