fix(core): refactor ListAttributesValues to use Get#769
Conversation
Summary of ChangesHello, 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 focuses on maintaining the relevance of the test suite by removing an end-to-end test case. Specifically, the Highlights
🧠 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. Changelog
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. 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
|
There was a problem hiding this comment.
Code Review
This pull request removes an end-to-end test for the policy attributes values list command, stating that the underlying RPC is being deprecated. However, the command's implementation, documentation, and even its 'bad path' test case remain in the codebase. Removing tests for existing functionality is a concern as it leaves the code untested and can lead to maintenance issues. For a clean deprecation, all parts of the feature—including its implementation, documentation, and all related tests—should be removed together. I've added a comment with a suggestion to either restore the test or proceed with a complete removal of the feature.
I am having trouble creating individual review comments. Click here to see my feedback.
e2e/attributes.bats (435-496)
You've removed the 'good path' test for values list, but the 'bad path' test, the command implementation, and its documentation remain. Removing tests for a feature that still exists in the codebase is risky as it leaves the feature untested. If the values list command is being deprecated, it would be better to remove all related code, including all tests and documentation, in a single pull request. If the feature is not being removed at this time, this test should be kept to ensure continued correctness.
jakedoublev
left a comment
There was a problem hiding this comment.
As discussed, e2e test should still pass with underlying API called by subcommand changed.
This reverts commit 959df0c.
policy attributes values list to use get internally
policy attributes values list to use get internallyListAttributesValues to use Get internally
ListAttributesValues to use Get internallyListAttributesValues to use Get
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors ListAttributesValues to fetch all attribute values from an attribute and then perform client-side filtering and pagination. While functional, this change introduces a potential runtime panic in the paginateValues function due to a lack of validation for negative offset values, which could be exploited to crash the CLI tool. It is recommended to add a check to ensure the offset is non-negative. Furthermore, fetching all data at once can lead to high network traffic and memory usage on the client, especially for attributes with many values, and there's an opportunity to reduce code duplication in the new filtering logic for better maintainability.
There was a problem hiding this comment.
Pull request overview
This PR refactors policy attributes values list to avoid a dedicated ListAttributeValues SDK call and instead retrieves values via the existing GetAttribute call. Client-side filtering by state and client-side pagination are introduced to replicate the server-side behavior previously delegated to the ListAttributeValues API endpoint. The protocol/go dependency is also bumped from v0.16.0 to v0.17.0.
Changes:
pkg/handlers/attributeValues.go:ListAttributeValuesnow callsGetAttributeand returnsattr.GetValues()instead of calling the dedicated list API with pagination/state params.cmd/policy/attributeValues.go: AddsfilterValuesByStateandpaginateValueshelper functions to replicate server-side filtering/pagination logic locally; thelistAttributeValuecommand now uses these to produce equivalent output.go.mod/go.sum: Bumpsgithub.com/opentdf/platform/protocol/gofrom v0.16.0 to v0.17.0.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pkg/handlers/attributeValues.go |
Replaces sdk.Attributes.ListAttributeValues call with a GetAttribute + GetValues approach |
cmd/policy/attributeValues.go |
Adds filterValuesByState and paginateValues helpers; wires them into listAttributeValue; constructs ListAttributeValuesResponse for JSON output |
go.mod |
Bumps protocol/go dependency to v0.17.0 |
go.sum |
Updates checksums for new protocol/go version |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-31) ### Features * **core:** Add optional namespace flag for subject mappings and condtion sets ([#779](#779)) ([9e849c4](9e849c4)) * **core:** add scope support for client creds ([#752](#752)) ([9ca9e43](9ca9e43)) * **core:** migrate registered resources ([#772](#772)) ([2b49a7d](2b49a7d)) * **core:** optional namespace in actions commands and re-enable actions/RR tests ([#775](#775)) ([29a2eb1](29a2eb1)) * **core:** support namespaced registered resources ([#767](#767)) ([4d786b5](4d786b5)) ### Bug Fixes * **ci:** Temporarily skip namespaced-actions impacted BATS cases ([#773](#773)) ([633728a](633728a)) * **core:** bump toolchain to go 1.24.13 ([#747](#747)) ([6804b93](6804b93)) * **core:** disable RR E2E tests ([#768](#768)) ([0821b8c](0821b8c)) * **core:** make namespacing registered resources optional ([#785](#785)) ([8e6eb31](8e6eb31)) * **core:** refactor `ListAttributesValues` to use `Get` ([#769](#769)) ([a82f7b7](a82f7b7)) * **core:** unsafe update result output values order ([#759](#759)) ([baeba0f](baeba0f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
This PR refactors
policy attributes values listto usegetinternally.