-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Containers/units: High level APIs and expanded test cases #278
base: braden/containers-units-ref
Are you sure you want to change the base?
Containers/units: High level APIs and expanded test cases #278
Conversation
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
I think we'll want some bookkeeping models in the
|
Yeah, I feel like we had this discussion at some point and came to the conclusion that it was because my original sketch for |
I had originally thought that these would be useful for history purposes, but I think it's not necessary if we have minor version tracking. I do wonder if the relationship between containers and versioning is basic enough where |
Though I guess one very confusing part about having a major and minor version for containers is that it's possible to publish any particular subset of the children, so it's not like there's really a published "1.12" version–"1.12" just means "twelve changes have happened to some descendent". So it'd be more like we'd be running two minor counters for children–one for draft changes, one for publishes. |
Also, I guess we should double-check the actual cost of encoding snapshots of the child versions given the current representation. Trying to sketch some of this out now... |
For now, I implemented a |
…-> entity_version
e8fecd1
to
236f7cc
Compare
cac79e1
to
3545527
Compare
|
||
Args: | ||
unit_version_pk: The unit version ID. | ||
def get_components_in_draft_unit( |
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.
It feels a bit suboptimal to me that we have to have separate APIs for get_components_in_draft_unit
and get_components_in_published_unit
. This is because when things are unpinned, we need to know whether to use the latest draft or latest published version.
I don't think this is a big deal, but it does "feel" to me like it goes against the spirit of the publishing app, where you have a series of versions and draft/published are just pointers to a particular version. With components (and presumably most PublishableEntities in general other than our new containers), if you ask for "version 37", you get a specific thing regardless of whether it is/was a draft or published. Whereas in this new case, you could try to request a particular version of a unit, but unless we know whether you want it as a draft or you want it as published, we usually can't fully describe that particular version's contents.
That is also why my proposed get_components_in_published_unit
API doesn't accept a version number; it can't really get anything other than the current published version. (The unit version is insufficient to specify a snapshot of the unit when things are unpinned.)
That said, there likely will still be a way to get snapshots of any historic published version you want, analogous to requesting a specific component version, but it will require asking for the state of the published unit when the entire LearningPackage was at a specific version, which is given by the PublishLog ID. Edit: I implemented an example of this in the PR as get_components_in_published_unit_as_of()
row = publishable_entities_in_rows.get(entity_pk) | ||
if row and row.order_num == order_num: | ||
new_entity_list.entitylistrow_set.add(row) | ||
continue |
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 had a bug - the code was moving EntityListRow
objects into the new EntityList
rather than copying them into it.
c17a738
to
5b93da6
Compare
5b93da6
to
74247f3
Compare
d8f7cb6
to
696d253
Compare
696d253
to
bbbd33e
Compare
Changes in this PR
Compared to the prototype in #251 :
EntitityListRow
: combineddraft_version
andpublished_version
into justentity_version
.contains_unpublished_changes
API to check if a unit's unpinned children have unpublished changes, even if the unit itself is unchanged.get_components_in_draft_unit
andget_components_in_published_unit
get_components_in_published_unit_as_of
API that can get the state of the unit at any previous point in the learning package's publication history.defined_list
/initial_list
/frozen_list
from theapi
for now. These are more of an internal implementation detail and we don't want the test cases tied too heavily to the internal details. I'm hoping we can remove these entirely, but we're still discussing that.TODO: maybe combine
defined_list
,initial_list
, andfrozen_list
?Questions
UX specs say modifying a child will mark the unit as "having unpublished changes" but ADR says otherwise. Does it make sense to implement a container_has_unpublished_changes() helper function that recursively checks for unpublished changes in a container (and its child containers, and so on...), so we can display this in the UI? See slack discussion
Do I understand correctly then that the version history of units should NOT be thought of as a series of snapshots of the unit (as I had been thinking) but rather a changelog of edits made to the unit itself (but ignoring most changes made its the children)?
PublishLog
PK. Should we have an API to get an old version of a unit by passing in a PublishLog PK (or timestamp)?get_components_in_published_unit_as_of
Is it correct that units allow you to pin the version of a component, which means you always get exactly that component, but sequences/subsections will not really support pinning in the same way, because even if you pin a unit to a specific version, the unpinned components in that unit can still be updated?
Do we have any plans to implement pinned/unpinned components in the UI or is everything unpinned?
If we have unpinned published versions, why do we need the various defined_list, initial_list, frozen_list etc? So far in the test cases I've been writing I haven't found a need to even reference
initial_list
norfrozen_list
.Why do we specifydraft_version_pks
andpublished_version_pks
when creating a new draft version of a unit? Seems wrong to say anything at all about the published version when it doesn't yet exist and may never exist.Note to self: if soft deleting a component doesn't mark the unit as changed, we need to update the UI to show soft deleted draft components and allow publishing the deletion. Or maybe this is handled by a
container_has_unpublished_changes
and recursivelying pseudo-publishing the container (no changes to container but force publish the children including soft deletes).