GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: populate channel snapshot fields on draft ChannelVersion during draft publish by rtibblesbot · Pull Request #5851 · learningequality/studio

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Apr 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Fixes the draft publish path to populate four channel-snapshot fields on the draft ChannelVersion row: channel_name, channel_description, channel_thumbnail_encoding, and channel_language.

ChannelVersion.save() has a snapshot branch gated on self._state.adding and self.version == self.channel.version, which never fires for drafts (version=None). This PR extends that condition to also trigger when self.version is None, so every save of a draft ChannelVersion row snapshots the current channel fields — covering both the first draft publish and subsequent refreshes that must overwrite stale values.

References

Fixes #5850. Related to #5841.

Reviewer guidance

The change is a one-line condition extension in ChannelVersion.save() in models.py: the existing snapshot branch (self._state.adding and self.version == self.channel.version) gains an or self.version is None guard so it also fires for draft rows. The snapshot field assignments (channel_name, channel_description, channel_tagline, channel_thumbnail_encoding, channel_language) are unchanged. The non-draft publish path is unaffected.

Two unit tests in DraftPublishChannelTestCase verify: (a) first draft publish populates all four fields, (b) a second draft publish overwrites stale values.

AI usage

Claude Code (claude-sonnet-4-6) implemented the fix and tests from a written plan. I reviewed the generated code for correctness, confirmed the non-draft publish path is unaffected, and verified the tests pass.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

status

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rtibblesbot
rtibblesbot marked this pull request as ready for review April 18, 2026 20:19
rtibbles
rtibbles requested changes Apr 18, 2026
View reviewed changes

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify the code and not duplicate how we copy data from the Channel object to the ChannelVersion object - and remove an unnecessary test.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rtibblesbot reacted with eyes emoji
All reactions
  • 👀 1 reaction
Comment thread contentcuration/contentcuration/utils/publish.py Outdated
version_obj.non_distributable_licenses_included = (
non_distributable_licenses_included
)
if is_draft:

@rtibbles rtibbles Apr 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused why this is even needed here, now that I look at the underlying code more closely - why don't we just loosen the condition that sets this exact setting in the ChannelVersion save method? That would require no changes here, we could just have it save when self.version is None or ... <existing conditions>.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rtibblesbot rtibblesbot Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — moved the snapshot logic into ChannelVersion.save() by changing the condition to self.version is None or (self._state.adding and self.version == self.channel.version). The if-is_draft block in fill_published_fields is removed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread contentcuration/kolibri_public/tests/test_public_v1_api.py Outdated
{1: "v1 notes", 3: "v3 notes"},
)

def test_draft_channel_version_token_returns_snapshot_fields(self):

@rtibbles rtibbles Apr 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a totally unnecessary test addition, please remove.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rtibblesbot rtibblesbot Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rtibblesbot @claude
fix: snapshot channel fields on draft ChannelVersion in save()
7bd6d34
Loosen the snapshot condition in ChannelVersion.save() to also fire when
version is None (draft rows), so every draft publish captures the current
channel name, description, thumbnail encoding, tagline, and language on
the draft ChannelVersion. Repeated draft publishes always reflect the
latest channel state.

Tests cover: first draft publish populates all four snapshot fields, and a
second draft publish after mutating channel metadata (including language
change from "en" to "fr") refreshes all four fields on the existing row.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@rtibblesbot
rtibblesbot force-pushed the issue-5850-6be591 branch from ea6aa2b to 7bd6d34 Compare April 18, 2026 22:58
rtibbles
rtibbles approved these changes Apr 18, 2026
View reviewed changes

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, clean, minimal diff, and regression tested!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rtibbles
rtibbles merged commit d9dbadb into learningequality:unstable Apr 18, 2026
15 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rtibbles rtibbles mentioned this pull request Apr 19, 2026
Draft publish writes non-zero version to exported content database ChannelMetadata #5852
Closed
4 tasks
@rtibbles rtibbles mentioned this pull request May 13, 2026
2026.05.13 Release #5902
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rtibbles rtibbles rtibbles approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Draft publish does not snapshot channel metadata on draft ChannelVersion

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rtibblesbot @rtibbles
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.