[CDF-27582] 🚨Check instance space existence. #2799
Conversation
Using Gemini Code AssistThe 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
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 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a validation step in the stream_data method to ensure that instance spaces exist in CDF before migration begins. Feedback identifies a potential runtime error due to SpaceId potentially lacking a hash implementation for set operations and points out an inefficient duplicate API call that could be optimized by passing the retrieved space source to downstream methods.
| else: | ||
| raise ToolkitNotImplementedError(f"Selector {type(selector)} is not supported for stream_data") | ||
| existing = self.client.tool.spaces.retrieve(instance_spaces) | ||
| if missing := set(instance_spaces).difference({item.as_id() for item in existing}): |
There was a problem hiding this comment.
This line, and line 94 (list({SpaceId(...)})), rely on SpaceId being hashable to be used in a set. However, the SpaceId class does not appear to have a __hash__ method defined, unlike other similar identifier classes in the project (e.g., ViewNoVersionId). This could lead to a TypeError at runtime if SpaceId is not hashable by default in your Pydantic configuration. Please verify that SpaceId is hashable. If not, you should implement __hash__ on it.
There was a problem hiding this comment.
It is frozen and thus hashable.
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2799 +/- ##
==========================================
- Coverage 84.57% 84.56% -0.01%
==========================================
Files 447 447
Lines 39552 39560 +8
==========================================
+ Hits 33450 33453 +3
- Misses 6102 6107 +5
🚀 New features to boost your workflow:
|
Description
Please describe the change you have made.
Bump
Changelog
Improved
cdf migrate assets/events/files/timeseries/annotations, Toolkit will now check that the target instance space(s) exist before starting.