Skip to content

Conversation

@arnav-cognite
Copy link

@arnav-cognite arnav-cognite commented Dec 18, 2025

Background

Adds SDK support for the Limits API to query and retrieve limit values from Cognite Data Fusion.

API Docs: https://api-docs.cognite.com/20230101-alpha/tag/Limits/

Limits service is in alpha phase, and the relevant details are present here

@gemini-code-assist
Copy link

Summary of Changes

Hello @arnav-cognite, 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 integrates the new 'Limits' service, currently in its alpha phase, into the Java SDK. It provides a dedicated client for interacting with the Limit Values API, enabling users to programmatically fetch and manage limit data from Cognite Data Fusion. The changes encompass the necessary client-side API exposure, data modeling, parsing logic, and robust integration tests to ensure functionality.

Highlights

  • New API Endpoint: Introduced a new limitValues() method in CogniteClient to expose the Cognite Limit Values API, which is currently in alpha phase.
  • LimitValues Class: Added a new LimitValues class providing methods to retrieve a specific limit value by ID and list all limit values with pagination and filtering capabilities. This class handles the cdf-version header required for the alpha API.
  • Data Transfer Object (DTO): Defined a new LimitValue Protocol Buffer DTO (limit_value.proto) to represent limit value objects, along with a corresponding LimitValueParser for JSON serialization/deserialization.
  • Resource Type: Extended the ResourceType enum with LIMIT_VALUE to categorize this new resource type within the SDK's configuration.
  • Integration Tests: Included comprehensive integration tests for the LimitValues API, covering listing, filtering, and retrieving limit values, and handling non-existent IDs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

Copy link

@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 introduces a Java SDK for the new limits-svc. The implementation is mostly good, with a new LimitValues client that correctly handles the alpha API requirements. However, there are a few issues to address. A new method in ConnectorServiceV1 is non-functional as it doesn't include the required API version header. The LimitValueParser has a critical bug that can lead to a StringIndexOutOfBoundsException. There are also some opportunities for improving efficiency and maintainability in the LimitValues client, such as removing misleading throws clauses, using constants instead of magic numbers, and optimizing JSON parsing.

@arnav-cognite
Copy link
Author

/gemini review

Copy link

@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 introduces a Java SDK for the new limits-svc. The changes are well-structured and include a new API client LimitValues, a Protobuf definition, a JSON parser, and integration tests, following the existing patterns of the SDK. My feedback focuses on two main areas: improving exception handling by replacing generic Exception with more specific ones for better error management, and enhancing performance and consistency by reusing a shared ObjectMapper instance. These changes will contribute to making the SDK more robust and efficient.

@arnav-cognite
Copy link
Author

/gemini review

Copy link

@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 introduces a Java SDK for the new limits-svc. The changes include a new LimitValues API client, a Protobuf DTO, a parser, and integration tests. The overall structure is consistent with the existing SDK. My review includes feedback on improving the API design by using more specific exceptions instead of the generic Exception, which will enhance error handling for clients. I've also included a suggestion to make one of the new integration tests more robust by avoiding a hardcoded value.

@arnav-cognite arnav-cognite marked this pull request as ready for review December 19, 2025 08:14
@arnav-cognite arnav-cognite requested a review from a team as a code owner December 19, 2025 08:14
@arnav-cognite arnav-cognite changed the title java sdk for limits-svc SDK Support for CDF Service metrics_marvels/limits Dec 19, 2025
@arnav-cognite arnav-cognite changed the title SDK Support for CDF Service metrics_marvels/limits MUT-1123 : SDK Support for CDF Service metrics_marvels/limits Jan 5, 2026
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