Allow Experience CS to sync public Scratch projects - #959
Merged
Conversation
Test coverage92.2% line coverage reported by SimpleCov. |
abcampo-iry
force-pushed
the
issues/1657
branch
3 times, most recently
from
August 11, 2026 09:13
65bcf27 to
4c9fec0
Compare
raspberrypiherokubot
temporarily deployed
to
editor-api-p-issues-165-tnrv7l
August 11, 2026 09:19
Inactive
abcampo-iry
marked this pull request as ready for review
August 11, 2026 09:33
Contributor
There was a problem hiding this comment.
Pull request overview
Enables Experience CS administrators to synchronize public, localized Scratch-based templates by allowing updates to project type and Scratch SB3 payloads, and by widening the “instructions” validation exception for public code_editor_scratch projects.
Changes:
- Allow public, localized
code_editor_scratchprojects to storeinstructions(model validation change + specs). - Permit Experience CS admins to update
project_typeand create/update a project’sScratchComponentvia the projects update endpoint. - Extend request/feature specs to cover Experience CS admin create/update flows and non-admin restrictions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/requests/projects/update_spec.rb | Adds coverage for blocking non-admin type/Scratch updates and allowing Experience CS admin updates. |
| spec/models/project_spec.rb | Verifies validation exception for instructions on public localized code_editor_scratch projects only. |
| spec/features/project/creating_a_project_spec.rb | Updates Experience CS admin create flow to include instructions + Scratch SB3 payload. |
| lib/concepts/project/operations/update.rb | Adds support for updating project_type and persisting a ScratchComponent during project update. |
| app/models/project.rb | Relaxes instructions validation for public localized code_editor_scratch projects. |
| app/controllers/api/projects_controller.rb | Makes project_type/scratch_component params conditional (create or Experience CS admin). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
abcampo-iry
force-pushed
the
issues/1657
branch
from
August 11, 2026 09:45
4c9fec0 to
4ce2b0a
Compare
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
Partially closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1657
Related to https://github.com/RaspberryPiFoundation/experience-cs/pull/2330
Points for consideration:
Security: Only users with the
experience-cs-adminrole can change the project type and Scratch data for public projects.Security: Projects are not yet marked as coming from Experience CS. Until origin tracking is added, only known Experience CS project identifiers should be enabled for synchronization.
What's changed?
code_editor_scratchprojects to contain instructions. This is a narrow exception to Restrict instructions to school projects (#479) for public Experience CS templates. This may be worth discussing.code_editor_scratch.Some concerns of mine were to understand the cases:
Existing ExCS stub with no ScratchComponent -> Create ScratchComponent -> Store the ExCS code -> Change type from scratch to code_editor_scratch
Existing ExCS project with a ScratchComponent -> Replace its content with the latest ExCS code -> This is intentional because ExCS is the source of truth
User-owned project -> Cannot be updated by an experience-cs-admin -> Authorization prevents the overwrite
Unrelated public project with the same identifier -> Could currently be overwritten -> This is the known provenance/origin risk mentioned in the ticket