fix(sdk): AttributeValueExists returns false instead of error for non-existent values#3195
Conversation
…-existent values GetAttributeValuesByFqns returns a CodeNotFound error when the FQN does not exist. AttributeValueExists now catches this and returns (false, nil), matching the documented behavior and the pattern already used by AttributeExists. Fixes #3191 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
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 addresses a bug in the SDK's 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. 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. Value not found, No error, just a false reply, Code now works right. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where AttributeValueExists would propagate a CodeNotFound error instead of returning (false, nil). The change correctly handles this error case, aligning the function's behavior with its documentation and making it consistent with the AttributeExists function. A new test case, TestAttributeValueExists_NotFoundError, has been added to cover this scenario. The changes are correct and well-tested.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
🤖 I have created a release *beep* *boop* --- ## [0.15.0](sdk/v0.14.0...sdk/v0.15.0) (2026-03-23) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/protocol/go from 0.16.0 to 0.20.0 in /sdk ([#3179](#3179)) ([30bb0a8](30bb0a8)) * **sdk:** AttributeValueExists returns false instead of error for non-existent values ([#3195](#3195)) ([4e46091](4e46091)) --- 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>
Summary
AttributeValueExistsnow catchesCodeNotFounderrors fromGetAttributeValuesByFqnsand returns(false, nil)instead of propagating the errorAttributeExists(which already handlesCodeNotFoundcorrectly)TestAttributeValueExists_NotFoundErrorcovering this caseTest plan
go test -run TestAttributeValueExists -v— all 6 tests passgolangci-lint run ./...— no new issuesFixes #3191
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests