You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Course Copy through cartridge export and import - #327
Add a Course Copy tab on course Settings, next to Import and Export.
Copying exports the chosen course to a temporary Common Cartridge and then runs the existing import, including module selection and the option to delete this course's content first.
Sources are the site file-based course, when one is configured, and other manifest courses owned by the current user. The file-based export is the same zip writer /cc/export uses.
Test plan
Open Settings on a manifest course and confirm the Course Copy tab sits after Export.
Copy from the site course: choose it, then copy all modules into the current course without deleting existing content.
Copy selected modules only, and confirm unselected modules are not added.
Copy with delete-this-course's-content-first, and confirm the domain, title, and member-count check still blocks a mismatched confirmation.
Copy from another manifest course you own, and confirm a course you do not own cannot be selected or posted.
Start an Import upload, then open Course Copy, and confirm the two pending cartridges do not replace each other.
Download a file-based cartridge from /cc/export and confirm it still matches the previous export.
Summary by CodeRabbit
New Features
Added a Course Copy tab in settings, where instructors can choose an available course and copy its modules into the current course.
Copying supports file-based and manifest-based courses. The current course is excluded from the source list, and confirmation is required before replacing existing content.
Improvements
Copy operations display copy-specific status and error messages, keeping them separate from regular imports.
Failed or canceled copies clean up temporary export files without affecting pending imports.
No actionable comments were generated in the recent review.
Walkthrough
Adds a course-mounted copy flow for readable file-based lessons and owned manifest courses. The flow exports a cartridge and uses copy-specific pending state for module selection and import processing. The file-based /cc export now uses the extracted LessonsLegacyExport writer.
Adds LessonsLegacyExport::writeZip to write file-based lesson cartridges. cc/export.php delegates cartridge generation to this method. The helper documentation describes its file-based export use.
Course source discovery and export lib/src/Services/Cartridge/CourseCopy.php, lib/tests/Services/Cartridge/CourseCopyTest.php
Adds validation and discovery for readable file-based lessons and owned manifest courses. Exports eligible sources to cartridges and tests source parsing, discovery, and module listings.
Adds keyed pending-cartridge operations and uses a separate session entry for course copies. Import confirmation and module selection are shared, while copy messages and cleanup target the copy entry.
sequenceDiagram
actor Instructor
participant Settings
participant CourseCopy
participant LessonsLegacyExport
participant LessonsCartridge
Instructor->>Settings: Select a source course
Settings->>CourseCopy: Export the selected source
alt File-based source
CourseCopy->>LessonsLegacyExport: Write file-based cartridge
LessonsLegacyExport-->>CourseCopy: Cartridge written
else Manifest source
CourseCopy->>LessonsCartridge: Write manifest cartridge
LessonsCartridge-->>CourseCopy: Cartridge written
end
CourseCopy-->>Settings: Return export result
Settings-->>Instructor: Show copy import flow
Loading
Merge Risk: Minimal · up to 1ac75
The change has no remaining actionable merge-blocking risk in the supplied evidence.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: adding Course Copy through cartridge export and import.
Docstring Coverage
Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 36 functions across 14 files.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ast-grep (0.51.1)
ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/rust/security/sql-injection-format-rust.yml
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
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.
Reviewing files that changed from the base of the PR and between 2d81326 and 1ac7501.
Files selected for processing: 1
lib/tests/Services/Cartridge/CourseCopyTest.php
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
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
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.
Summary
/cc/exportuses.Test plan
/cc/exportand confirm it still matches the previous export.Summary by CodeRabbit