Skip to content

Set origin when syncing ExCS projects - #1006

Merged
zetter-rpf merged 4 commits into
mainfrom
1775-set-origin-when-syncing-ExCS-projects
Sep 9, 2026
Merged

Set origin when syncing ExCS projects#1006
zetter-rpf merged 4 commits into
mainfrom
1775-set-origin-when-syncing-ExCS-projects

Conversation

@cocomarine

@cocomarine cocomarine commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Status

Why this bug

  • experience_cs is added to origin during authenticated project creation, not sent by ExCS.
  • This covers the situation when teacher adds project to class (Lesson::Create#build_copy → Project::Copying.copy_project) and subsequent student remix.
  • However, this does not cover Project::Update branch:
    • where project stub already exists for that identifier and locale.
    • where project is migrated using ExperienceCsProjectMigrationsController which does not update origin.

What's changed?

  • Set origin for ExCS admin path in Project::Update and its controller.
  • Added origin to ExperienceCsProjectMigrationsController#migrate_project!
  • Backfill?

@cla-bot cla-bot Bot added the cla-signed label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test coverage

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

@cocomarine
cocomarine temporarily deployed to editor-api-p-1775-set-o-mroii8 September 8, 2026 13:31 Inactive
@cocomarine
cocomarine marked this pull request as ready for review September 9, 2026 09:21
Copilot AI lite review requested due to automatic review settings September 9, 2026 09: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.

🟢 Approval recommended

The change is narrowly scoped, aligns with existing ExCS origin behavior, and is covered by targeted request and unit specs.

Pull request overview

Ensures Experience CS (ExCS) projects have origin = experience_cs set consistently when they are synced/updated via the ExCS admin/service flows, including migrations, aligning update behavior with existing authenticated creation behavior in the Rails API domain layer.

Changes:

  • Pass current_user into Project::Update and set origin when the updater is an ExCS admin/service account.
  • Set origin during Experience CS project migration updates.
  • Add request/unit specs to cover origin-setting behavior for ExCS update/migration paths and ensure non-ExCS updates don’t set origin.
File summaries
File Description
spec/requests/projects/update_spec.rb Adds request coverage to assert origin behavior for ExCS admin/service updates and unchanged origin for normal updates.
spec/requests/experience_cs_project_migrations/update_spec.rb Extends migration request expectations to include origin: experience_cs.
spec/concepts/project/update_spec.rb Adds unit coverage for setting origin when current_user is an ExCS admin.
lib/concepts/project/operations/update.rb Adds current_user input and assigns origin for ExCS admin/service updates.
app/controllers/api/projects_controller.rb Passes current_user through to Project::Update so the operation can apply ExCS-specific behavior.
app/controllers/api/experience_cs_project_migrations_controller.rb Sets origin while migrating a stub project into an ExCS project.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@zetter-rpf
zetter-rpf merged commit d420632 into main Sep 9, 2026
9 checks passed
@zetter-rpf
zetter-rpf deleted the 1775-set-origin-when-syncing-ExCS-projects branch September 9, 2026 09:26
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