Skip to content

Consider the code for updating / posting an assignment override to Canvas * Audit for any bugs * Know that the Canvas API returns the wrong due da...#439

Open
cycomachead wants to merge 2 commits into
mainfrom
cycomachead/130-consider-the-code-for-updating-posting-an-assignment-override-to-canvas-audit-for-any-bugs-know-t/1
Open

Consider the code for updating / posting an assignment override to Canvas * Audit for any bugs * Know that the Canvas API returns the wrong due da...#439
cycomachead wants to merge 2 commits into
mainfrom
cycomachead/130-consider-the-code-for-updating-posting-an-assignment-override-to-canvas-audit-for-any-bugs-know-t/1

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

General Info

Changes

Audited and fixed 7 bugs in the Canvas assignment override update/post flow, addressing correctness issues around shared overrides, pagination, base due dates, and error handling.

Critical fixes:

  1. Shared overrides were being destroyed — the old flow deleted a student's entire override before re-creating one, wiping extensions for all other students in a shared group (e.g. "1 day extension"). Now: single-student overrides are updated in place; shared overrides have only the one student removed, preserving the title and dates for remaining students.

  2. update_assignment_override silently no-oped — params weren't nested under assignment_override as Canvas requires. Un-nested params are silently ignored by Canvas, meaning override updates (including renames) never applied. Override renames now go through correctly.

  3. Override lookups only read page 1 — Canvas paginates overrides (default 10/page), so with many overrides a student's existing override was never found, leading to duplicate create attempts and 400 errors. get_assignment_overrides now requests 100 items/page and a new get_all_assignment_overrides depaginates fully.

Base due date fix (>25 overrides):

  1. Incorrect base due datesget_all_assignments relied on all_dates, which Canvas omits when an assignment has more than 25 dates. The top-level due_at can then reflect an override's date. A new get_base_dates method uses the date_details endpoint (whose top-level dates are always the base/"Everyone" dates) and is called whenever all_dates is missing and has_overrides is true. The controller now uses this for initial_due_date as well.

Other fixes:

  1. Failed Canvas requests recorded as success — non-2xx create/update responses were wrapped in an Override with a nil id and the request was marked approved. provision_extension now raises CanvasAPIError on failure.
  2. Auth token leaked into paginated URLsdepaginate_response was passing headers: auth_header as Faraday query params, appending Authorization=Bearer … to follow-up page URLs. The connection's default headers already carry auth.
  3. Smaller fixesremove_student_from_override no longer mutates the caller's array; updates no longer reset unlock_at to "now"; override_has_errors? renamed to override_taken_error? with correct semantics; Lmss::Canvas::Assignment no longer falls back to a potentially override-tainted top-level date when base date info is present; Lmss::Canvas::Override exposes the full override fields needed by the controller.

Testing

  • Updated existing specs to reflect the corrected behavior (param nesting, no delete_assignment_override calls, correct unlock_at preservation).
  • Added new specs for: pagination of override lookups (override found on page 2), override rename on update, shared override preservation when a student is removed, lookup/create race condition recovery ("taken" recovery), get_base_dates (success/failure/bad JSON), date_details fallback in get_all_assignments, failure-status raising, and non-mutation of student_ids.
  • Full suite: 423 examples, 0 failures, rubocop clean.

Documentation

No documentation changes required.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

cycomachead and others added 2 commits June 10, 2026 15:54
- Fix shared overrides being destroyed by removing students from groups
  instead of deleting the entire override.
- Fix update_assignment_override no-oping by nesting params correctly.
- Fix override lookups failing when > 25 overrides exist by implementing
  depagination and requesting 100 items per page.
- Fix incorrect base due dates by explicitly querying the date_details
  endpoint when Canvas omits all_dates.
- Ensure override renames are applied during updates.
- Prevent auth token leakage into paginated URLs.
- Improve error handling by raising CanvasAPIError for failed requests.

Co-authored-by: Claude Code <noreply@anthropic.com>
Implement logic to title and group assignment overrides by "N day(s) extension" instead of individual student IDs. This reduces the total override count to mitigate Canvas API limitations where date reporting becomes unreliable after 25 overrides.

- Add `get_base_dates` lookup to ensure accurate day calculation.
- Update `provision_extension` to merge students into existing matching groups.
- Handle student removal from shared overrides when extension lengths change.
- Ensure timezone-tolerant date matching for group identification.

Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant