Skip to content

TIPCommon: list custom fields pagination#661

Open
timere-nemo wants to merge 10 commits intomainfrom
list_custom_fields_pagination
Open

TIPCommon: list custom fields pagination#661
timere-nemo wants to merge 10 commits intomainfrom
list_custom_fields_pagination

Conversation

@timere-nemo
Copy link
Copy Markdown
Contributor

@timere-nemo timere-nemo commented Apr 2, 2026

Title (Please follow the convention below)

The function fails to account for pagination, resulting in incomplete data when there are many custom fields. These changes add pagination, so the function now retrieves all the data.

https://buganizer.corp.google.com/issues/496121635


Checklist:

Please ensure you have completed the following items before submitting your PR.
This helps us review your contribution faster and more efficiently.

General Checks:

  • I have read and followed the project's contributing.md guide.
  • My code follows the project's coding style guidelines.
  • I have performed a self-review of my own code.
  • My changes do not introduce any new warnings.
  • My changes pass all existing tests.
  • I have added new tests where appropriate to cover my changes. (If applicable)
  • I have updated the documentation where necessary (e.g., README, API docs). (If applicable)

Open-Source Specific Checks:

  • My changes do not introduce any Personally Identifiable Information (PII) or sensitive customer data.
  • My changes do not expose any internal-only code examples, configurations, or URLs.
  • All code examples, comments, and messages are generic and suitable for a public repository.
  • I understand that any internal context or sensitive details related to this work are handled separately in internal systems (Buganizer for Google team members).

For Google Team Members and Reviewers Only:

  • I have included the Buganizer ID in the PR title or description (e.g., "Internal Buganizer ID: 123456789" or "Related Buganizer: go/buganizer/123456789").
  • I have ensured that all internal discussions and PII related to this work remain in Buganizer.
  • I have tagged the PR with one or more labels that reflect the pull request purpose.

Note

Medium Risk
Updates list_custom_fields to iterate through paginated SOAR API responses, which could change runtime characteristics and error behavior for callers that previously received only the first page.

Overview
Fixes incomplete results from TIPCommon.rest.soar_api.list_custom_fields by adding pagination support: it now loops over nextPageToken, accumulates all customFields, and handles JSON decode errors differently once partial data has been collected.

Bumps TIPCommon and integration-testing package versions to 2.3.6 and updates the integration test harness to consume the new TIPCommon wheel in pyproject.toml/uv.lock.

Reviewed by Cursor Bugbot for commit 6e0354a. Bugbot is set up for automated code reviews on this repo. Configure here.

@timere-nemo timere-nemo self-assigned this Apr 2, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 an issue where the custom fields retrieval function was limited by the lack of pagination support. By implementing a loop that processes pages using tokens and total size checks, the function now correctly aggregates all available data. Additionally, the package version has been updated to reflect these changes.

Highlights

  • Pagination Implementation: Updated the list_custom_fields function to handle pagination, ensuring all custom fields are retrieved even when the result set exceeds the default page size.
  • Version Bump: Incremented the package version from 2.3.5 to 2.3.6 in pyproject.toml and uv.lock.

🧠 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.

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
Copy Markdown
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 updates TIPCommon to version 2.3.6 and implements pagination in the list_custom_fields function using nextPageToken. Review feedback suggests a minor version bump for this new feature according to Semantic Versioning. Technical improvements were identified regarding error handling to avoid silent partial data returns, defensive handling of potential null values in the API response, and the use of generator expressions for better memory efficiency.

Comment thread packages/tipcommon/TIPCommon/pyproject.toml
Comment thread packages/tipcommon/TIPCommon/src/TIPCommon/rest/soar_api.py Outdated
Comment thread packages/tipcommon/TIPCommon/src/TIPCommon/rest/soar_api.py Outdated
timere-nemo and others added 3 commits April 2, 2026 23:57
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Roman Yermilov <88602723+timere-nemo@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Roman Yermilov <88602723+timere-nemo@users.noreply.github.com>
@timere-nemo timere-nemo marked this pull request as ready for review April 2, 2026 21:58
@timere-nemo timere-nemo requested a review from a team as a code owner April 2, 2026 21:58
Comment thread packages/integration_testing/pyproject.toml Outdated
Comment thread packages/tipcommon/TIPCommon/src/TIPCommon/rest/soar_api.py
Copy link
Copy Markdown
Contributor

@KrishnaSharma06 KrishnaSharma06 left a comment

Choose a reason for hiding this comment

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

Aren't we updating the TIPCommon in Tools integration?

@timere-nemo
Copy link
Copy Markdown
Contributor Author

Aren't we updating the TIPCommon in Tools integration?

This fix applies to all Siemplify integration actions that interact with Custom Fields. When the total number of custom fields exceeds the page size, a KeyError may occur if we attempt to update a field that is not included in the initial page. For example, if there are seven custom fields but the page size is five, the endpoint returns only the latest five fields (ids 3..7). Attempting to update fields with ids 1 or 2 results in a KeyError. This critical fix ensures that all pages are fetched to prevent such errors

https://buganizer.corp.google.com/issues/496121635

@timere-nemo timere-nemo requested a review from iddoarie1 April 14, 2026 13:04
try:
validate_response(response, validate_json=True)
except InternalJSONDecoderError:
if not custom_fields:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is inconsistency in before and after custom field is filled with values (and for sure in the first loop iteration). should there be such inconsistency?

Copy link
Copy Markdown
Contributor

@iddoarie1 iddoarie1 left a comment

Choose a reason for hiding this comment

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

Overall PR looks good, just address my comment on the in soar_api.py

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.

3 participants