Skip to content

Identify Experience CS projects - #975

Draft
cocomarine wants to merge 5 commits into
mainfrom
1717-add-project-origin-column
Draft

Identify Experience CS projects#975
cocomarine wants to merge 5 commits into
mainfrom
1717-add-project-origin-column

Conversation

@cocomarine

@cocomarine cocomarine commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Status

Points for consideration:

  • Security
  • Performance

What's changed?

  • Add origin column to Project
  • Validations:
    • inclusion in known origins (only Project::Origins::EXPERIENCE_CS for now)
    • allows nil value so that we can backfill, blocks any change once set
  • build_project now sets origin for ECS admins
  • Remix projects inherit origin from original project.
  • With Support service-authenticated Experience CS project and asset syncs #973 in, service-authenticated create also gets the origin assignment.

@cla-bot cla-bot Bot added the cla-signed label Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Test coverage

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

@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-1717-add-p-loqwkl August 20, 2026 14:16 Inactive
@cocomarine
cocomarine temporarily deployed to editor-api-p-1717-add-p-loqwkl August 20, 2026 15:48 Inactive
Comment thread lib/concepts/project/operations/create.rb
…in-column

# Conflicts:
#	app/models/project.rb
#	spec/features/project/creating_a_project_spec.rb
#	spec/models/project_spec.rb
@cocomarine
cocomarine temporarily deployed to editor-api-p-1717-add-p-loqwkl August 24, 2026 09:21 Inactive

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

Adds a first-class origin attribute to Project to mark Experience CS-created projects, with validations to allow backfill and prevent later modification, and ensures the origin is set during Experience CS admin/service project creation and preserved through remixing.

Changes:

  • Add projects.origin column + partial index for non-null origins.
  • Enforce origin validation (known origins only, allow nil, immutable once set).
  • Set origin during Experience CS admin/service project creation; ensure remixes inherit origin; add corresponding specs.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/models/project.rb Defines Origins::EXPERIENCE_CS and adds validation + immutability guard for origin.
lib/concepts/project/operations/create.rb Sets origin for Experience CS admins (incl. service account) during project creation.
db/migrate/20260820122510_add_origin_to_projects.rb Adds origin column and index for querying/filtering by origin.
db/schema.rb Reflects the new origin column and index in schema.
spec/models/project_spec.rb Covers origin inclusion validation and immutability on update.
spec/features/project/creating_a_project_spec.rb Verifies origin is set when an Experience CS admin creates a project via REST.
spec/concepts/project/create_spec.rb Verifies Project::Create sets origin only for Experience CS admins.
spec/concepts/project/create_remix_spec.rb Verifies remixes copy origin from the original project.

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

Comment on lines +3 to +8
class AddOriginToProjects < ActiveRecord::Migration[8.1]
def change
add_column :projects, :origin, :string
add_index :projects, :origin, where: 'origin IS NOT NULL'
end
end
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.

4 participants