Skip to content

feat!: rename LibraryCollectionLocator.collection_id to collection_code#434

Closed
kdmccormick wants to merge 1 commit intomasterfrom
kdmccormick/collection-key
Closed

feat!: rename LibraryCollectionLocator.collection_id to collection_code#434
kdmccormick wants to merge 1 commit intomasterfrom
kdmccormick/collection-key

Conversation

@kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Mar 25, 2026

BREAKING CHANGE: LibraryCollectionLocator.collection_id is renamed to LibraryCollectionLocator.collection_code. There is a readonly collection_id`` property for backwards compatibility, but calls to the constructor which use the collection_id=kwarg must be updated tocollection_code=`.

Part of: openedx/openedx-core#322

Related openedx-core PR: openedx/openedx-core#504
Related openedx-platform PR: openedx/openedx-platform#38214

BREAKING CHANGE: `LibraryCollectionLocator.collection_id` is renamed to
`LibraryCollectionLocator.collection_code`.  There is a readonly
`collection_id`` property for backwards compatibility, but calls to the
constructor which use the `collection_id=` kwarg must be updated to
`collection_code=`.

Part of: openedx/openedx-core#322
@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.13%. Comparing base (5e1a96d) to head (fd1d2c6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #434   +/-   ##
=======================================
  Coverage   94.13%   94.13%           
=======================================
  Files          31       31           
  Lines        3068     3071    +3     
  Branches      191      191           
=======================================
+ Hits         2888     2891    +3     
  Misses        155      155           
  Partials       25       25           
Flag Coverage Δ
unittests 94.13% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

This looks good, but there are a lot of other similar things I'd like to fix. Is your idea to do them all incrementally, releasing many breaking versions of opaque-keys ?

LibraryContainerLocator.container_type -> container_type_code
LibraryContainerLocator.container_id -> container_code
LibraryUsageLocatorV2.usage_id -> usage_code
LibraryLocatorV2.org -> org_code
LibraryLocatorV2.slug -> library_code

and that's just for V2 libraries.

"""
return self.lib_key.org

@property
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the @deprecated decorator? It's technically a Python 3.13 feature but you can get it via from typing_extensions import deprecated in 3.12.

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea. i'll do that when I open the broader renaming PR

Comment on lines +4 to +5
There is a readonly ``collection_id`` property for backwards compatibility, but calls to the constructor
which use the ``collection_id=`` kwarg must be updated to ``collection_code=``.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we make the constructor accept a backwards compatible kwarg, so this isn't a breaking change? Because it's difficult, or because we want to force a change sooner and avoid having an inconsistent state for a long time?

@kdmccormick
Copy link
Member Author

Yeah, maybe it's better to do all these changes in one PR. I was worried about the headache of so having many breaking change at once, but I like the idea of supporting old kwarg names, which would mean we could avoid having any breaking changes for now.

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