Skip to content

Conversation

@arthur-encord
Copy link
Contributor

Introduction and Explanation

trackHash is not anymore by the Encord platform. The ontology element uid and value of the Answer fully identifies the range.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @arthur-encord, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses the deprecation of the trackHash field within the Encord platform. Since the ontology element UID and the Answer's value are now sufficient for identifying ranges, trackHash is no longer necessary. The changes introduce a deprecation warning for its usage and remove its generation and assignment from the codebase, streamlining the Answer object's internal handling.

Highlights

  • Deprecation of trackHash parameter: The track_hash parameter in the Answer class constructor has been deprecated. Providing a value for this parameter will now trigger a DeprecationWarning.
  • Removal of short_uuid_str utility: The short_uuid_str utility function, previously used for generating track hashes, has been removed as it is no longer needed.
  • Hardcoding trackHash to an empty string: The trackHash field within the _get_encord_dynamic_fields method is now explicitly set to an empty string, reflecting its deprecation and disuse by the Encord platform.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

Unit test report (Python 3.9.24, Pydantic 2.12.3)

268 tests   268 ✅  8s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit b22b22c.

@github-actions
Copy link

Unit test report (Python 3.9.24, Pydantic 1.10.22)

268 tests   268 ✅  9s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit b22b22c.

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

This pull request aims to deprecate the trackHash attribute, as it's no longer used by the Encord platform. The changes involve removing the initialization and usage of _track_hash in the Answer class and replacing it with a hardcoded empty string in the serialized output. A deprecation warning is also added for the track_hash parameter in Answer.__init__.

My review found a significant issue with the implementation of the deprecation warning. It appears to be unreachable because the subclasses of Answer do not propagate the track_hash parameter to the superclass constructor. This makes the deprecation ineffective. I've left a detailed comment with a suggestion on how to fix this. Addressing this is important for the deprecation to work as intended.

Comment on lines +48 to +54
if track_hash is not None:
warnings.warn(
"The 'track_hash' parameter is deprecated and will be removed in a future release. "
"It is no longer used by the Encord platform.",
category=DeprecationWarning,
stacklevel=2,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This deprecation warning is currently unreachable. The Answer class is an abstract base class and cannot be instantiated directly. Its concrete subclasses (TextAnswer, RadioAnswer, etc.) define __init__ methods that do not accept a track_hash argument. Consequently, super().__init__ is always called with track_hash as None, and this warning is never triggered.

To make the deprecation warning functional, the __init__ methods of all Answer subclasses should be updated to accept and pass on the track_hash argument.

For example, for TextAnswer:

# In encord/objects/answers.py
class TextAnswer(Answer[str, TextAttribute]):
    def __init__(self, ontology_attribute: TextAttribute, track_hash: Optional[str] = None):
        super().__init__(ontology_attribute, track_hash=track_hash)
        self._value: Optional[str] = None

This change (and similar ones for RadioAnswer, ChecklistAnswer, and NumericAnswer) is needed to allow users to pass the track_hash parameter and receive the deprecation warning.

@github-actions
Copy link

SDK integration test report

285 tests  ±0   277 ✅ +1   15m 44s ⏱️ - 3m 6s
  1 suites ±0     4 💤 ±0 
  1 files   ±0     4 ❌ ±0 

For more details on these failures, see this check.

Results for commit b22b22c. ± Comparison against base commit a9c7401.

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