Record source project when adding ExCS projects - #989
Open
cocomarine wants to merge 4 commits into
Open
Conversation
Test coverage93.5% line coverage reported by SimpleCov. |
raspberrypiherokubot
temporarily deployed
to
editor-api-p-1724-add-s-m22az1
August 28, 2026 10:31
Inactive
cocomarine
marked this pull request as ready for review
August 28, 2026 12:54
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated source_project_id lineage field on Project to track Experience CS “source” projects separately from remix lineage, avoiding behavior/permission regressions tied to remixed_from_id.
Changes:
- Add
projects.source_project_idwith a self-referential FK (nullified on source deletion) and correspondingProjectassociations (source_project/derived_projects). - Ensure lesson project creation records
source_project_idand explicitly clears remix fields during ExCS-to-lesson copying. - Add specs covering association behavior, lesson copy behavior, and remix behavior when a project already has a
source_project.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
app/models/project.rb |
Adds self-referential associations for source_project and derived_projects. |
lib/concepts/lesson/operations/create.rb |
Sets source_project_id for ExCS-based lesson project copies and clears remix fields. |
db/migrate/20260828095502_add_source_project_to_projects.rb |
Adds source_project reference to projects with FK nullify-on-delete. |
db/schema.rb |
Reflects the new column, index, and FK. |
spec/models/project_spec.rb |
Adds association coverage and verifies nullification when source project is destroyed. |
spec/concepts/project/create_remix_spec.rb |
Verifies remixes preserve source_project_id while remixed_from_id points to the immediate parent. |
spec/concepts/lesson/create_spec.rb |
Asserts lesson creation records source_project_id and does not inherit remix fields from the source. |
spec/concepts/lesson/create_copy_spec.rb |
Ensures lesson copy preserves source_project_id when copying a lesson whose project already has a source. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Status
Why not reuse
remixed_from_id?What's changed?
source_project_idcolumn