Scratch projects create action for remixing - #728
Conversation
This is based on the similar endpoint in Experience CS. Having this will allowed me to test the behaviour of Scratch remixing locally and it will allow us to start work implementing remixing on the frontend before the API is fully implemented. I considered re-using our existing endpoint for remixing, but this is not possible because Scratch does not support updating an unsaved project's id (see [1] for more). [1] - RaspberryPiFoundation/digital-editor-issues#1189 (comment)
Test coverage89.95% line coverage reported by SimpleCov. |
There was a problem hiding this comment.
Pull request overview
Adds a minimal POST /api/scratch/projects endpoint to support local testing of Scratch “remix” project creation behind the existing cat_mode feature flag and cookie-based auth, aligning with the existing Scratch stub endpoints.
Changes:
- Add
createroute forapi/scratch/projects. - Implement
ProjectsController#createwith a remix-only guard (is_remix). - Add request specs covering auth, feature-flag gating, remix-only behavior, and success response shape.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| spec/features/scratch/creating_a_scratch_project_spec.rb | Adds request coverage for the new Scratch project create/remix endpoint. |
| config/routes.rb | Exposes POST /api/scratch/projects via resources :projects, only: ... create. |
| app/controllers/api/scratch/projects_controller.rb | Implements create action and a before_action to forbid non-remix creates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
abcampo-iry
left a comment
There was a problem hiding this comment.
This seems reasonable as a placeholder before enabling remix.
Related to: https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1189
This is based on the similar endpoint in Experience CS.
Having this will allowed me to test the behaviour of Scratch remixing locally and it will allow us to start work implementing remixing on the frontend before the API is fully implemented.
I considered re-using our existing endpoint for remixing, but this is not possible because Scratch does not support updating an unsaved project's id (see [1] for more).
[1] - https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1189#issuecomment-4047292796