Fix: Reuploading a task package of a different type than the existing task#685
Open
matthberendt wants to merge 6 commits intosio2project:masterfrom
Open
Fix: Reuploading a task package of a different type than the existing task#685matthberendt wants to merge 6 commits intosio2project:masterfrom
matthberendt wants to merge 6 commits intosio2project:masterfrom
Conversation
Contributor
Author
|
Ruff formatted |
|
twalen
reviewed
Apr 15, 2026
| """Checking if task type didn't change.""" | ||
| new_controller_name = self._get_controller_name() | ||
| if existing_problem.controller_name != new_controller_name: | ||
| try: |
Contributor
There was a problem hiding this comment.
is it possible to write this without try/except (like with hasattr)
twalen
requested changes
Apr 15, 2026
Contributor
twalen
left a comment
There was a problem hiding this comment.
could you add some regression tests?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fix regarding this bug: #683
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.
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.