Skip to content

Fix: Reuploading a task package of a different type than the existing task#685

Open
matthberendt wants to merge 6 commits intosio2project:masterfrom
matthberendt:master
Open

Fix: Reuploading a task package of a different type than the existing task#685
matthberendt wants to merge 6 commits intosio2project:masterfrom
matthberendt:master

Conversation

@matthberendt
Copy link
Copy Markdown
Contributor

Fix regarding this bug: #683

  1. Added Task Type Validation: In oioioi/sinolpack/package.py, when reuploading to an existing_problem, the system now calls _ensure_compatible_controller. This method compares the existing problem's controller with the new package's determined controller. If they do not match, it blocks the reupload by raising a ProblemPackageError.

  2. Improved Error Reporting:_create_problem_or_reuse_if_exists, _ensure_short_name_equality_with, and the new _ensure_compatible_controller with @_describe_processing_error. This ensures that if the task types mismatch these changes effectively close the gaps allowing interactive packages to overwrite non-interactive tasks and normal packages to overwrite quiz tasks, ensuring task integrity during reuploads.

@matthberendt
Copy link
Copy Markdown
Contributor Author

Ruff formatted

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

"""Checking if task type didn't change."""
new_controller_name = self._get_controller_name()
if existing_problem.controller_name != new_controller_name:
try:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it possible to write this without try/except (like with hasattr)

Copy link
Copy Markdown
Contributor

@twalen twalen left a comment

Choose a reason for hiding this comment

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

could you add some regression tests?

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