Repository navigation
fix: write course certificate settings to the draft branch - #395
Merged
Merged
Conversation
The LMS modulestore defaults to the published branch, so enabling certificates wrote the configuration and cert_html_view_enabled only to the published course. Studio reads the draft branch (it showed no certificate), the course overview was not refreshed, and the next Studio settings save re-published the draft over it. Editing inside a draft_preferred branch context matches Studio: the course block is a direct-only category, so the update is auto-published and course_published fires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Description:
Fixes
PUT /api/fx/courses/v1/certificates/<course_id>/withenabled=1(#393, shipped in v0.13.5). Found in the prod end-to-end test on 2026-10-01.Bug: the LMS modulestore defaults to the published branch (
published-only, confirmed on a prod pod).enable_course_certificatestherefore wrote the certificate configuration andcert_html_view_enabledonly to the published course:course-v1:lms+HP101+etw22: draft[], published[Course Certificate, active]).CourseOverview.has_any_active_web_certificatestayedFalse.Fix: read and update the course inside
modulestore().branch_setting(ModuleStoreEnum.Branch.draft_preferred, course_key), which is how Studio edits course settings. The course block is inDIRECT_ONLY_CATEGORIES, so split'supdate_itemauto-publishes it (_auto_publish_no_children) and emitscourse_published, which refreshes the course overview. I read this behaviour in the Teak source; it is to be confirmed on stage.enabled=0is unchanged (it only writes the issuance flag).Testing
tox -e py311-teak/sumac/redwood: 2250 passed, 100% coverage;tox -e qualitypasses.main(4 failures) and passes with this fix.enabled=1puts the config in both draft and published, Studio shows it active, andhas_any_active_web_certificateis true.Related Issue:
🤖 Generated with Claude Code