Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jan 1, 2026

Resolves #18719

Summary by CodeRabbit

  • New Features

    • Added "List Assignments" action to retrieve course assignments.
    • Added "Update Assignment" action to modify assignment properties.
    • Enhanced Canvas integration with dynamic dependent fields and new methods to list accounts, users, courses, assignments, and update assignments.
    • Added submission and grading type constants for form options.
  • Chores

    • Bumped Canvas component version to 0.7.0.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jan 5, 2026 3:58pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 1, 2026

Walkthrough

Adds List Assignments and Update Assignment actions plus supporting Canvas app methods and constants; introduces cascading propDefinitions for accountId → userId → courseId → assignmentId, API helpers, and a package version bump.

Changes

Cohort / File(s) Summary
New Canvas Actions
components/canvas/actions/list-assignments/list-assignments.mjs, components/canvas/actions/update-assignment/update-assignment.mjs
Adds two action modules: list-assignments calls this.canvas.listAssignments() and returns assignments with an exported summary; update-assignment validates inputs, builds a Canvas-compatible payload (including conditional submission_types), calls this.canvas.updateAssignment(), and errors if no update fields provided.
Canvas App Infrastructure
components/canvas/canvas.app.mjs
Adds propDefinitions for cascading selects (accountId, userId, courseId, assignmentId), _baseUrl() and _makeRequest() helpers, and public API methods: listAccounts(), listUsers(), listCourses(), listAssignments(), updateAssignment(). Removes the old authKeys() stub.
Constants
components/canvas/common/constants.mjs
Introduces SUBMISSION_TYPES and GRADING_TYPES constants and exports them as default.
Package Version
components/canvas/package.json
Bumps package version from 0.6.0 to 0.7.0.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Action as Action Module
  participant App as Canvas App (propDefs + methods)
  participant API as Canvas REST API

  rect rgb(235,245,255)
  note right of User: List Assignments flow
  User->>Action: invoke list-assignments (accountId,userId,courseId)
  Action->>App: this.canvas.listAssignments(userId, courseId)
  App->>API: GET /api/v1/courses/{courseId}/assignments?user_id={userId}
  API-->>App: assignments[]
  App-->>Action: assignments[]
  Action-->>User: return assignments (exports summary)
  end

  rect rgb(245,235,255)
  note right of User: Update Assignment flow
  User->>Action: invoke update-assignment (courseId,assignmentId,fields...)
  Action->>Action: validate at least one field present
  Action->>App: this.canvas.updateAssignment(courseId, assignmentId, payload)
  App->>API: PUT /api/v1/courses/{courseId}/assignments/{assignmentId} (payload)
  API-->>App: updatedAssignment
  App-->>Action: updatedAssignment
  Action-->>User: return API response (exports summary)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only 'Resolves #18719' and does not follow the required template with a WHY section explaining the change rationale. Complete the description template by adding a WHY section explaining the motivation for implementing these Canvas assignment actions and their benefits.
Title check ❓ Inconclusive The title 'Canvas - new components' is vague and generic, failing to specify which new components or functionality was added. Replace with a specific title indicating the main feature, e.g., 'Canvas: Add list and update assignment actions' or 'Canvas: Implement assignment management actions'.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully implements both required features: list assignments action and update assignment action with proper Canvas API integration.
Out of Scope Changes check ✅ Passed All changes are in scope: two new assignment actions, supporting methods in canvas.app.mjs, constants file, and version bump are all directly related to issue #18719 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa2311 and 542f861.

📒 Files selected for processing (4)
  • components/canvas/actions/list-assignments/list-assignments.mjs
  • components/canvas/actions/update-assignment/update-assignment.mjs
  • components/canvas/canvas.app.mjs
  • components/canvas/package.json
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.

Applied to files:

  • components/canvas/canvas.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.

Applied to files:

  • components/canvas/canvas.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.

Applied to files:

  • components/canvas/canvas.app.mjs
🧬 Code graph analysis (2)
components/canvas/actions/list-assignments/list-assignments.mjs (1)
components/canvas/canvas.app.mjs (1)
  • assignments (60-63)
components/canvas/canvas.app.mjs (1)
components/canvas/actions/list-assignments/list-assignments.mjs (1)
  • assignments (42-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/canvas/package.json (1)

3-3: LGTM!

The version bump from 0.6.0 to 0.7.0 appropriately reflects the addition of new actions and API methods introduced in this PR.

components/canvas/canvas.app.mjs (4)

1-2: LGTM!

The axios import from @pipedream/platform is correct for making authenticated HTTP requests.


74-87: LGTM!

The _baseUrl and _makeRequest helper methods correctly construct Canvas API requests with proper authentication using the OAuth access token.


118-126: LGTM!

The updateAssignment method correctly uses the course-scoped endpoint (/courses/{courseId}/assignments/{assignmentId}), which differs from the user-scoped listing endpoint. This path difference is intentional per the Canvas API design.


6-72: The code is correct. The @pipedream/platform axios returns response.data on success by default, so the list methods (listAccounts, listUsers, listCourses, listAssignments) return arrays directly that can be mapped over in propDefinitions. No changes needed.

components/canvas/actions/update-assignment/update-assignment.mjs (1)

126-165: LGTM!

The validation logic correctly ensures at least one update field is provided before making the API call. The payload construction properly maps props to Canvas API field names, and Pipedream's axios automatically excludes undefined values, ensuring only specified fields are sent in the update request.

components/canvas/actions/list-assignments/list-assignments.mjs (1)

1-52: LGTM!

The list assignments action correctly implements the dependency chain (accountId → userId → courseId) and provides proper pluralization in the summary message. The implementation aligns well with the Canvas API method defined in canvas.app.mjs.

Note: Pagination concerns for the underlying listAssignments method have been flagged in the canvas.app.mjs review.

lcaresia
lcaresia previously approved these changes Jan 5, 2026
Copy link
Collaborator

@lcaresia lcaresia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, looks good, just have some improves to do. Moving to QA

Comment on lines 67 to 78
options: [
"online_quiz",
"none",
"on_paper",
"discussion_topic",
"external_tool",
"online_upload",
"online_text_entry",
"online_url",
"media_recording",
"student_annotation",
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this options to a constants.mjs file.

"points",
"not_graded",
],
optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this options to a constants.mjs file.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Fix all issues with AI Agents 🤖
In @components/canvas/common/constants.mjs:
- Around line 1-26: The SUBMISSION_TYPES constant is missing the
"basic_lti_launch" value used by Canvas; update the SUBMISSION_TYPES array in
components/canvas/common/constants.mjs to include "basic_lti_launch" (e.g., add
it alongside the other strings in the SUBMISSION_TYPES declaration) so any
submission processing that checks SUBMISSION_TYPES will recognize that type;
leave GRADING_TYPES and the default export unchanged.
♻️ Duplicate comments (1)
components/canvas/actions/update-assignment/update-assignment.mjs (1)

64-70: Previous concern about multiple submission types remains unresolved.

The constants have been properly extracted (addressing prior feedback), but the Canvas API's submission_types field accepts an array to support multiple submission types per assignment (e.g., both "online_upload" and "online_text_entry"). The current implementation still only allows selecting a single submission type.

🔎 Recommended refactor to support multiple submission types

Change the prop to accept an array:

 submissionType: {
-  type: "string",
+  type: "string[]",
   label: "Submission Type",
-  description: "The type of submission for the assignment",
+  description: "The types of submission allowed for the assignment. You can select multiple types.",
   options: constants.SUBMISSION_TYPES,
   optional: true,
 },

Then simplify the payload construction in the run method:

-          submission_types: this.submissionType
-            ? [
-                this.submissionType,
-              ]
-            : undefined,
+          submission_types: this.submissionType,

Based on Canvas API documentation, submission_types is designed to accept arrays like ["online_text_entry", "online_url"].

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 542f861 and b852dba.

📒 Files selected for processing (2)
  • components/canvas/actions/update-assignment/update-assignment.mjs
  • components/canvas/common/constants.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (4)
components/canvas/actions/update-assignment/update-assignment.mjs (4)

1-15: LGTM!

The imports correctly reference the new constants file (addressing previous review feedback), and the action metadata is properly structured with appropriate annotations for an update operation.


16-51: LGTM! Cascading prop dependencies are properly implemented.

The cascading propDefinitions (accountId → userId → courseId → assignmentId) correctly enable progressive selection in the UI.

Minor note: assignmentId receives both courseId and userId (lines 47-48), though userId may be redundant since assignments are typically scoped to courses. This is not an issue and may be required by the Canvas app's internal implementation.


110-122: Excellent validation logic!

Requiring at least one updatable field prevents no-op API calls and provides clear feedback to users. This is a good practice for update operations.


124-148: API call structure and field mapping look correct.

The payload construction properly maps JavaScript naming conventions to Canvas API's snake_case format, and the assignment response is appropriately returned with a success message.

Note: Lines 132-136 correctly wrap the submission type in an array as required by the Canvas API, but this implementation is limited by the single-selection submissionType prop (see earlier comment on lines 64-70).

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927
Copy link
Collaborator Author

/approve

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.

[ACTION] Canvas

4 participants