Skip to content

Extract Pensive assignment platform integration logic from legacy repository - #573

Open
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/239-extract-pensive-integration/5
Open

Extract Pensive assignment platform integration logic from legacy repository#573
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/239-extract-pensive-integration/5

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

General Info

Changes

Extracts and implements the Pensive assignment platform integration ported from the legacy extensions repo, per request. This adds Pensive as a third supported LMS:

  • New PensiveFacade (registered as LMS id 3) supporting:
    • Assignment sync via a configurable PENSIEVE_ASSIGNMENTS_PATH endpoint (Pensive's legacy API doesn't provide assignment listing, so this must be supplied separately and documented in docs/integrations.md).
    • Posting extensions via Pensive's legacy grant-extension API, using the assignment URL, student email, and a whole-day extension count (rather than absolute due dates like Canvas/Gradescope).
  • Lmss::Pensive::Assignment and Lmss::Pensive::Override model classes to normalize Pensive's response payloads into the shared assignment-sync/extension-provisioning pipeline.
  • DB migration + seed entry registering Pensive as LMS id 3, plus Lms.PENSIVE_LMS and Course#pensive_id helpers.
  • Request#approve updated to special-case Pensive's day-count based extension API while keeping the existing date-based flow for other facades.
  • assignment_link_for helper generalized to fall back to assignment.external_url + LMS name for any facade without a hardcoded case (used by Pensive, since assignment URLs are the identifier).
  • .env.example and docs/integrations.md updated with required config (PENSIEVE_EMAIL, PENSIEVE_API_TOKEN, PENSIEVE_ASSIGNMENTS_PATH, optional PENSIEVE_API_URL) and the expected assignment-list response contract.

Outstanding items before this can be exercised end-to-end (see conversation for details)

  • A Pensive integration account invited to every managed class, with PENSIEVE_EMAIL + an API token from that account.
  • A CourseToLms link per course using LMS id 3 and the Pensive class id (extracted from the class URL, e.g. data100_fa26)—currently must be created manually via the existing POST /api/v1/courses/:course_id/lmss API or Rails console; no instructor-facing UI yet.
  • Pensive must supply a real assignment-list endpoint matching the documented contract, since the legacy integration only supports posting extensions.
  • Network access to api.pensieve.co was not fully available during implementation (403 Forbidden by network policy, then 404s/rate limiting on other paths), so live end-to-end validation against Pensive was not completed.

Testing

  • 730 specs passing, RuboCop clean, Brakeman clean.
  • Added unit specs for PensiveFacade (assignment sync, extension provisioning, config validation, error handling) using stubbed HTTP requests.
  • Added specs for Lms.PENSIVE_LMS/facade_class, assignment_link_for fallback behavior, SyncAllCourseAssignmentsJob with a Pensive course link, and Request#approve dispatching whole-day extensions through PensiveFacade.
  • Live smoke testing against the real Pensive API was not possible due to network policy restrictions and missing credentials/endpoint config (see above).

Documentation

Added a "Pensive" section to docs/integrations.md covering required environment variables, course-linking steps, the assignment-sync response contract Pensive must implement, and how extension posting works. .env.example documents the new variables inline.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

Extract and implement Pensive LMS integration logic to support syncing assignments and posting whole-day extensions via the legacy Pensive API. Adds a new `PensiveFacade`, database migration for LMS ID 3, request provisioning logic, and configuration documentation.

https://www.superconductor.com/tickets/hDh9FH7DgNTw/implementations/PN7CTPJwn9TL#message_fnKC8k68zD9f

Co-authored-by: Codex <199175422+chatgpt-connector[bot]@users.noreply.github.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