Skip to content

feat(cli): add an sdkfactory for optional override in otdfctl for extension - #3793

Merged
elizabethhealy merged 3 commits into
mainfrom
add-sdk-factory-to-otdfctl
Jul 30, 2026
Merged

feat(cli): add an sdkfactory for optional override in otdfctl for extension#3793
elizabethhealy merged 3 commits into
mainfrom
add-sdk-factory-to-otdfctl

Conversation

@elizabethhealy

@elizabethhealy elizabethhealy commented Jul 28, 2026

Copy link
Copy Markdown
Member

Proposed Changes

  • This allows us to add default options, switch out the sdk used, etc downstream

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

Summary by CodeRabbit

  • New Features

    • Added support for customizing how SDK connections are created.
    • Added both handler-specific and application-wide SDK factory configuration.
    • Added the ability to reset custom SDK factory settings to the default behavior.
  • Tests

    • Added coverage for default factory fallback, handler-level overrides, and global factory reset behavior.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@elizabethhealy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d5b357b0-7f0f-466b-aad8-a0b073b70585

📥 Commits

Reviewing files that changed from the base of the PR and between 7c571ba and c015d48.

📒 Files selected for processing (2)
  • otdfctl/pkg/handlers/sdk.go
  • otdfctl/pkg/handlers/sdk_test.go
📝 Walkthrough

Walkthrough

Changes

SDK factory injection

Layer / File(s) Summary
Factory contract and resolution
otdfctl/pkg/handlers/sdk.go, otdfctl/pkg/handlers/sdk_test.go
Adds configurable SDK factories, per-handler precedence, default reset behavior, and resolution tests.
Handler construction integration
otdfctl/pkg/handlers/sdk.go
Updates handler construction to create SDK clients through the resolved factory.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HandlerOptions
  participant SDKFactory
  participant SDK
  HandlerOptions->>HandlerOptions: Resolve per-handler or default factory
  HandlerOptions->>SDKFactory: Pass endpoint and SDK options
  SDKFactory->>SDK: Construct SDK
Loading

Possibly related PRs

  • opentdf/platform#3755: Both changes modify the SDK construction pipeline in otdfctl/pkg/handlers/sdk.go.

Suggested reviewers: jrschumacher

Poem

A rabbit hops through factory gates,
Choosing defaults or custom states.
The handler sends the SDK its way,
Tests keep the paths in play.
“Hop-hop!” says Bunny, “clean today!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title captures the main change: adding an SDK factory override mechanism in otdfctl.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-sdk-factory-to-otdfctl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 420.682218ms
Throughput 237.71 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 48.387225283s
Average Latency 481.716909ms
Throughput 103.33 requests/second

@elizabethhealy
elizabethhealy marked this pull request as ready for review July 29, 2026 15:11
@elizabethhealy
elizabethhealy requested a review from a team as a code owner July 29, 2026 15:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@otdfctl/pkg/handlers/sdk_test.go`:
- Around line 165-168: Extend TestResolveSDKFactory_FallsBackToDefault coverage
to exercise handlerOpts.New directly: configure a factory override, construct
the handler with a non-normalized endpoint, and verify the override receives the
normalized endpoint and that the SDK it returns is stored on the resulting
handler. Keep the existing fallback assertion, but ensure the new test validates
New uses resolveSDKFactory rather than merely returning a non-nil factory.

In `@otdfctl/pkg/handlers/sdk.go`:
- Around line 227-230: Update the SDK factory handling in New so it rejects a
nil SDK even when resolveSDKFactory returns no error. Return an appropriate
error before constructing the Handler, while preserving propagation of non-nil
factory errors; add the required errors import and coverage for the (nil, nil)
result.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f2a1eaf7-648a-4058-93d8-8ace055006a9

📥 Commits

Reviewing files that changed from the base of the PR and between aecd265 and 7c571ba.

📒 Files selected for processing (2)
  • otdfctl/pkg/handlers/sdk.go
  • otdfctl/pkg/handlers/sdk_test.go

Comment thread otdfctl/pkg/handlers/sdk_test.go
Comment thread otdfctl/pkg/handlers/sdk.go
@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 437.352362ms
Throughput 228.65 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 53.539908741s
Average Latency 534.291445ms
Throughput 93.39 requests/second

@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 439.668642ms
Throughput 227.44 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 49.95319985s
Average Latency 497.877338ms
Throughput 100.09 requests/second

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

@elizabethhealy
elizabethhealy added this pull request to the merge queue Jul 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 30, 2026
@elizabethhealy
elizabethhealy added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit c2f2afe Jul 30, 2026
45 checks passed
@elizabethhealy
elizabethhealy deleted the add-sdk-factory-to-otdfctl branch July 30, 2026 16:54
khvirtru pushed a commit to khvirtru/platform that referenced this pull request Aug 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0)
(2026-08-04)


### ⚠ BREAKING CHANGES

* **policy:** GetPC does not respect manager field.
([opentdf#3752](opentdf#3752))

### Features

* **authz:** dynamic value mapping and direct entitlement e2e coverage
([opentdf#3774](opentdf#3774))
([49c80a0](opentdf@49c80a0))
* **cli:** add an sdkfactory for optional override in otdfctl for
extension ([opentdf#3793](opentdf#3793))
([c2f2afe](opentdf@c2f2afe))
* **cli:** add dynamic value mapping CRUD commands and e2e tests
([opentdf#3768](opentdf#3768))
([aecd265](opentdf@aecd265))
* **cli:** expose handler hook for injecting SDK options
([opentdf#3755](opentdf#3755))
([76305b0](opentdf@76305b0))
* **cli:** Unsafe update key cli
([opentdf#3733](opentdf#3733))
([65d888e](opentdf@65d888e))


### Bug Fixes

* **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to
0.39.0 in /otdfctl
([opentdf#3765](opentdf#3765))
([a3346f8](opentdf@a3346f8))
* **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0
in /otdfctl ([opentdf#3773](opentdf#3773))
([490c990](opentdf@490c990))
* **policy:** GetPC does not respect manager field.
([opentdf#3752](opentdf#3752))
([0d3c0a0](opentdf@0d3c0a0))

---
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>
Co-authored-by: Elizabeth Healy <35498075+elizabethhealy@users.noreply.github.com>
khvirtru pushed a commit to khvirtru/platform that referenced this pull request Aug 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0)
(2026-08-04)


### ⚠ BREAKING CHANGES

* **policy:** GetPC does not respect manager field.
([opentdf#3752](opentdf#3752))

### Features

* **authz:** dynamic value mapping and direct entitlement e2e coverage
([opentdf#3774](opentdf#3774))
([49c80a0](opentdf@49c80a0))
* **cli:** add an sdkfactory for optional override in otdfctl for
extension ([opentdf#3793](opentdf#3793))
([c2f2afe](opentdf@c2f2afe))
* **cli:** add dynamic value mapping CRUD commands and e2e tests
([opentdf#3768](opentdf#3768))
([aecd265](opentdf@aecd265))
* **cli:** expose handler hook for injecting SDK options
([opentdf#3755](opentdf#3755))
([76305b0](opentdf@76305b0))
* **cli:** Unsafe update key cli
([opentdf#3733](opentdf#3733))
([65d888e](opentdf@65d888e))


### Bug Fixes

* **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to
0.39.0 in /otdfctl
([opentdf#3765](opentdf#3765))
([a3346f8](opentdf@a3346f8))
* **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0
in /otdfctl ([opentdf#3773](opentdf#3773))
([490c990](opentdf@490c990))
* **policy:** GetPC does not respect manager field.
([opentdf#3752](opentdf#3752))
([0d3c0a0](opentdf@0d3c0a0))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants