[HnR-Autograder:3] Chain persistence - #7442
Draft
Elimpizza wants to merge 5 commits into
Draft
Conversation
Elimpizza
marked this pull request as ready for review
August 24, 2026 14:08
Elimpizza
marked this pull request as draft
August 24, 2026 14:08
|
|
||
| head = None | ||
| previous = None | ||
| for index, phase in enumerate(phases): |
Contributor
There was a problem hiding this comment.
There’s no cap on len(phases) — only the read side is bounded. So a config with 100 phases would write all 100 rows, but get_auto_grading_configs would only ever read back the first 20. This could happen through the deep-linking launch path.
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.
This pull request significantly enhances the handling of auto-grading configurations for assignments, enabling support for multiple grading phases and improving robustness and test coverage. The core logic now allows storing and retrieving chains of auto-grading configs, each representing a grading phase, and ensures correct cleanup and reuse of configs when assignments are updated.
The most important changes are:
Auto-Grading Configs: Multi-Phase Support and Management
previous_config_id. Introduced the_MAX_CHAIN_DEPTHconstant to prevent infinite cycles in config chains. (lms/services/assignment.py) [1] [2]update_assignmentand_update_auto_grading_configmethods to accept and correctly handle a list of config dicts (one per phase), including logic to reuse, drop, or delete configs as needed. (lms/services/assignment.py) [1] [2]Testing: Expanded Coverage for Multi-Phase Logic
tests/unit/lms/services/assignment_test.py)tests/functional/views/lti/basic_lti_launch_test.py)Imports and Minor Cleanups
AutoGradingConfigandjsonwhere needed for new test logic. (tests/functional/views/lti/basic_lti_launch_test.py,tests/unit/lms/services/assignment_test.py) [1] [2] [3]These changes collectively provide a robust foundation for assignments with complex, multi-phase auto-grading workflows.This pull request significantly extends the assignment auto-grading configuration system to support multiple grading phases, each with its own configuration, and ensures robust handling and testing of these changes. The main focus is on allowing an assignment to have a chain of auto-grading configurations rather than just one, improving flexibility for complex grading workflows.
The most important changes are:
Core functionality enhancements:
lms/services/assignment.py: TheAssignmentServicenow supports multiple auto-grading phases by storing a chain ofAutoGradingConfigobjects linked byprevious_config. The new methodget_auto_grading_configsretrieves these configs in phase order, and_update_auto_grading_configis refactored to handle a list of configs, adding, updating, or removing phases as needed. A recursion limit (MAX_AUTO_GRADING_PHASES) is introduced to prevent infinite loops from cycles. [1] [2] [3] [4]Testing improvements:
tests/unit/lms/services/assignment_test.py: Comprehensive tests are added for the new multi-phase auto-grading logic, including tests for correct ordering, chain isolation, handling of unflushed configs, recursion bounds, config updates, phase reuse, phase dropping, and complete removal of configs.API and interface changes:
lms/services/assignment.py: Theauto_grading_configparameter inupdate_assignmentand related methods now accepts either a single dict or a list of dicts, reflecting support for multiple phases. [1] [2]Constants and imports:
lms/services/assignment.py,tests/unit/lms/services/assignment_test.py: The new constantMAX_AUTO_GRADING_PHASESis defined and imported in tests to bound the grading phase chain traversal. [1] [2]These changes collectively make the assignment auto-grading system more flexible and robust, with thorough tests to ensure correctness and prevent regressions.