Skip to content

fix(docs): DSPX-2409 replace SDK README code example with working code#3055

Open
marythought wants to merge 3 commits intomainfrom
fix/dspx-2409
Open

fix(docs): DSPX-2409 replace SDK README code example with working code#3055
marythought wants to merge 3 commits intomainfrom
fix/dspx-2409

Conversation

@marythought
Copy link
Contributor

@marythought marythought commented Feb 6, 2026

Proposed Changes

Fixed Issues

  • Removed incorrect mtls import reference - The README referenced a non-existent mtls.NewGRPCAuthorizer(creds) function
  • Fixed API method calls - Changed NewTDFReader() to LoadTDF() and corrected CreateTDF() parameters
  • Fixed incomplete imports - Added all necessary imports that were missing

Improvements to Example Code

  • Made example fully functional - All variables are now properly defined with realistic localhost values
  • Added comprehensive comments - Explains what each section does, including the authorization/entitlement flow
  • Used quickstart attribute - Changed to https://opentdf.io/attr/department/value/finance which is created in the quickstart guide
  • Added HTTP support - Included sdk.WithInsecurePlaintextConn() for local development

Documentation Enhancements

  • Added link to SDK Quickstart Guide at the top of the README
  • Changed header from "Quick Start" to "Example code" to differentiate from supported SDK quickstart
  • Added Configuration Values table - Shows exactly which values need to be replaced and their defaults
  • Added Prerequisites section - Clear steps needed before running the example
  • Added Expected Output - Shows what users should see when they run the code
  • Added hosted version option - Notes that users can use a hosted platform instead of local quickstart

Developer Experience

  • Verified example compiles - Tested that the code builds without errors
  • Made copy-paste ready - All placeholder values are clearly marked and documented
  • Aligned with quickstart guide - Uses same ports and configuration as the official quickstart

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
@marythought marythought requested review from a team as code owners February 6, 2026 23:54
@github-actions github-actions bot added the comp:sdk A software development kit, including library, for client applications and inter-service communicati label Feb 6, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @marythought, 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 significantly enhances the sdk/README.md by revamping the Go SDK code example. The primary goal is to provide a fully functional, accurate, and user-friendly demonstration of TDF creation and decryption, addressing previous inaccuracies and improving the overall developer experience. The changes include correcting API usage, adding comprehensive documentation, and ensuring the example is ready for immediate use with local OpenTDF quickstart environments.

Highlights

  • Code Example Correction: Replaced a non-existent mtls import, fixed CreateTDF parameters and NewTDFReader to LoadTDF calls, and added all necessary imports to ensure the Go SDK example is functional.
  • Enhanced Example Functionality: The example now uses realistic localhost values, includes comprehensive comments, utilizes a quickstart attribute, and supports HTTP for local development, making it fully operational and easy to understand.
  • Improved Documentation: Added a link to the SDK Quickstart Guide, renamed the section header to "Example code," and included detailed tables for configuration values, prerequisites, and expected output, alongside an option for hosted platforms.
  • Developer Experience Focus: The updated example is verified to compile, designed to be copy-paste ready with clear placeholders, and aligns with the official quickstart guide's ports and configurations.

🧠 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
  • sdk/README.md
    • Added a prominent link to the OpenTDF SDK Quickstart Guide at the top.
    • Renamed the "Quick Start" section to "Example code" to better reflect its content.
    • Replaced the previous non-functional Go code snippet with a complete, working example demonstrating TDF creation and decryption.
    • Corrected SDK initialization, CreateTDF parameters (now takes a pointer to bytes.Buffer), and changed NewTDFReader to LoadTDF.
    • Ensured all necessary Go imports are present and added error handling with log.Fatalf.
    • Introduced placeholder configuration values for platformEndpoint, clientID, clientSecret, keycloakURL, and dataAttribute, aligning with a local quickstart setup.
    • Added sdk.WithInsecurePlaintextConn() for local HTTP development.
    • Included detailed sections for "Configuration Values," "Prerequisites," and "Expected Output" to guide users.
    • Expanded on "Authentication Options" by providing code snippets for Client Credentials, TLS/mTLS, Custom OAuth2 Token Source, and Token Exchange.
Activity
  • The author, marythought, has outlined a comprehensive set of proposed changes covering bug fixes, example code improvements, documentation enhancements, and developer experience considerations.
  • The checklist for unit tests, integration tests, and documentation updates remains unchecked, indicating these aspects are either pending or not applicable to this specific change.
  • No specific testing instructions were provided beyond the general expectation that the example compiles and is copy-paste ready.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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


Code once broken, now made new, Docs updated, clear and true. SDK shines, a guiding light, For TDF, day and night.

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.

@github-actions github-actions bot added the size/m label Feb 6, 2026
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 significantly improves the SDK's README by replacing a broken code example with a fully functional and well-documented one. The new example is much clearer, follows best practices, and is aligned with the quickstart guide. The addition of prerequisites, configuration details, and expected output makes it much easier for new users to get started. I have one minor suggestion to improve the clarity of an authentication snippet.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 183.341077ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.044963ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 368.842703ms
Throughput 271.12 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.384806951s
Average Latency 392.010373ms
Throughput 126.95 requests/second

Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 193.931599ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 104.585103ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 359.101718ms
Throughput 278.47 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 40.270902692s
Average Latency 401.147421ms
Throughput 124.16 requests/second

Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 193.424887ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 102.345505ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 369.074502ms
Throughput 270.95 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 38.94492211s
Average Latency 387.650003ms
Throughput 128.39 requests/second

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 194.609108ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 105.719332ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 384.763832ms
Throughput 259.90 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.911035363s
Average Latency 396.998721ms
Throughput 125.28 requests/second

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:sdk A software development kit, including library, for client applications and inter-service communicati size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant