Skip to content
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

In the non-Txn Write, we should be catching the errors and wrapping them #99

Open
6 tasks done
rhamzeh opened this issue Aug 7, 2024 · 2 comments
Open
6 tasks done
Assignees
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest

Comments

@rhamzeh
Copy link
Member

rhamzeh commented Aug 7, 2024

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of OpenFGA and the issue still persists.
  • I have searched the Slack community and have not found a suitable solution or answer.
  • I agree to the terms within the OpenFGA Code of Conduct.

Description

In the non-txn Write, we should not error if a single tuple had a validation error

https://github.com/openfga/java-sdk/blob/b1e03e523c530824f5921313c2191dc5f6d93af8/src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java#L427C34-L427C99

Expectation

We should match what the other SDKs are doing, e.g.

Catching the response if failed and setting status: ClientWriteStatus.FAILURE for the individual failed tuples

Reproduction

Have the following tuple already written

- user: user:81684243-9356-4421-8fbf-a4f8d36aa31b
  relation: viewer
  object: document:roadmap

and then do:

var request = new ClientWriteRequest()
    .writes(List.of(
        new ClientTupleKey()
            .user("user:81684243-9356-4421-8fbf-a4f8d36aa31b")
            .relation("viewer")
            ._object("document:roadmap"),
        new ClientTupleKey()
            .user("user:81684243-9356-4421-8fbf-a4f8d36aa31b")
            .relation("viewer")
            ._object("document:budget")
    ));
var options = new ClientWriteOptions()
    .disableTransactions(true)
    .transactionChunkSize(1); // Maximum number of requests to be sent in a transaction in a particular chunk

var response = fgaClient.write(request, options).get();

OpenFGA SDK version

v0.5.0

OpenFGA version

N/A

SDK Configuration

N/A

Logs

No response

References

No response

@rhamzeh rhamzeh added the bug Something isn't working label Aug 7, 2024
@rhamzeh rhamzeh moved this from Backlog to Ready in SDKs and Tooling Aug 7, 2024
@rhamzeh rhamzeh changed the title In the non-Txn Write, we should be catching the errors and wrapping them before sending it to the server In the non-Txn Write, we should be catching the errors and wrapping them Aug 7, 2024
@evansims evansims self-assigned this Sep 9, 2024
@evansims evansims removed their assignment Sep 23, 2024
@sccalabr
Copy link

Id like to give this a try

@aaguiarz
Copy link
Member

@sccalabr I'm assigning it to you, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Projects
Status: Ready
Development

No branches or pull requests

4 participants