Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docs): Simplify XQueue Migration ADR for better readability
This commit updates the XQueue Migration ADR to be more accessible while maintaining critical technical information. Key changes include: - Streamline context section focusing on core system limitations - Reorganize decision section with clearer structure - Add implementation approach section for gradual migration - Maintain technical details in consequences section - Keep all original references for further documentation Part of the XQueue migration initiative. refactor: change submission queue record name functionalities - Change SubmissionQueueManager to ExternalGraderDetailManager - Change create_submission_queue_record to create_external_grader_detail - Change validation to queue name in create_submission - Remove unnecessary test to check queue name error refactor(submissions): Rename SubmissionQueueRecord to ExternalGraderDetail - Rename model SubmissionQueueRecord to ExternalGraderDetail - Update all references in Python files - Create Django migration for model renaming - Update related imports and references feat: add ADR for SubmissionQueueRecord migration from XQueue Add Architecture Decision Record (ADR) documenting the design and implementation of the SubmissionQueueRecord model as part of the gradual migration from XQueue to edx-submissions. This ADR covers: - Context of current XQueue architecture - Technical details of new model implementation in edx submissions - Migration and compatibility considerations - Impact analysis and consequences feat: add architecture decisions to documentation - Create new decisions folder - Configurate in index.rst test: add validation tests for SubmissionQueueRecord state transitions - Add test_clean_invalid_transitions to verify error cases: - pending -> retired (not allowed) - pending -> invalid_status - pulled -> pending (not allowed) - failed -> retired (not allowed) - Enhance test_clean_valid_transitions with proper assertions This improves test coverage for state transition validations. fix: change validation SubmissionQueueRecord clean method - Add an optional status can_transition_to - Implement old status in clean method This resolves a bug in the implementation of transition validation when using the clean method. fix: remove try except in test_clean_new_instance - Remove unnecessary try/except in test_clean_new_instance - Add validations when new queue record call clean method - Extend coverage measure in test_models test: Add tests to extend coverage for SubmissionQueueRecord model - Status transition rules - Failure count tracking - Queue length calculations - Submission retrieval logic The new tests improve the robustness of the submissions app by covering. docs: Improve create_submission docstring formatting - Fix Sphinx documentation warnings - Correct formatting and indentation issues - Clarify parameter and return value descriptions Resolves documentation build warnings related to: - Inline strong start-string without end-string - Unexpected indentation fix: correct docstring formatting in create_submission - Add proper indentation and blank lines between sections - Fix example code block formatting - Replace >>> with ... for continued lines in example - Ensure consistent spacing throughout docstring This resolves the ReadTheDocs build failure and docstring formatting warning. fix: code style and quality improvements - Fix pylint warnings: - Remove protected access warnings in test files - Remove pointless string statements - Add missing final newlines - Fix isort import ordering in: - api.py - test_models.py - test_api.py - Fix pycodestyle issues: - Remove extra blank lines - Fix operator spacing - Add proper spacing before inline comments - Fix long lines in migration files - Fix line spacing in test files - Fix docstring formatting in api.py create_submission method Testing: make test_quality passes without warnings feat: add grading metadata fields to submission queue record - Add grader_file_name CharField (128 chars max) with empty default - Add points_possible PositiveIntegerField with default value of 1 - Update create_submission_queue_record to handle new fields fix: Remove duplicate nested create_submission function definition - Removes the redundant nested function definition feat: add nullable pullkey and grader_reply to Submission model feat(SubmissionQueueRecord): add pullkey and grader_reply fields - Add pullkey CharField(128) for tracking submission processing key - Add grader_reply TextField to store grader's response - Fields support queue processing and feedback management to xwatcher test: add comprehensive tests for Submission and SubmissionQueueRecord models Add missing test suite for Submission model and add new tests for SubmissionQueueRecord: Submission model tests (previously non-existent): - Basic model functionality (creation, retrieval) - String and repr representations - Large answer handling - Field mutability behavior - Submission ordering - Soft deletion mechanism - JSON serialization of answers SubmissionQueueRecord model tests: - Default status and initialization - Valid and invalid status transitions - Failure count tracking - Record processability logic - Queue name validation - One-to-one relationship with Submission - Status time updates Updates: - Fix repr test to handle UUID and string conversions - Document actual mutability behavior - Add validation for large answers - Ensure proper status transitions and timing - Verify queue processing logic The test suite ensures both models work correctly together and maintain data integrity through their lifecycle. Note: This commit adds the first test coverage for the Submission model, which previously lacked any automated testing. refactor: update submission queue record tests - Update test cases to use new public create_submission_queue_record function - Update assertions to use SubmissionQueueCanNotBeEmptyError instead of ValueError - Adjust test function parameters to match new interface (queue_name and files) - Add new test cases for empty queue_name validation The changes ensure test coverage for: - Direct queue record creation with valid and invalid inputs - Integration with create_submission function - Multiple submission queue records - Error handling scenarios fix: add blank line in models - This fixed the pylint warning feat(error): add SubmissionQueueCanNotBeEmptyError class error - This class is to is raised when queue name is empty fix: improve submission queue record validation - Update condition for creating submission queue record to properly check for queue_name - Use `event_data.get()` for safer dictionary access - Change ValueError to SubmissionQueueCanNotBeEmptyError for more specific error handling - Add proper validation in parent function to prevent None access errors The changes ensure that: 1. Queue name validation is more robust 2. Error handling is more specific and clear 3. Null checks are properly implemented Test coverage remains unchanged. refactor(submission): simplify queue record creation with explicit field - Replace dynamic unpacking of event_data with explicit queue_name field - Remove unnecessary field expansion to improve code clarity and maintainability test: add queue record unit and integration tests - Add unit tests for _create_submission_queue_record helper function - Basic queue record creation - Queue name validation - Database error handling - Add integration tests with create_submission - Queue record creation via submission creation - Multiple queue records with same name - Error handling with missing queue name - Database error integration testing Organized tests into clearly separated unit and integration sections for better maintainability and clarity. feat: add submission queue record functionality - Add _create_submission_queue_record helper function to handle queue record creation - Modify create_submission to accept event_data as kwargs - Update documentation to reflect new parameters and functionality - Allow dynamic field assignment using event_data kwargs in queue record creation The main changes: - Added ability to create SubmissionQueueRecord with dynamic fields - Improved error handling for queue record creation - Made event_data more flexible using kwargs pattern - Maintained backwards compatibility with existing submission creation feat(submissions): add SubmissionQueueRecord model - Add SubmissionQueueManager to process queries - Replace multiple timestamps with a single status_time field - Introduce explicit state machine for submission processing - Add atomic state transitions with validation - Optimize database indexes for queue operations Key changes: - Add STATUS_CHOICES and VALID_TRANSITIONS for state management - Consolidate pull_time, push_time, return_time into status_time - Add transaction-safe update_status() method - Improve queue manager with safer submission retrieval - Add validation for state transitions - Optimize indexes for common query patterns The changes maintain backwards compatibility with existing queue processing while providing a more robust and maintainable approach to state management.
- Loading branch information