Support instruction steps - #953
Draft
zetter-rpf wants to merge 2 commits into
Draft
Conversation
zetter-rpf
force-pushed
the
instruction-steps
branch
from
August 7, 2026 09:40
cf0927d to
4f01c88
Compare
Test coverage92.18% line coverage reported by SimpleCov. |
zetter-rpf
force-pushed
the
instruction-steps
branch
from
August 7, 2026 10:04
4f01c88 to
c10b927
Compare
zetter-rpf
marked this pull request as ready for review
August 7, 2026 10:08
raspberrypiherokubot
temporarily deployed
to
editor-api-p-instructio-tqy3iv
August 7, 2026 10:10
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for storing project instructions as multi-step content (JSON) while adjusting update behavior so student attempts to change instructions are ignored rather than rejected. This fits into the Rails REST API layer (controllers + Jbuilder) and the Project::Update domain operation.
Changes:
- Convert
projects.instructionsfromtexttojsonbto support either a plain markdown string or an array of instruction steps. - Update request handling so students cannot submit
instructionsvia strong params (making instruction updates a no-op for students). - Extend request specs to cover reading/writing the instruction-steps format and update unit specs for the new
Project::Updatesignature.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/requests/projects/update_spec.rb | Adds coverage for saving/returning instruction steps; updates student behavior expectation to “ignore” instruction changes. |
| spec/requests/projects/show_spec.rb | Adds coverage for returning instruction steps when stored as an array. |
| spec/concepts/project/update_spec.rb | Updates unit specs for Project::Update signature change; removes student/teacher branching in operation tests. |
| spec/concepts/project/update_invalid_spec.rb | Updates unit spec call signature for Project::Update. |
| spec/concepts/project/update_delete_components_spec.rb | Updates unit spec call signature for Project::Update. |
| spec/concepts/project/update_default_component_spec.rb | Updates unit spec call signature for Project::Update. |
| lib/concepts/project/operations/update.rb | Removes current_user-based validation and always assigns :instructions if present in update_hash. |
| db/schema.rb | Reflects projects.instructions as jsonb. |
| db/migrate/20260807120000_change_projects_instructions_to_jsonb.rb | Migration to convert instructions from text to jsonb (and back). |
| config/locales/en.yml | Removes now-unused “student_update_instructions” translation. |
| app/controllers/api/projects/remixes_controller.rb | Permits instruction-step shape in remix request params. |
| app/controllers/api/projects_controller.rb | Moves instruction-update prevention for students into strong params; refactors permitted attributes list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Previously project instructions could only be a single markdown
string, with no way to break guidance into discrete, orderable
steps.
This change adds an instruction_steps jsonb column and stores the
new array-of-steps format there, leaving the existing instructions
text column untouched - it never needs to change type, so there is
no risk of a running server caching a stale column type against it.
Project#instructions reads instruction_steps when present and falls
back to the legacy text column otherwise; the controller permits
either a plain string or an array of {markdown_content} steps under
the same instructions param, so no other call site needs to know
about the split.
Existing rows keep instruction_steps nil until a project is saved
through the new format - no backfill needed.
Previously Project::Update compared old and new instructions to detect and reject a student trying to change them, needing a current_user argument and a JSON-normalising comparison just to tell Parameters and plain Ruby values apart. This change drops :instructions from the permitted params entirely when the current user is a student, so their attempt is filtered out the same way Rails treats any other unpermitted param. The request now succeeds with the change silently ignored, instead of returning a 422. Project::Update no longer needs to know who the current user is.
zetter-rpf
marked this pull request as draft
August 7, 2026 13:12
zetter-rpf
force-pushed
the
instruction-steps
branch
from
August 7, 2026 13:16
c10b927 to
1562b28
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
What's changed?
The new instructions will be in a format such as:
This change is backwards compatible with our existing instructions since sole strings are allowed in the JSONB column.