Conversation
Greptile SummaryThis PR fixes a bug where API key requests would surface a
Confidence Score: 5/5Safe to merge — the change is a small, well-scoped addition that makes nilable-entity resolvers return null instead of a resolver error when the privacy layer denies access. Both helpers already treat not-found as (nil, nil); extending that same treatment to privacy.Deny is the natural and correct completion of that contract. The existing GraphQL error presenter already handles privacy.Deny at the boundary for non-nilable paths, so this change doesn't remove any error visibility for callers that need it. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Resolver as GQL Resolver
participant Helper as getNilableChannel / getNilableUser
participant Ent as ent.Client (Query)
participant Privacy as Privacy Layer
Resolver->>Helper: getNilableChannel(ctx, client, id)
Helper->>Ent: .Query().Where(id).First(ctx)
Ent->>Privacy: evaluate access rules
alt Access allowed
Privacy-->>Ent: Allow
Ent-->>Helper: entity
Helper-->>Resolver: (entity, nil)
else Not found
Privacy-->>Ent: (pass-through)
Ent-->>Helper: IsNotFound error
Helper-->>Resolver: (nil, nil)
else Privacy denied (NEW)
Privacy-->>Ent: privacy.Deny
Ent-->>Helper: privacy.Deny error
Helper-->>Resolver: (nil, nil)
else Other error
Ent-->>Helper: other error
Helper-->>Resolver: (nil, wrapped error)
end
Reviews (1): Last reviewed commit: "fix: should not error if can access to a..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request updates the getNilableChannel and getNilableUser functions in internal/server/gql/graphql.go to handle privacy.Deny errors. When a privacy denial occurs, the functions now return nil instead of an error, effectively treating restricted entities as non-existent. I have no feedback to provide as no review comments were submitted.
…ooplj#1697) (cherry picked from commit 9226ee3)
Uh oh!
There was an error while loading. Please reload this page.