Skip to content

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

Merged
merged 9 commits into from
Jul 21, 2025

Conversation

mkleene
Copy link
Contributor

@mkleene mkleene commented Jul 15, 2025

These capabilities were removed during a previous refactoring

Also change Manifest.readManfest to take in a String since that's the
only way it's ever used.

These capabilities were removed during a previous refactoring
@mkleene mkleene requested review from a team as code owners July 15, 2025 15:50
Copy link
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.

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 and SDK.decodePolicyObject have been added to allow external examination of TDF Manifest and Policy objects, restoring functionality previously removed during a refactoring.
  • Manifest.readManifest signature change: The internal Manifest.readManifest method now directly accepts a String containing the manifest JSON, simplifying its usage by removing the need for Reader objects.
  • Internal API alignment: Manifest.readPolicyObject has been renamed to Manifest.decodePolicyObject and now accepts a Manifest 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

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

mkleene and others added 5 commits July 15, 2025 17:56
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>
@mkleene
Copy link
Contributor Author

mkleene commented Jul 15, 2025

/gemini review

Copy link
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 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.

Copy link

@mkleene mkleene merged commit 03d5d41 into main Jul 21, 2025
10 checks passed
@mkleene mkleene deleted the add-back-tdf-info-methods branch July 21, 2025 18:38
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.

2 participants