Skip to content

Add a new "interactive" task type.#1667

Open
veluca93 wants to merge 1 commit intocms-dev:mainfrom
veluca93:interactive-tt
Open

Add a new "interactive" task type.#1667
veluca93 wants to merge 1 commit intocms-dev:mainfrom
veluca93:interactive-tt

Conversation

@veluca93
Copy link
Copy Markdown
Contributor

@veluca93 veluca93 commented Apr 5, 2026

No description provided.

@veluca93 veluca93 requested review from Virv12, gollux and prandla April 5, 2026 23:02
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 12.15190% with 347 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.16%. Comparing base (727005d) to head (33aad96).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cms/grading/tasktypes/interactive_keeper.py 0.00% 149 Missing ⚠️
cms/grading/tasktypes/Interactive.py 25.37% 100 Missing ⚠️
cmscontrib/loaders/italy_yaml.py 0.00% 68 Missing ⚠️
cms/grading/Sandbox.py 37.50% 10 Missing ⚠️
cms/grading/ParameterTypes.py 57.14% 6 Missing ⚠️
cms/grading/steps/evaluation.py 0.00% 6 Missing ⚠️
cmstestsuite/tasks/interactive/__init__.py 0.00% 3 Missing ⚠️
cmstestsuite/tasks/interactive_many/__init__.py 0.00% 3 Missing ⚠️
cmstestsuite/Tests.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1667      +/-   ##
==========================================
- Coverage   54.67%   54.16%   -0.51%     
==========================================
  Files         336      340       +4     
  Lines       27450    27787     +337     
==========================================
+ Hits        15009    15052      +43     
- Misses      12441    12735     +294     
Flag Coverage Δ
functionaltests 0.00% <0.00%> (ø)
unittests 54.16% <12.15%> (-0.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prandla
Copy link
Copy Markdown
Member

prandla commented Apr 7, 2026

Also, there should be some documentation of the controller communication format.

Also, i'm not sure i like the name: i think it'd be more descriptive to call this something like "DynamicInteractive" to emphasize that it spawns solutions dynamically. (and then Communication could be renamed to Interactive, which is what it really is. though we'd probably need to keep the name Communication as an alias.)

@veluca93
Copy link
Copy Markdown
Contributor Author

veluca93 commented Apr 7, 2026

Also, there should be some documentation of the controller communication format.

Also, i'm not sure i like the name: i think it'd be more descriptive to call this something like "DynamicInteractive" to emphasize that it spawns solutions dynamically. (and then Communication could be renamed to Interactive, which is what it really is. though we'd probably need to keep the name Communication as an alias.)

The plan is to have Interactive eventually also take over the tasks that we currently do with Communication, so I am happy with the "Interactive" task name.

As for documentation: that will come, I would like first to make sure that we agree the implementation is sensible.

Copy link
Copy Markdown
Member

@prandla prandla left a comment

Choose a reason for hiding this comment

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

i think the implementation in general is fine now. interactive_keeper.py doesn't really spark joy for me, but i don't know how to improve it much. (aside from the one comment i left in it)

return score, text, admin_text


class CopyAbsPathFileCacher:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this feels really ugly....

i think you could just not give the Sandbox any FileCacher. then you'd have to use create_file_from_string or plain create_file instead of create_file_from_storage, but it would still feel a lot less hacky to me.

"""Type for an integer parameter."""

TEMPLATE = GLOBAL_ENVIRONMENT.from_string("""
<select name="{{ prefix ~ parameter.short_name }}">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a dropdown with the options "true" and "false"? have you ever heard of a checkbox? :)

also, the docstring just above seems to be a copy-paste error, should say "boolean parameter". (unless you're subtly alluding to the fact that bool is a subclass of int :p)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I fixed the docstring.

However, it's at least non-trivial to use a checkbox, since for whatever reason a checkbox does not send a value if the checkbox is unchecked, and the existing infra expects a value.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah, that's just how html checkboxes work, it is a bit annoying.

i'd still prefer if this was fixed. a checkbox is the semantically correct input for a boolean. you don't need to change existing infra much: just override parse_handler instead of parse_string. (i think you still need to provide a dummy parse_string to make it a non-abstract class though)

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants