Skip to content

Support syncing ExperienceCS user projects - #979

Open
abcampo-iry wants to merge 4 commits into
mainfrom
issues/1709
Open

Support syncing ExperienceCS user projects#979
abcampo-iry wants to merge 4 commits into
mainfrom
issues/1709

Conversation

@abcampo-iry

@abcampo-iry abcampo-iry commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Status

What's changed?

Adds an endpoint for migrating an ExperienceCS project into its existing Code Classroom stub.

The migration:

  • Preserves the project identifier, locale, owner and permissions.
  • Copies the name, instructions, Scratch blocks and assets.
  • Keeps uploaded assets private.
  • Supports safe retries.
  • Uses service authentication instead of the project creator’s token.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Test coverage

93.46% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/32866482101

@abcampo-iry
abcampo-iry marked this pull request as ready for review August 25, 2026 13:21
Copilot AI lite review requested due to automatic review settings August 25, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for migrating ExperienceCS user Scratch projects into their existing Code Classroom “stub” projects, using a service-authenticated endpoint and ensuring migrations (and related asset uploads) can be retried safely without granting broad access to other projects.

Changes:

  • Adds PUT /api/experience-cs/projects/:id/migrate to replace a locale-less legacy Scratch stub in place and mark it as migrated (experience_cs_migrated_at) for safe replays.
  • Introduces service-account abilities to allow migration + migration-asset upload while preventing general project access.
  • Extends Scratch asset upload/view logic and test coverage to support migration assets and preserve project asset visibility rules.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/requests/experience_cs_project_migrations/update_spec.rb Request specs for the new migration endpoint behavior (in-place replace, idempotency, auth/locale rules).
spec/models/project_spec.rb Unit tests for Project#experience_cs_migration_target?.
spec/models/ability_spec.rb Ability specs for the ExperienceCS service account migration permissions.
spec/features/scratch/creating_and_showing_a_scratch_asset_spec.rb Feature specs for service-uploaded migration assets and migrated-asset visibility rules.
README.md Documents the new migration endpoint and how project-scoped migration assets behave.
db/schema.rb Schema version bump plus the new projects.experience_cs_migrated_at column.
db/migrate/20260824120000_add_experience_cs_migrated_at_to_projects.rb Migration adding experience_cs_migrated_at to projects.
config/routes.rb Adds the migration route under /api/experience-cs/projects/:id/migrate.
app/models/scratch_asset.rb Allows Scratch assets to belong to ExperienceCS Scratch project types (legacy + code editor scratch).
app/models/project.rb Adds experience_cs_migration_target? predicate used for authorization/eligibility.
app/models/ability.rb Adds service-account abilities and expands school owner visibility for remixed lesson projects.
app/controllers/api/scratch/assets_controller.rb Adds migration-asset upload support (service auth path, conflict checks, uploader attribution).
app/controllers/api/experience_cs_project_migrations_controller.rb New controller implementing the migration update operation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread app/controllers/api/scratch/assets_controller.rb
Comment thread app/models/project.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants