Skip to content

[CDF-27106] ✨ Add Data Product Versions (Alpha)#2536

Merged
ronpal merged 21 commits intomainfrom
cdf-27106/add-data-product-versions
Feb 19, 2026
Merged

[CDF-27106] ✨ Add Data Product Versions (Alpha)#2536
ronpal merged 21 commits intomainfrom
cdf-27106/add-data-product-versions

Conversation

@ronpal
Copy link
Collaborator

@ronpal ronpal commented Feb 18, 2026

Description

Implement CRUD support for data product versions, a sub-resource of data products.
Versions are nested under /dataproducts/{externalId}/versions and use semantic versioning. Reuses the existing DATA_PRODUCTS feature flag.

Bump

  • Patch
  • Skip

Changelog

Added

  • Data Product Version support (alpha)

Implement CRUD support for data product versions, a sub-resource
of data products. Reuses the DATA_PRODUCTS feature flag.
@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@ronpal
Copy link
Collaborator Author

ronpal commented Feb 18, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces CRUD support for Data Product Versions, including new API client methods, Pydantic resource models, and corresponding CRUD operations. The implementation adheres to the repository's style guide, utilizing strong typing with Pydantic models and providing clear structure for API interactions. Test fixtures have also been added to cover the new functionality. The logic for handling API limitations, such as retrieving all versions to perform updates or deletions, is correctly implemented.

ronpal and others added 2 commits February 18, 2026 10:38
Co-authored-by: Cursor <cursoragent@cursor.com>
The Data Products API is not available on the test server, so skip
DataProductVersionCRUD alongside DataProductCRUD.
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
34755 29740 86% 80% 🟢

New Files

File Coverage Status
cognite_toolkit/_cdf_tk/client/api/data_product_versions.py 26% 🟢
cognite_toolkit/_cdf_tk/client/resource_classes/data_product_version.py 61% 🟢
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_product_version.py 81% 🟢
cognite_toolkit/_cdf_tk/resource_classes/data_product_version.py 96% 🟢
TOTAL 66% 🟢

Modified Files

File Coverage Status
cognite_toolkit/_cdf_tk/client/api/data_products.py 92% 🟢
cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py 94% 🟢
cognite_toolkit/_cdf_tk/client/testing.py 100% 🟢
cognite_toolkit/_cdf_tk/cruds/init.py 78% 🟢
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/init.py 100% 🟢
cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_product.py 91% 🟢
cognite_toolkit/_cdf_tk/resource_classes/init.py 100% 🟢
TOTAL 94% 🟢

updated for commit: 027073c by action🐍

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 62.09677% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.57%. Comparing base (5eb7c88) to head (027073c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...oolkit/_cdf_tk/client/api/data_product_versions.py 26.38% 53 Missing ⚠️
...tk/client/resource_classes/data_product_version.py 61.29% 24 Missing ⚠️
...f_tk/cruds/_resource_cruds/data_product_version.py 80.55% 14 Missing ⚠️
...kit/_cdf_tk/client/resource_classes/identifiers.py 83.33% 1 Missing ⚠️
cognite_toolkit/_cdf_tk/cruds/__init__.py 0.00% 1 Missing ⚠️
...t/_cdf_tk/resource_classes/data_product_version.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2536      +/-   ##
==========================================
- Coverage   85.79%   85.57%   -0.22%     
==========================================
  Files         414      418       +4     
  Lines       34483    34755     +272     
==========================================
+ Hits        29583    29740     +157     
- Misses       4900     5015     +115     
Files with missing lines Coverage Δ
...ognite_toolkit/_cdf_tk/client/api/data_products.py 91.66% <100.00%> (+0.49%) ⬆️
cognite_toolkit/_cdf_tk/client/testing.py 100.00% <100.00%> (ø)
..._toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py 100.00% <100.00%> (ø)
...lkit/_cdf_tk/cruds/_resource_cruds/data_product.py 90.90% <ø> (ø)
...gnite_toolkit/_cdf_tk/resource_classes/__init__.py 100.00% <100.00%> (ø)
...kit/_cdf_tk/client/resource_classes/identifiers.py 94.38% <83.33%> (-0.80%) ⬇️
cognite_toolkit/_cdf_tk/cruds/__init__.py 77.96% <0.00%> (-1.35%) ⬇️
...t/_cdf_tk/resource_classes/data_product_version.py 96.42% <96.42%> (ø)
...f_tk/cruds/_resource_cruds/data_product_version.py 80.55% <80.55%> (ø)
...tk/client/resource_classes/data_product_version.py 61.29% <61.29%> (ø)
... and 1 more

... and 5 files with indirect coverage changes

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

… versioning

The API now uses a user-specified semantic version string (major.minor.patch)
instead of a server-assigned integer versionId. This simplifies the identifier
to (dataProductExternalId, version) and removes the need for reverse-lookups
in the CRUD layer. Extracts a reusable SemanticVersion annotated type.
@ronpal ronpal marked this pull request as ready for review February 18, 2026 13:44
@ronpal ronpal requested review from a team as code owners February 18, 2026 13:44
@ronpal ronpal marked this pull request as draft February 18, 2026 13:44
@ronpal ronpal marked this pull request as ready for review February 18, 2026 13:45
@ronpal ronpal enabled auto-merge (squash) February 18, 2026 13:49
Copy link
Collaborator

@doctrino doctrino left a comment

Choose a reason for hiding this comment

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

In addition to the comments:

container_fields: ClassVar[frozenset[str]] = frozenset()

def as_update(self, mode: Literal["patch", "replace"]) -> dict[str, Any]:
raise NotImplementedError("Data product version updates use a custom format via the CRUD layer.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not use the builint as update implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to overload it because of the nested {"modify": {...}} pattern for terms and dataModel.views

@doctrino doctrino disabled auto-merge February 19, 2026 07:15
doctrino
doctrino previously approved these changes Feb 19, 2026
Copy link
Collaborator

@doctrino doctrino left a comment

Choose a reason for hiding this comment

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

Two optional comments.

Comment on lines 49 to 51
def _resolve(
self, method: APIMethod, **kwargs: str
) -> tuple[Literal["GET", "POST", "PUT", "PATCH", "DELETE"], str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is my personal opinion, feel free to ignore it if you disagree.

I think this method just obfuscate what is going on where it is used. Especially kwargs is very tricy to understand. I would just do this manually everywhere it is used. Or at least change kwargs with external_id and optionally version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, I had my doubts too. Fixed.

Comment on lines +57 to +58
# The versions update API uses nested {set}/{setNull}/{modify} operators
# instead of a flat body, so we must build the payload manually.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is something we can give feeback on to the API team. This update is deviating significantly from other updates with very nested structure. For example, HostedExtractros have a similar issue and solves it in a more standardized way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feedback given!

Co-authored-by: Anders Albert <60234212+doctrino@users.noreply.github.com>
ronpal and others added 3 commits February 19, 2026 08:41
@ronpal ronpal merged commit 1daf16f into main Feb 19, 2026
15 checks passed
@ronpal ronpal deleted the cdf-27106/add-data-product-versions branch February 19, 2026 08:11
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

Comments