jbvdmerwe
02/05/2025, 7:36 AMwrite relationships to a document. When I remove a user (user1), I create a RelationshipUpdate with a RelationshipUpdate_OPERATION_DELETE. I write the relationship, and it then deletes `user1`s relationship to the document. I then immediately create a ReadRelationshipsRequest, also adding the Zed Token zedToken to the request’s Requirement (if it’s not null):
go
readRelationshipRequest := &pb.ReadRelationshipsRequest{
RelationshipFilter: &pb.RelationshipFilter{
ResourceType: "document",
OptionalRelation: "writer",
OptionalResourceId: "0123",
OptionalSubjectFilter: &pb.SubjectFilter{
SubjectType: "user",
},
},
}
if zedToken != nil {
readRelationshipRequest.Consistency = &pb.Consistency{
Requirement: &pb.Consistency_AtLeastAsFresh{
AtLeastAsFresh: zedToken,
},
}
}
return readRelationshipRequest
The request is successful, yet it still includes user1 even after deleting the relationship. After ~3 seconds, I make another request (gRPC) to list all writer relationships, and user1 is excluded as expected.
To sum up, I update a relationship (sometimes more than one), use the Zed Token in the response to immediately verify the update, and then return the final user list. Is my assumption wrong that a fresh Zed Token lets me read my own write right away? Could there be a race condition or misunderstanding on my part about SpiceDB consistency?vroldanbet
02/05/2025, 9:40 AMvroldanbet
02/05/2025, 9:41 AMCheckPermission to see if the same phenomenon appears? (e.g. check user1 has no access to resource)jbvdmerwe
02/05/2025, 12:06 PM1.40.0 and Postgres 16 as the datastore.jbvdmerwe
02/05/2025, 1:15 PMjbvdmerwe
02/05/2025, 1:17 PMvroldanbet
02/06/2025, 12:27 PM