Skip to content

Migrate ExCS finished projects to complete - #1021

Open
zetter-rpf wants to merge 4 commits into
mainfrom
migrated-mark-as-finished
Open

zetter-rpf wants to merge 4 commits into
mainfrom
migrated-mark-as-finished

Conversation

@zetter-rpf

@zetter-rpf zetter-rpf commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Status

Points for consideration:

This changes:

  • Convert projects that have been marked as finished to complete
  • Disable the salesforce sync while updating these projects

I've put the ability to disable the salesforce sync in as the syncing serves no purpose for this change (as the sync currently adds the finished projects to the submitted ones) and I am worried the the volume of syncs will slow down the migration.

See commits for more

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

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

Test coverage

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

@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-migrated-m-kdtqcp September 17, 2026 07:56 Inactive
@zetter-rpf
zetter-rpf force-pushed the migrated-mark-as-finished branch from 096400c to 847aee5 Compare September 17, 2026 08:25
@zetter-rpf
zetter-rpf temporarily deployed to editor-api-p-migrated-m-kdtqcp September 17, 2026 08:25 Inactive
@zetter-rpf zetter-rpf changed the title Migrated mark as finished Migrated ExCS projects are marked as finished to submitted Sep 17, 2026
@zetter-rpf
zetter-rpf marked this pull request as ready for review September 17, 2026 09:24
Copilot AI lite review requested due to automatic review settings September 17, 2026 09:24

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.

🟡 Changes recommended

Historical projects entering the complete state are not converted to submitted.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Migrates Experience CS projects marked as finished into the submitted state while suppressing Salesforce synchronization.

Changes:

  • Converts eligible projects with transition metadata.
  • Adds scoped Salesforce-sync suppression.
  • Updates migration and model test coverage.
File summaries
File Summary
spec/requests/experience_cs_project_migrations/update_spec.rb Tests migration conversion and sync suppression.
spec/models/school_project_spec.rb Updates transition metadata expectations.
lib/feature_flags.rb Adds scoped Salesforce suppression.
app/models/school_project.rb Supports transition metadata.
app/models/current.rb Stores request-scoped suppression state.
app/controllers/api/experience_cs_project_migrations_controller.rb Performs migration conversion.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 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/experience_cs_project_migrations_controller.rb Outdated
@zetter-rpf
zetter-rpf marked this pull request as draft September 17, 2026 09:34
@zetter-rpf
zetter-rpf force-pushed the migrated-mark-as-finished branch from 847aee5 to 1668ccd Compare September 17, 2026 13:16
@zetter-rpf zetter-rpf changed the title Migrated ExCS projects are marked as finished to submitted Migrated ExCS projects are marked as finished to complete Sep 17, 2026
@zetter-rpf
zetter-rpf temporarily deployed to editor-api-p-migrated-m-kdtqcp September 17, 2026 13:17 Inactive
@zetter-rpf
zetter-rpf force-pushed the migrated-mark-as-finished branch from 1668ccd to de87af8 Compare September 17, 2026 13:21
@zetter-rpf
zetter-rpf temporarily deployed to editor-api-p-migrated-m-kdtqcp September 17, 2026 13:21 Inactive
Previously Experience CS marked projects submitted by setting
school_projects.finished, bypassing the state machine we use
for other classroom projects.

So it's clear that these are from a migration and not submitted by the
student at the time that the transition happened, I've avoided setting
the user id and added metadata to the transition.

I've chosen to make the projects as completed rather than submitted
as this is what the original backfill did when project states
were introduced - the worry was changing them to submitted would
create a backlog for teachers to review.

fixup
Previously Every ExCS project migration would a
Salesforce::LessonSyncJob, because updating the school project to set finished to false would trigger after_commit sync.

Because we are swapping a finished count to a submitted, the number we sync to salesforce won't change. Migrating thousands of projects would queue thousands of syncs for data that has not meaningfully changed.

I've done this by using a request attribute that is set and restored in the block
I was trying to run this locally and it didn't work because it was pointing to the wrong directory
The intention of this number is that it's projects that have been completed by students, while the finished_projects count only tracks projects that are waiting for teacher feedback.
@zetter-rpf
zetter-rpf force-pushed the migrated-mark-as-finished branch from de87af8 to cecab6f Compare September 17, 2026 13:23
@zetter-rpf
zetter-rpf marked this pull request as ready for review September 17, 2026 13:28
@zetter-rpf zetter-rpf changed the title Migrated ExCS projects are marked as finished to complete Migrated ExCS finished projects to complete Sep 17, 2026
@zetter-rpf zetter-rpf changed the title Migrated ExCS finished projects to complete Migrate ExCS finished projects to complete Sep 17, 2026
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