-
Notifications
You must be signed in to change notification settings - Fork 24
feat(sdk): Call init if obligations are empty. #2825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @c-r33d, 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 enhances the SDK's handling of TDF and NanoTDF obligations by introducing a more resilient mechanism for their retrieval. Instead of failing when obligations are not pre-populated, the system will now proactively attempt to initialize them via an Highlights
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. Obligations wait, Init called, a new rewrap, Data flows freely. Footnotes
|
There was a problem hiding this 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 enhances the SDK by modifying the Obligations method in both TDFReader and NanoTDFReader. The method now automatically calls Init() to fetch obligations if they aren't already populated, which improves the developer experience. The implementation correctly handles cases where Init() might fail but still return the necessary obligations, for instance, during a rewrap failure. The accompanying test updates are thorough and validate the new behavior. My feedback consists of minor suggestions to improve comment clarity for better long-term maintainability.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Invalidated by push of 33881f8
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
🤖 I have created a release *beep* *boop* --- ## [0.10.0](sdk/v0.9.0...sdk/v0.10.0) (2025-10-21) ### Features * **policy:** Proto - root certificates by namespace ([#2800](#2800)) ([0edb359](0edb359)) * **policy:** Protos List obligation triggers ([#2803](#2803)) ([b32df81](b32df81)) * **sdk:** Add obligations support. ([#2759](#2759)) ([3cccfd2](3cccfd2)) * **sdk:** Call init if obligations are empty. ([#2825](#2825)) ([14191e4](14191e4)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/lib/ocrypto from 0.6.0 to 0.7.0 in /sdk ([#2810](#2810)) ([1c5cf5f](1c5cf5f)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.12.0 to 0.13.0 in /sdk ([#2813](#2813)) ([1643ed2](1643ed2)) * **sdk:** Fix the bug in ResourceLocator serialization logic ([#2791](#2791)) ([01329d6](01329d6)) --- 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>
Proposed Changes
1.) Call Init if obligations are empty, instead of throwing an error. Only return an error if we do not have any required obligations returned from the server. (Note: It's possible there is no error and no required obligations, which the code handles.)
2.) Rename return object type from
ObligationstoRequiredObligationsImportant
Since the goal of the
Obligations()functionis to return the required obligations on the TDF
do not return an error if we have greater than 0 obligation fqns.
This is to avoid confusion for downstream peps that just want to know
the required obligations for the TDF.
It's possible that we have a RewrapForbidden error because of obligations
in which we should not return that to the consumer of the SDK, just that
these are the required obligations.
Checklist
Testing Instructions