Skip to content

release(java-sdk): Release Java SDK v0.8.3 - #572

Merged
rhamzeh merged 2 commits into
mainfrom
release/java-v0.8.3
Jul 15, 2025
Merged

release(java-sdk): Release Java SDK v0.8.3#572
rhamzeh merged 2 commits into
mainfrom
release/java-v0.8.3

Conversation

@jimmyjames

@jimmyjames jimmyjames commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

References

Fixes synced back:
openfga/java-sdk#182
openfga/java-sdk#183

Release PR: openfga/java-sdk#184

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the connection timeout configuration in the Java client.
    • Improved error handling for batch check operations to ensure exceptions are properly captured and reported.
  • Tests

    • Added a new test to verify rate-limiting behavior and error handling for batch check requests.
  • Documentation

    • Updated the changelog to reflect the latest fixes and improvements in version 0.8.3.

@jimmyjames
jimmyjames requested a review from a team as a code owner July 15, 2025 20:56
@coderabbitai

coderabbitai Bot commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the Java client SDK to version 0.8.3, introducing fixes for connection timeout configuration and improved error handling in the batchCheck method. The updates include modifications to constructors for timeout propagation, enhanced error handling logic, a new test for rate limiting, and corresponding changelog and configuration updates.

Changes

File(s) Change Summary
config/clients/java/CHANGELOG.md.mustache Added changelog entry for version 0.8.3 with details of fixes and links to relevant pull requests.
config/clients/java/config.overrides.json Updated Java SDK package version from 0.8.2 to 0.8.3.
config/clients/java/template/libraries/native/api.mustache Modified OpenFgaApi constructor to set connection timeout from configuration on the HTTP client builder.
config/clients/java/template/src/main/api/auth/OAuth2Client.java.mustache Updated OAuth2Client constructor to set connectTimeout in the internal configuration.
config/clients/java/template/src/main/api/client/OpenFgaClient.java.mustache Improved error handling and synchronization in the batchCheck method using whenComplete and atomic reference.
config/clients/java/template/src/test/api/client/OpenFgaClientTest.java.mustache Added batchCheck_rateLimited test for rate-limiting scenario and error assertion.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant OpenFgaClient
    participant ApiClient
    participant HTTPServer

    Client->>OpenFgaClient: batchCheck(request)
    OpenFgaClient->>ApiClient: Send batch check requests (async)
    ApiClient->>HTTPServer: HTTP batch check request(s)
    HTTPServer-->>ApiClient: Response(s) (success or error)
    ApiClient-->>OpenFgaClient: Complete future (success or exception)
    OpenFgaClient->>OpenFgaClient: whenComplete: handle result or record failure
    OpenFgaClient-->>Client: Return completed or failed future
Loading
sequenceDiagram
    participant Test
    participant OpenFgaClient
    participant MockHttpClient

    Test->>OpenFgaClient: batchCheck(request)
    OpenFgaClient->>MockHttpClient: Send batch check request
    MockHttpClient-->>OpenFgaClient: 429 Rate Limit Error
    OpenFgaClient-->>Test: Future fails with FgaApiRateLimitExceededError
    Test->>Test: Assert exception and error details
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcf33df and d9e7e43.

📒 Files selected for processing (6)
  • config/clients/java/CHANGELOG.md.mustache (1 hunks)
  • config/clients/java/config.overrides.json (1 hunks)
  • config/clients/java/template/libraries/native/api.mustache (1 hunks)
  • config/clients/java/template/src/main/api/auth/OAuth2Client.java.mustache (1 hunks)
  • config/clients/java/template/src/main/api/client/OpenFgaClient.java.mustache (3 hunks)
  • config/clients/java/template/src/test/api/client/OpenFgaClientTest.java.mustache (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-and-test-java-sdk
  • GitHub Check: build-and-test-go-sdk
🔇 Additional comments (9)
config/clients/java/config.overrides.json (1)

6-6: Version bump looks correct.

The update from 0.8.2 to 0.8.3 aligns with the release PR and follows semantic versioning for a patch release.

config/clients/java/CHANGELOG.md.mustache (1)

5-12: Changelog entry is well-formatted and comprehensive.

The new v0.8.3 entry properly documents the two fixes with appropriate GitHub links and PR references. The format is consistent with existing entries.

config/clients/java/template/src/main/api/auth/OAuth2Client.java.mustache (1)

43-43: connectTimeout configuration properly implemented.

The addition of connectTimeout(configuration.getConnectTimeout()) ensures that the connection timeout setting is properly propagated from the main configuration to the OAuth2Client's internal configuration. This addresses the connectTimeout configuration issue mentioned in the changelog.

config/clients/java/template/libraries/native/api.mustache (1)

91-94: connectTimeout implementation is robust and consistent.

The code properly retrieves the connection timeout from configuration and applies it to the HTTP client builder with appropriate null checking. This ensures consistent timeout behavior across the SDK and complements the OAuth2Client fix.

config/clients/java/template/src/test/api/client/OpenFgaClientTest.java.mustache (1)

2060-2083: LGTM! Well-structured test for rate limiting behavior.

The new batchCheck_rateLimited test method properly validates the rate limiting scenario for the batchCheck API. The test follows the established pattern of other error handling tests in the file and correctly:

  1. Sets up a mock HTTP client to return a 429 status code with appropriate JSON error message
  2. Creates valid test data with a single ClientBatchCheckItem
  3. Verifies that the client performs the expected number of retries (1 + DEFAULT_MAX_RETRIES)
  4. Asserts that the correct exception type (FgaApiRateLimitExceededError) is thrown with the expected status code and response data

This test adds valuable coverage for rate limiting scenarios and aligns with the improvements mentioned in the changelog for version 0.8.3.

config/clients/java/template/src/main/api/client/OpenFgaClient.java.mustache (4)

18-18: LGTM! Appropriate import for the new error handling pattern.

The AtomicReference import is correctly added to support the improved error handling in the batchCheck method.


703-703: LGTM! Thread-safe failure tracking for concurrent operations.

The AtomicReference<Throwable> provides thread-safe storage for capturing the first exception that occurs during batch processing, which is essential for the concurrent execution pattern used in this method.


724-746: Excellent refactoring of asynchronous error handling!

The refactoring from handleAsync followed by thenAccept and thenRun to a single whenComplete callback with try-finally is a significant improvement:

  1. Better error handling: The compareAndSet(null, throwable) ensures only the first exception is captured, preventing race conditions.
  2. Deadlock prevention: The try-finally block guarantees the latch is always decremented, even if an exception occurs during response processing.
  3. Cleaner code: Single callback handler is more maintainable than chained async operations.

The implementation correctly handles both success and failure scenarios while maintaining thread safety.


751-753: LGTM! Proper failure propagation after batch completion.

The failure handling logic correctly checks if any batch failed and returns a CompletableFuture.failedFuture() with the first captured exception, ensuring proper error propagation to the caller.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jimmyjames jimmyjames changed the title Release/java v0.8.3 release(java-sdk): Release Java SDK v0.8.3 Jul 15, 2025
@rhamzeh
rhamzeh added this pull request to the merge queue Jul 15, 2025
Merged via the queue into main with commit 69978f0 Jul 15, 2025
19 checks passed
@rhamzeh
rhamzeh deleted the release/java-v0.8.3 branch July 15, 2025 21:41
@coderabbitai coderabbitai Bot mentioned this pull request Oct 7, 2025
4 tasks
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