Skip to content

Conversation

@kbrwn
Copy link

@kbrwn kbrwn commented Mar 14, 2025

Adds RetryableClient client that handles retrying bulk relationship imports with different conflict resolution strategies (FAIL, SKIP, TOUCH).

Adds a demo application (RetryClientDemo.java) that retry bulk import with each conflict strategy.

kbrwn added 2 commits March 12, 2025 18:58
1. The modified RetryableClient.java file
2. The new RetryClientDemo.java example
@kbrwn kbrwn requested a review from a team as a code owner March 14, 2025 21:45
Copy link
Contributor

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

The bones of this seem reasonable, but I'm not sure about some of the specifics

Comment on lines +34 to +44
public void testCreateRelationship() {
// Create a relationship
Relationship relationship = createTestRelationship();

// Just verify the relationship object was created correctly
assertEquals("document", relationship.getResource().getObjectType());
assertEquals("doc1", relationship.getResource().getObjectId());
assertEquals("viewer", relationship.getRelation());
assertEquals("user", relationship.getSubject().getObject().getObjectType());
assertEquals("user1", relationship.getSubject().getObject().getObjectId());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests construct a retryable client but they don't actually exercise any of the behavior 🤔

Comment on lines +115 to +122
/**
* Get the schema service client.
*
* @return The schema service client
*/
public SchemaServiceGrpc.SchemaServiceBlockingStub schemaService() {
return schemaService;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is idiomatic java but this pattern annoys me. I'd rather just make these public members.

Comment on lines +103 to +113
this.schemaService = SchemaServiceGrpc.newBlockingStub(channel)
.withCallCredentials(credentials);
this.permissionsService = PermissionsServiceGrpc.newBlockingStub(channel)
.withCallCredentials(credentials);
this.asyncPermissionsService = PermissionsServiceGrpc.newStub(channel)
.withCallCredentials(credentials);
this.experimentalService = ExperimentalServiceGrpc.newBlockingStub(channel)
.withCallCredentials(credentials);
this.asyncExperimentalService = ExperimentalServiceGrpc.newStub(channel)
.withCallCredentials(credentials);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This part is strange to me - we don't actually provide a client otherwise, so exposing services that aren't relevant to retryable bulk import is strange to me.

It'd be less strange if we had a client definition 🙃

It also mixes blocking and non-blocking stubs which isn't obvious behavior. I think I'd rather cut this down to just the service required for retryable bulk import.

if (conflictStrategy == ConflictStrategy.SKIP) {
// Skip conflicts - return success
logger.log(Level.INFO, "ALREADY_EXISTS detected with SKIP strategy - returning success");
return relationships.size();
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this actually return? Is this function supposed to return void or is it implicitly typed?

@kbrwn
Copy link
Author

kbrwn commented Jun 5, 2025

AI slop is bad. I'll try again. Closing.

@kbrwn kbrwn closed this Jun 5, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants