Skip to content

Restore "Migrate UNIT_AND_LEVEL_TO_LESSON_S3_NAME to ai_rubric_s3_config on unit model"#71285

Draft
davidsbailey wants to merge 3 commits intostagingfrom
revert-71278-revert-71016-move-rubric-ai-config-to-unit
Draft

Restore "Migrate UNIT_AND_LEVEL_TO_LESSON_S3_NAME to ai_rubric_s3_config on unit model"#71285
davidsbailey wants to merge 3 commits intostagingfrom
revert-71278-revert-71016-move-rubric-ai-config-to-unit

Conversation

@davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented Mar 11, 2026

Background

Reverts #71278, restoring #71016.

I didn't get a complete root cause on the original PR, but the problem was that seeding failed during the seed step during deploy in the test and production chef-managed environments. The issue was able to reach production because I manually worked around the issue in test by explicitly seeding each ai-rubric-enabled unit via cd dashboard; bundle exec rake seed:single_script SCRIPT_NAME=allthethings (for example).

Here is the error log from the initial failure in the test environment (slack):

Aws::S3::Errors::NoSuchKey: Error parsing script file ./config/scripts_json/allthethings.script_json: The specified key does not exist.
...
Caused by:
Aws::S3::Errors::NoSuchKey: The specified key does not exist.
...
/home/ubuntu/test/dashboard/app/jobs/concerns/ai_rubric_config.rb:39:in `read_file_from_s3'
/home/ubuntu/test/dashboard/app/jobs/concerns/ai_rubric_config.rb:89:in `get_s3_learning_goals'
/home/ubuntu/test/dashboard/app/models/learning_goal.rb:29:in `validate_ai_config'
...
/home/ubuntu/test/dashboard/lib/services/script_seed.rb:736:in `import_learning_goals'

I was able to determine that the error occurred because ai_rubric_s3_config did not appear in the properties field on the unit object at the time import_learning_goals was called, even though it should have been set earlier in the same file when the unit was seeded:

After reverting the original PR, I wasn't able to get a local repro.

Description

Since I wasn't able to get a local repro, but I was able to debug far enough to determine that the problem was ai_rubric_s3_config not getting seeded early enough, the new approach I'm going with here is to have this PR add ai_s3_rubric_config to the unit model and the affected units, and then change the implementation to start using the new config in a next PR (by reverting 8830412).

Caveats

Since a root cause of the initial issue was not determined, there's some risk that adding a new ai-enabled rubric to a new unit could cause similar problems. if that happens, we can investigate at that time.

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.

1 participant