-
Notifications
You must be signed in to change notification settings - Fork 2
fix(sdk): add methods to examine Manifest and Policy #278
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
These capabilities were removed during a previous refactoring
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.
Summary of Changes
Hello @mkleene, 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 reintroduces and refines the SDK's ability to inspect TDF Manifest
and Policy
objects without requiring full decryption. It streamlines the internal API for manifest parsing by switching from Reader
inputs to direct String
inputs for JSON, and exposes these capabilities through new public methods in the SDK
class, enhancing the SDK's utility for TDF content analysis.
Highlights
- Reintroduced SDK capabilities: Public methods
SDK.readManifest
andSDK.decodePolicyObject
have been added to allow external examination of TDFManifest
andPolicy
objects, restoring functionality previously removed during a refactoring. Manifest.readManifest
signature change: The internalManifest.readManifest
method now directly accepts aString
containing the manifest JSON, simplifying its usage by removing the need forReader
objects.- Internal API alignment:
Manifest.readPolicyObject
has been renamed toManifest.decodePolicyObject
and now accepts aManifest
object directly, aligning with the new approach of decoding from an already parsed manifest. - Example and Tests: A new example (
GetManifestInformation.java
) demonstrates the usage of the new SDK methods, and comprehensive tests have been added/updated to ensure correctness and cover the new functionality.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
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 re-introduces methods to examine a TDF's manifest and policy, which were removed in a previous refactoring. It also refactors Manifest.readManifest
to accept a String
, which simplifies its usage. The changes are well-implemented and include a new example and tests. I've identified a couple of areas for improvement in the new example code regarding robustness and resource management, and some Javadoc enhancements for the new public API methods.
examples/src/main/java/io/opentdf/platform/GetManifestInformation.java
Outdated
Show resolved
Hide resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…add-back-tdf-info-methods
/gemini review |
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 reintroduces methods for examining TDF manifests and policies, a capability that was lost in a previous refactoring. The changes are well-structured, and I appreciate the simplification of Manifest.readManifest
to accept a String
, which cleans up the API. The new functionality is clearly exposed through the SDK
class and is supported by a new example and tests.
My review has identified a significant performance issue where the manifest is repeatedly read and parsed. I've also noted a minor issue in a test file concerning character encoding that could impact test portability. The feedback provided aims to address these points to improve the efficiency and robustness of the code.
…add-back-tdf-info-methods
|
These capabilities were removed during a previous refactoring
Also change
Manifest.readManfest
to take in aString
since that's theonly way it's ever used.