Investigate and fix incorrect Canvas assignment due dates, add logging for overrides#451
Open
cycomachead wants to merge 1 commit into
Open
Investigate and fix incorrect Canvas assignment due dates, add logging for overrides#451cycomachead wants to merge 1 commit into
cycomachead wants to merge 1 commit into
Conversation
Canvas omits the base date from the API response when an assignment has more than 25 overrides, causing the sync to fall back to incorrect override-derived dates. - Skip updating due dates on subsequent syncs if an assignment has >= 25 overrides and no explicit base date is present. - Add logging to track skipped updates and monitor override data. - Update Lmss::Canvas::Assignment to track override counts and base date presence. - Ensure non-Canvas LMS integrations remain unaffected. Co-authored-by: Claude Code <noreply@anthropic.com>
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.
General Info
Changes
Canvas omits the
all_datesarray (the source of the base due date) from its API response when an assignment has more than ~25 overrides. Without a base date, the sync was falling back to the root-leveldue_at/lock_atfields, which Canvas can populate from an override — resulting in due dates that are later than the real assignment due date.Root cause fix: Skip overwriting
due_dateandlate_due_dateon subsequent syncs when an assignment has ≥ 25 overrides and no explicit base date is present. New assignments are unaffected (dates are always set on first sync), and non-Canvas LMS integrations (e.g. Gradescope) are unaffected via safe defaults inBaseAssignment.Key changes:
SyncAllCourseAssignmentsJob: AddedOVERRIDE_DATE_LIMIT = 25constant andskip_due_date_update?guard. Name and other fields continue to sync normally even when date updates are skipped.Lmss::Canvas::Assignment: Exposesoverrides_count(size of theoverridesarray) andbase_date?(whether Canvas returned an explicit base date).Lmss::BaseAssignment: Added default implementations (overrides_count = 0,base_date? = true) so other LMS integrations are never affected by the guard.warnis emitted when a due date update is skipped (showing stored vs. Canvas-reported dates). Aninfois emitted for any override-bearing assignment whose dates are updated, so we can continue monitoring for incorrect dates.CanvasSpecHelpers: Fixedbuild_canvas_assignmentso passingbase_date: nilcorrectly models Canvas omitting the base date, rather than deriving one.Testing
Added RSpec contexts to
sync_all_course_assignments_job_spec.rbcovering:warn.All new and existing specs should be run against a database-backed environment before merging.
Documentation
No additional documentation required.
Checklist
Superconductor Ticket Implementation | App Preview | Guided Review