From 14c9c921cceb7f6cd38a73c9a3c6bacb6b0c9db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Mon, 27 Jul 2026 16:40:18 +0200 Subject: [PATCH] Drop unreachable no-targets error handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The single-resource access resolvers each forward exactly one hard-coded id, so RequestPortalAccess never returns ErrNoAccessTargets on those paths — it only does so when all three id slices are empty. Remove the three dead handlers, keeping the live one on the bulk path where the resolved id slices can legitimately all be empty. Signed-off-by: Émile Ré --- .../v1/compliance_portal_resolvers.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/server/api/complianceportal/v1/compliance_portal_resolvers.go b/pkg/server/api/complianceportal/v1/compliance_portal_resolvers.go index 3cecd982d..fecec4373 100644 --- a/pkg/server/api/complianceportal/v1/compliance_portal_resolvers.go +++ b/pkg/server/api/complianceportal/v1/compliance_portal_resolvers.go @@ -974,11 +974,8 @@ func (r *mutationResolver) RequestDocumentAccess(ctx context.Context, input type CompliancePortalFileIDs: []gid.GID{}, }, ); err != nil { - if errors.Is(err, visitor.ErrNoAccessTargets) { - return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required") - } - r.logger.ErrorCtx(ctx, "cannot request document access", log.Error(err)) + return nil, gqlutils.Internal(ctx) } @@ -1000,6 +997,7 @@ func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types. } r.logger.ErrorCtx(ctx, "cannot load audit", log.Error(err)) + return nil, gqlutils.Internal(ctx) } @@ -1032,11 +1030,8 @@ func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types. CompliancePortalFileIDs: []gid.GID{}, }, ); err != nil { - if errors.Is(err, visitor.ErrNoAccessTargets) { - return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required") - } - r.logger.ErrorCtx(ctx, "cannot request report access", log.Error(err)) + return nil, gqlutils.Internal(ctx) } @@ -1084,11 +1079,8 @@ func (r *mutationResolver) RequestCompliancePortalFileAccess(ctx context.Context CompliancePortalFileIDs: []gid.GID{input.CompliancePortalFileID}, }, ); err != nil { - if errors.Is(err, visitor.ErrNoAccessTargets) { - return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required") - } - r.logger.ErrorCtx(ctx, "cannot request compliance portal file access", log.Error(err)) + return nil, gqlutils.Internal(ctx) }