Open
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. |
Contributor
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.
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.
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