-
Notifications
You must be signed in to change notification settings - Fork 107
[MBL-19546] Fix missing submissions with retry logic and state tracking #3411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+729
−54
Conversation
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
Implements Phase 1 and initial Phase 2 of submission bug fix: Database Changes (Phase 1): - Add SubmissionState enum with 7 states tracking submission lifecycle (QUEUED, UPLOADING_FILES, SUBMITTING, VERIFYING, COMPLETED, FAILED, RETRYING) - Add 5 new columns to CreateSubmissionEntity for state tracking: - submission_state (default: QUEUED) - state_updated_at (nullable timestamp) - retry_count (default: 0) - last_error_message (nullable error details) - canvas_submission_id (nullable submission ID from Canvas) - Create backward-compatible database migration (v6 → v7) - Add DAO methods for state management (updateSubmissionState, incrementRetryCount, setCanvasSubmissionId, findSubmissionsByState) Worker Changes (Phase 2 - Partial): - Update SubmissionWorker to track state transitions - Set UPLOADING_FILES state when uploading files - Set SUBMITTING state when making submission API calls - Import SubmissionState enum for type-safe state management All changes are backward compatible with existing submissions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements remaining Phase 2 changes: SubmissionHelper Changes: - Add exponential backoff policy (30s initial delay) - Configure WorkManager to retry with increasing delays (30s → 60s → 120s for transient failures) SubmissionWorker Error Handling: - Implement intelligent retry logic in handleSubmissionResult - Distinguish between transient errors (retry) and permanent errors (fail): * Network 5xx errors → retry up to 3 times * Network errors with no code (connectivity issues) → retry * Exceptions → retry * Authorization 4xx errors → permanent failure - Update submission state to RETRYING for retryable errors - Update submission state to FAILED after max retries - Track Canvas submission ID on success - Increment retry count and store error messages in database State Management: - Set COMPLETED state on successful submission - Store canvas_submission_id for verification - Set RETRYING state for transient failures - Set FAILED state for permanent failures or max retries exceeded This fixes the core bug where transient network failures would lose submissions. WorkManager will now automatically retry failed submissions with exponential backoff, ensuring files uploaded to Canvas are properly submitted even if the final API call initially fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Phase 3 changes - enable UI tracking of submission progress: BaseSubmissionHelper Changes: - Update all submission methods to return Long instead of Unit: * startTextSubmission() → returns submission ID * startUrlSubmission() → returns submission ID * startFileSubmission() → returns submission ID (or -1 if empty) * startMediaSubmission() → returns submission ID * startStudioSubmission() → returns submission ID * startStudentAnnotationSubmission() → returns submission ID This enables the UI layer to: - Track specific submission by ID - Monitor submission state in real-time - Show progress without closing submission view prematurely - Navigate to upload status screen instead of immediate dismissal The returned ID is the actual auto-generated primary key from CreateSubmissionEntity, not the SQLite ROWID. The code correctly uses findSubmissionByRowId() to fetch the entity and extract its ID. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
kdeakinstructure
approved these changes
Nov 27, 2025
Contributor
kdeakinstructure
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA 👍
Update test mock to return Long instead of Unit to match the updated BaseSubmissionHelper method signature. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
📊 Code Coverage Report
|
…handling - Add lastSubmissionId property to track database entity ID - Add isFailed property to track submission failure state - Add ensureSubmissionStateIsCurrent method to sync submission state - Update grade cell to reflect uploading and failed states - Fix routing to use submission entity ID instead of assignment ID - Add updateGradeCell callback to refresh grade cell on failure - Update all tests to include new properties - Add testUpdateSubmissionState to CreateSubmissionDaoTest 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🧪 Unit Test Results✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Fri, 28 Nov 2025 13:07:17 GMT |
kristofnemere
approved these changes
Nov 28, 2025
Contributor
kristofnemere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA+1
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.
Summary
Fixes critical bug where student file submissions appeared in Canvas Submissions folder but not in SpeedGrader. This occurred when files uploaded successfully but the final submission API call failed silently due to network issues.
Changes
Database Layer (Phase 1)
SubmissionStateenum with 7 states tracking submission lifecycle: QUEUED, UPLOADING_FILES, SUBMITTING, VERIFYING, COMPLETED, FAILED, RETRYINGCreateSubmissionEntity:submission_state(tracks current state)state_updated_at(timestamp)retry_count(attempt counter)last_error_message(error details)canvas_submission_id(Canvas ID after success)updateSubmissionState(),incrementRetryCount(),setCanvasSubmissionId(),findSubmissionsByState()Worker & Error Handling (Phase 2)
SubmissionWorker:UI Foundation (Phase 3)
BaseSubmissionHelpermethods to return submission IDs instead of UnitTest Plan
Manual Testing
Database Migration Testing
Edge Cases
refs: MBL-19546
affects: Student
release note: Fixed issue where file submissions occasionally didn't appear in SpeedGrader after successful upload
🤖 Generated with Claude Code