What happens
I am trying to push a code challenge but I get the following error:
main()
File "build/modules/test-policy/main.py", line 443, in main
branch_name, repo):
File "build/modules/test-policy/main.py", line 302, in is_solution_code_complexity_valid
get_policy_complexity(user_policy, solution)
File "build/modules/test-policy/main.py", line 75, in get_policy_complexity
'step': policy[solution['type']]['complexity']['step'],
File "/nix/store/3jmwvx26isq9j4wh56g1ay2cxmz5px9x-ruamel.yaml0.16.10/site-packages/ruamel/yaml/comments.py", line 753, in __getitem__
return ordereddict.__getitem__(self, key)
KeyError: 'step'
We have found some problems :(
You can replicate this by running:
services $ ./build.sh test_policy
[INFO] Deleting: /builds/wGEWekfD/0/autonomicmind/.ephemeral/challenges
What do you understand or find about that problem
Yesterday a new feature was added: “step” to the policies, so far I don’t know what this new feature is about, the test_policy module was also modified a bit (https://gitlab.com/autonomicmind/challenges/-/merge_requests/5820/diffs and https://gitlab.com/autonomicmind/challenges/-/merge_requests/5820/diffs)
The error I am getting seems to be syntax error, I don’t see any information about this error
You make any workaround? What did you do?
Seeing that this is a syntax error or is directly related to the execution of python “KeyError” I decided to read the code to see how this new feature worked and in summary it get step value of policies/data.yml
def get_policy_complexity(
policy: Any,
solution: Dict[str, Any]) -> Dict[str, float]:
return {
'min': policy[solution['type']]['complexity']['min'],
'goal': policy[solution['type']]['complexity']['goal'],
'step': policy[solution['type']]['complexity']['step'],
'min_step': policy[solution['type']]['complexity']['min_step'],
'max_step': policy[solution['type']]['complexity']['max_step'],
}
And what I found is that the step key is not found in data.yml but it was merged yesterday although it was modified 5 hours ago and the changes were made +18 hours ago
What I can conclude from this is that the module is still evaluating this key but it is not in data.yml or that for some reason the changes were not made or my user does not have the updated repository
Evidences
I need help with
At the time of writing this a doc was provided of the policy: https://gitlab.com/autonomicmind/challenges/-/wikis/Policies but this one doesn’t talk about the new feature (steps), then I wouldn’t know what “step” means