diff --git a/internal/expand/engine.go b/internal/expand/engine.go index d842da894..2cd275975 100644 --- a/internal/expand/engine.go +++ b/internal/expand/engine.go @@ -2,9 +2,6 @@ package expand import ( "context" - "errors" - - "github.com/ory/herodot" "github.com/ory/keto/internal/x" @@ -53,7 +50,7 @@ func (e *Engine) BuildTree(ctx context.Context, subject relationtuple.Subject, r }, x.WithToken(nextPage), ) - if errors.Is(err, herodot.ErrNotFound) { + if len(rels) == 0 { return nil, nil } else if err != nil { return nil, err diff --git a/internal/persistence/sql/relationtuples.go b/internal/persistence/sql/relationtuples.go index 5281fbe0c..fccb8c42d 100644 --- a/internal/persistence/sql/relationtuples.go +++ b/internal/persistence/sql/relationtuples.go @@ -6,8 +6,6 @@ import ( "strings" "time" - "github.com/ory/herodot" - "github.com/gobuffalo/pop/v5" "github.com/pkg/errors" @@ -127,10 +125,6 @@ func (p *Persister) GetRelationTuples(ctx context.Context, query *relationtuple. return nil, x.PageTokenEnd, errors.WithStack(err) } - if len(res) == 0 { - return nil, x.PageTokenEnd, errors.WithStack(herodot.ErrNotFound) - } - cutOff := 1 nextPageToken := pagination.encodeNextPageToken() if len(res) <= pagination.Limit { diff --git a/internal/relationtuple/manager_requirements.go b/internal/relationtuple/manager_requirements.go index 68dc1ad3d..39ef656e1 100644 --- a/internal/relationtuple/manager_requirements.go +++ b/internal/relationtuple/manager_requirements.go @@ -240,5 +240,18 @@ func ManagerTest(t *testing.T, m Manager, addNamespace func(context.Context, *te assert.Len(t, res, 1) assert.Equal(t, notEncounteredTuples, res) }) + + t.Run("case=empty list", func(t *testing.T) { + nspace := t.Name() + addNamespace(context.Background(), t, nspace) + + res, nextPage, err := m.GetRelationTuples(context.Background(), &RelationQuery{ + Namespace: nspace, + }) + + assert.NoError(t, err) + assert.Equal(t, res, []*InternalRelationTuple{}) + assert.Equal(t, x.PageTokenEnd, nextPage) + }) }) }