Skip to content

Java Lab2: fix start images seeding bug#73448

Open
molly-moen wants to merge 3 commits into
stagingfrom
molly/java-lab2-start-images
Open

Java Lab2: fix start images seeding bug#73448
molly-moen wants to merge 3 commits into
stagingfrom
molly/java-lab2-start-images

Conversation

@molly-moen

@molly-moen molly-moen commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Previously, in start mode only, if a level was migrated from legacy to lab2, if a levelbuilder edited the start code
and deleted all the assets they would re-populate from the legacy starter_assets field, because we would always pull in those assets if there were no assets in the project. This updates the start code save logic to delete the starter_assets if we are saving lab2 Java Lab code, as that code will always put the starter assets in the code blob itself.

Testing story

Tested locally--you can see the results in the Theater level where the starter_assets are now gone from the separate field, and are only in the code (previously this level had not been edited from the legacy shape).

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

Fixes a Java Lab (Lab2) start-mode regression in dashboard/levelbuilder where legacy starter_assets could silently re-seed after a levelbuilder removed all assets, by clearing the legacy mapping when saving Lab2 Java Lab start code.

Changes:

  • Add Javalab#clear_lab2_starter_assets to drop legacy starter_assets for uses_lab2 Java Lab levels.
  • Invoke that clearing during LevelsController#update_start_code.
  • Add controller tests for Lab2 vs legacy Java Lab behavior; update the affected Theater Lab2 level file and Lab2 README to reflect the new behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dashboard/test/controllers/levels_controller_test.rb Adds coverage ensuring Lab2 Java Lab start-code saves clear starter_assets, while legacy Java Lab preserves them.
dashboard/config/levels/custom/javalab/Allthethings Java Lab2 Theater.level Removes legacy starter_assets mapping from this Lab2 Theater level and represents the starter asset via start_sources URL.
dashboard/app/models/levels/javalab.rb Introduces clear_lab2_starter_assets to nil out the legacy mapping for Lab2 levels.
dashboard/app/controllers/levels_controller.rb Calls the new Javalab helper during update_start_code to prevent legacy reseeding.
apps/src/javalab/lab2/README.md Updates documentation to note that start-code saves drop the legacy starter_assets mapping in Lab2.

@molly-moen molly-moen marked this pull request as ready for review June 24, 2026 16:01
@molly-moen molly-moen requested a review from a team June 24, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants