Skip to content

fix: migrate transaction docs and examples to transactions() API - #373

Merged
curfew-marathon merged 2 commits into
mainfrom
fix/migrate-disable-transactions-docs-examples
Aug 2, 2026
Merged

fix: migrate transaction docs and examples to transactions() API#373
curfew-marathon merged 2 commits into
mainfrom
fix/migrate-disable-transactions-docs-examples

Conversation

@curfew-marathon

@curfew-marathon curfew-marathon commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves the write transaction docs and examples off the double-negative disableTransactions(boolean) to the affirmative transactions(boolean) / isTransactionsEnabled() API added in #352. Both APIs coexist today; this stops the SDK's own docs, examples, and internal code from teaching or using the method slated for deprecation.

Changes

  • OpenFgaClient.java: the write mode-selection Javadoc (both overloads) now describes behavior via isTransactionsEnabled() instead of disableTransactions().
  • OpenFgaClient.java: the internal write-mode branch changed from options.disableTransactions() to !options.isTransactionsEnabled(), so the SDK no longer calls its own soon-to-be-deprecated method.
  • Example projects switched from .disableTransactions(true) to .transactions(false): examples/basic-examples (Java and Kotlin) and src/test-integration.

Behavior is unchanged. transactions(false) is exactly equivalent to the prior disableTransactions(true), and !isTransactionsEnabled() equals the prior disableTransactions().

Out of scope

Verification

Changes verified by inspection: transactions(boolean) and isTransactionsEnabled() exist on ClientWriteOptions, and the logic is a direct equivalence swap. A local compile could not run here because dependency resolution against the private Artifactory mirror returns 401; CI performs the authoritative compile and test.

Why now

Step 1 of retiring disableTransactions. Review on #352 flagged that the SDK's own docs and examples still teach the double-negative method. The old methods cannot be deprecated until the docs and examples stop teaching them, and the deprecation stays blocked until this change ships in a release.

Closes #368

Summary by CodeRabbit

  • Updates
    • Updated tuple write configuration examples to use the clearer transactions(false) option.
    • Write operations now consistently honor the configured transaction mode.
    • Non-transactional writes continue processing in chunks when transactions are disabled.
    • Updated accompanying API documentation and examples to reflect the current configuration approach.

Move the write mode-selection Javadoc in OpenFgaClient and the example
projects off the double-negative disableTransactions(boolean) to the
affirmative transactions()/isTransactionsEnabled() API. Also switch the
internal write mode branch to !isTransactionsEnabled() so the SDK no longer
calls its own soon-to-be-deprecated method. Behavior is unchanged.

Test call sites that still use disableTransactions are intentionally left
for the deprecation issue, which will migrate them and keep one back-compat
test under @SuppressWarnings.

Refs #368
@curfew-marathon
curfew-marathon requested a review from a team as a code owner August 2, 2026 15:30
Copilot AI review requested due to automatic review settings August 2, 2026 15:30
@dosubot

dosubot Bot commented Aug 2, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about java-sdk Add Dosu to your team

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d7634de-2aeb-46d1-9467-b29b496b7d53

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The write path now uses isTransactionsEnabled() for mode selection. Java and Kotlin examples use transactions(false) instead of disableTransactions(true). Javadocs describe both write modes with the affirmative API.

Changes

Transaction API migration

Layer / File(s) Summary
Client write-mode selection
src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java
Javadocs and write branching now use isTransactionsEnabled() to select transactional or non-transactional processing.
Example write configuration
examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java, examples/basic-examples/src/main/kotlin/dev/openfga/sdk/example/KotlinExample1.kt, src/test-integration/java/dev/openfga/sdk/example/Example1.java
The examples now use transactions(false) for non-transactional tuple writes.

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

Possibly related issues

  • openfga/java-sdk issue 371 — Covers the same migration from disableTransactions to transactions and isTransactionsEnabled.
  • openfga/java-sdk issue 369 — Tracks migration of transaction option usage to the affirmative API.
  • openfga/java-sdk issue 370 — Tracks replacing disableTransactions in client logic.

Possibly related PRs

  • openfga/java-sdk#352 — Introduced the transactions(boolean) and isTransactionsEnabled() APIs used by this change.

Suggested reviewers: rhamzeh, copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the migration of transaction documentation and examples to the transactions() API.
Linked Issues check ✅ Passed The changes satisfy issue #368 by updating the specified Javadocs, three examples, and internal mode selection while preserving behavior.
Out of Scope Changes check ✅ Passed The changes remain within scope and do not modify generated README content, test call sites, or deprecation annotations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/migrate-disable-transactions-docs-examples

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.

@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.69%. Comparing base (ed63320) to head (986a554).

❌ Your project status has failed because the head coverage (38.69%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #373   +/-   ##
=========================================
  Coverage     38.69%   38.69%           
+ Complexity     1290     1289    -1     
=========================================
  Files           198      198           
  Lines          7707     7707           
  Branches        900      900           
=========================================
  Hits           2982     2982           
  Misses         4579     4579           
  Partials        146      146           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the SDK’s write transaction documentation, examples, and internal branching logic to use the affirmative transactions(boolean) / isTransactionsEnabled() API (introduced in #352) instead of the double-negative disableTransactions(...) methods that are slated for deprecation.

Changes:

  • Updated OpenFgaClient.write(...) Javadoc to describe transactional/non-transactional behavior in terms of isTransactionsEnabled().
  • Switched the internal mode-selection branch from options.disableTransactions() to !options.isTransactionsEnabled().
  • Migrated example call sites from .disableTransactions(true) to .transactions(false).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java Updates write-mode docs and internal mode-selection to use isTransactionsEnabled() rather than disableTransactions().
examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java Updates the Java basic example to use .transactions(false) instead of .disableTransactions(true).
examples/basic-examples/src/main/kotlin/dev/openfga/sdk/example/KotlinExample1.kt Updates the Kotlin basic example to use .transactions(false) instead of .disableTransactions(true).
src/test-integration/java/dev/openfga/sdk/example/Example1.java Updates the integration example to use .transactions(false) instead of .disableTransactions(true).
Suppressed comments (1)

src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java:469

  • The code treats a null ClientWriteOptions as the default (transactions enabled), but the Javadoc wording implies callers always have a non-null options instance. Consider documenting the actual condition to avoid confusion and accidental null dereferences in user code examples.
     * <h3>Transactional Mode (default)</h3>
     * <p>When {@code options.isTransactionsEnabled()} is true (the default):</p>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java Outdated
Address review feedback. The write(request) overload takes no options, so
describing the mode as options.isTransactionsEnabled() implied a call on an
absent or null options reference. Reword both overloads to key the mode off
the transactions() setter and state that transactional mode is the default
when no options are passed.

Docs only, no behavior change.

Refs #368
@curfew-marathon
curfew-marathon added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit 70cfa19 Aug 2, 2026
28 checks passed
@curfew-marathon
curfew-marathon deleted the fix/migrate-disable-transactions-docs-examples branch August 2, 2026 22:20
@openfga-releaser-bot openfga-releaser-bot Bot mentioned this pull request Aug 4, 2026
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 of 5) Migrate transaction docs and examples off disableTransactions to transactions()/isTransactionsEnabled()

4 participants