Skip to content

Remove extensions that a moved deadline has left behind - #624

Draft
kaiiiichen wants to merge 2 commits into
berkeley-cdss:mainfrom
kaiiiichen:fix-stale-extensions-620
Draft

kaiiiichen wants to merge 2 commits into
berkeley-cdss:mainfrom
kaiiiichen:fix-stale-extensions-620

Conversation

@kaiiiichen

Copy link
Copy Markdown

General Info

Fixes #620

  • Breaking?

Changes

Canvas and Gradescope keep using a student's override even after the assignment's own deadline moves past it. A student with a 1-day extension to Nov 6 stays on Nov 6 when the class moves to Nov 20, so they end up with an earlier deadline than everyone else. I confirmed this on Gradescope. Canvas's source shows the same rule, but I haven't reproduced it in a live course.

Two decisions to review

1. The student returns to the class deadline (Nov 20), not the original difference (Nov 21).
The override is removed rather than moved. Keeping the 1-day difference would give the student time that staff didn't approve for the new deadline. Without an override, the student also follows any later deadline changes. If they still need more time, they can submit a new request, and the form counts days from the new deadline.

2. Assignment sync changes the LMS automatically, rather than flagging students for staff.
This only moves a student's deadline later, up to the class deadline, so waiting for staff to act would just leave them with the wrong date for longer. To keep it safe:

  • An override is removed only if its date matches a date Flextensions approved for that student and is earlier than the class deadline.
  • Dates that staff set directly in the LMS, and later extensions, are left alone. A student with an earlier date that doesn't match is reported to staff on the course page.
  • The course page shows how many extensions were removed, skipped, or failed. Failures are retried on the next sync.

Known trade-off: a removed override doesn't come back. If a deadline moves Nov 5 → Nov 20 → Nov 5, Flextensions shows the student's approved Nov 6, but the LMS uses Nov 5. I expect this to be rare, so I documented it rather than handling it.

Please say if you'd prefer something different on either of these.

What changed

  • Sync: StaleExtensionRemover runs on every assignment sync, not only when a date changes. That means the next sync also repairs courses that moved a deadline before this change. Requests aren't modified, so they remain a record of what was approved.
  • LMS support: adds student_identifier, extension_due_dates, and remove_extension to the facades, and delete to the Gradescope client.
  • Approval: a request that isn't later than the current deadline can't be approved, including through mass approval, so nothing is written to the LMS. Previously, approving an old pending request would give the student the earlier date and could move their late due date earlier too.
  • Validation: the server now rejects a requested date that isn't later than the current deadline. This only runs when the date is being set, so existing requests stay valid after a deadline moves.
  • Display: Extended Due Date is never earlier than the class deadline. Pages and emails never show negative days. Affected request pages explain what happened.
  • Forms: the date field now defaults to the day after the deadline in the HTML, not only through JavaScript, so the default passes the new validation.
  • Staff requests: an invalid request filed for a student no longer denies that student's other requests first.
  • Repair: extensions:report_stale lists affected courses and extensions:repair_stale queues their syncs.

Not in this PR

  • Late due dates (issue item 4): a student's override can close before the class's late due date even when their extended due date is still later than the class due date. I'd like to handle this in a follow-up.
  • Approving denied requests (Allow staff to approve denied requests (#163) #618): the Approve button on a denied request stays enabled when its date is out of date. The server refuses it and explains why, so only the button state is off.
  • Show the student's current deadline on the request page #619: this PR uses the most recent approval as the student's current extension, because each approval replaces the previous override in the LMS. Show the student's current deadline on the request page #619 uses the latest-ending one. The two should share Assignment#current_due_date_for, and it needs the same comparison with the class deadline.
  • Automatic sync: assignment sync still only runs on course import or when staff click Sync Assignments, so a moved deadline isn't handled until then.

Testing

The results below are from this branch, rebased on main:

  • RSpec: 960 examples, 0 failures
  • RSpec accessibility: 41 examples, 0 failures
  • Cucumber: 35 scenarios passed
  • RuboCop: no offenses

I also broke 12 key pieces of the logic one at a time to confirm that tests fail, and checked seven affected pages in headless Chrome with axe.

None of this has run against a real LMS. The specs stub LMS calls, including HTTP-level stubs for both facades.

Needs someone with LMS access

I'm not on course staff, so I can't test these myself. @cycomachead, could you help before this is merged?

  • Canvas: run the new sandbox script. It temporarily moves the test assignments' deadlines, then restores them, and it refuses to run against production. I've only run it against a fake Canvas server.
    CANVAS_TOKEN=<token> CANVAS_URL=https://ucberkeleysandbox.instructure.com bin/rails runner utils/canvas_sandbox/test_moved_deadline.rb
  • Gradescope students: on an assignment's extensions page in a test course, check that a student who already has an extension is still listed in the AddExtension props. If not, their extension is skipped without any warning, which leaves them in today's state. This is the main risk.
  • Gradescope delete: check that DELETE on an extension's deletePath removes it. If it doesn't, the sync detects that the extension is still there and warns on the course page.
  • Production, after merging: run extensions:report_stale, review the list, then run extensions:repair_stale.

I also noticed that utils/canvas_sandbox/setup_test_course.rb and utils/create_canvas_courses.rb use Faraday's JSON response middleware, which fails with json 3.1.0 and faraday 2.14.3. The new script avoids this. If the test assignments need resetting, setup_test_course.rb will hit it.

Documentation

  • docs/instructors.md: moving a deadline
  • docs/students.md: what Extended Due Date shows
  • docs/updates.md: release note
  • docs/developers.md: the repair tasks
  • utils/canvas_sandbox/README.md: the sandbox script

Checklist

  • Name of branch corresponds to story

An LMS keeps using a student's override even after the assignment's own
deadline moves past it, which leaves that student with an earlier
deadline than the rest of the class.

- Remove these overrides on every assignment sync, including ones from
  earlier deadline changes, and show the results on the course page
- Refuse to approve a request that is not later than the current deadline
- Validate new requested dates on the server
- Show the current deadline and never show negative extension days
- Add rake tasks to report and repair affected courses

When a deadline moves past an extension, the student returns to the class
deadline rather than keeping the original difference, and sync changes the
LMS automatically. Only overrides matching a date Flextensions approved
are removed.

Fixes berkeley-cdss#620
Exercises the real approval and sync code against a Canvas sandbox: moves
the test assignments' deadlines past approved extensions, then checks what
Canvas applies to each student. Refuses to run against production Canvas.

Refs berkeley-cdss#620
@superconductor-for-github

superconductor-for-github Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

✅ @kaiiiichen — Superconductor finished — View implementation | App Preview


Standing by for instructions.

@cycomachead

cycomachead commented Nov 6, 2026 via email

Copy link
Copy Markdown
Contributor

@kaiiiichen

Copy link
Copy Markdown
Author

This is a lot. I think this makes sense as a problem — though I am not sure assignment sync should actually be the process to adjust extensions. I think automatically pushing extensions forward is definitely too much for most faculty and it diminishes the purpose of an extension in general. It seems to me a warning and a removal process does make sense but then we need to track that this has happened. -- Michael BallFrom my iPhonehttps://mball.coContinuing Lecturer UC Berkeley EECS | Travel Advisor Fora On Nov 5, 2026, at 3:32 PM, superconductor-for-github[bot] @.> wrote:superconductor-for-github[bot] left a comment (berkeley-cdss/flextensions#624) ✅ @kaiiiichen — Superconductor finished — View implementation | App Preview Standing by for instructions. —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

Thanks, Michael. To make sure we're on the same page: today, a student with an extension can end up with an earlier deadline than the class. In the issue's example #620, they stay on Nov 6 while everyone else has Nov 20. Removing the extension only returns them to Nov 20, but I understand if you'd rather have staff make that call.

I'll take the automatic changes out of sync and split this into two PRs:

  1. Fix the displayed dates and block approving requests that are no longer later than the deadline. This doesn't change anything in the LMS.
  2. Warn staff about these extensions, let them remove one, and record who removed it and when.

Two questions for the second PR:

  • Should a removed extension return the student to the class deadline (Nov 20 in this example)?
  • Should staff be able to remove them all at once for an assignment, or only one student at a time?

This branch has not been deployed

No deployments
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.

Approved extensions go stale when a deadline moves later, leaving students with an earlier deadline than the class

2 participants