diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-06-07 16:04:46 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-06-10 13:40:18 +0300 |
commit | 30d4fd427fc63daef560f1608b3833b827ab54ac (patch) | |
tree | e2c4eedee6495a2701e782fa0049720cba0963be /proto | |
parent | bdd33f61948e5fa22da595f9b87e7d5032c19c26 (diff) |
operations: Use structured errors in UserDeleteBranchpks-user-delete-branch-structured-errors
UserDeleteBranch is returning successfully in some error cases. This is
a pattern we want to get rid of, so let's convert the RPC to instead use
the structured errors via the new `UserDeleteBranchError` message type.
This fixes some cases where we know to create replication jobs because
the `UserDeleteBranch` RPC returns successfully, but didn't cast a
single vote.
Changelog: fixed
Diffstat (limited to 'proto')
-rw-r--r-- | proto/go/gitalypb/operations_grpc.pb.go | 22 | ||||
-rw-r--r-- | proto/operations.proto | 11 |
2 files changed, 24 insertions, 9 deletions
diff --git a/proto/go/gitalypb/operations_grpc.pb.go b/proto/go/gitalypb/operations_grpc.pb.go index 3ee7dabeb..0171226c2 100644 --- a/proto/go/gitalypb/operations_grpc.pb.go +++ b/proto/go/gitalypb/operations_grpc.pb.go @@ -28,9 +28,14 @@ type OperationServiceClient interface { // // - Returns `InvalidArgument` in case either the branch name or user are not set. // - Returns `FailedPrecondition` in case the branch does not exist. - // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. - // - Returns `FailedPrecondition` in case updating the reference fails because of a concurrent - // write to the same reference. + // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is enabled this error case will + // instead return `PermissionDenied` with either a `CustomHook` or AccessCheck` structured + // error. + // - Returns `FailedPrecondition` in case updating the reference fails because + // of a concurrent write to the same reference. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is set this error case will + // instead return `FailedPrecondition` with a `ReferenceUpdate` structured error. UserDeleteBranch(ctx context.Context, in *UserDeleteBranchRequest, opts ...grpc.CallOption) (*UserDeleteBranchResponse, error) // UserCreateTag creates a new tag. UserCreateTag(ctx context.Context, in *UserCreateTagRequest, opts ...grpc.CallOption) (*UserCreateTagResponse, error) @@ -338,9 +343,14 @@ type OperationServiceServer interface { // // - Returns `InvalidArgument` in case either the branch name or user are not set. // - Returns `FailedPrecondition` in case the branch does not exist. - // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. - // - Returns `FailedPrecondition` in case updating the reference fails because of a concurrent - // write to the same reference. + // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is enabled this error case will + // instead return `PermissionDenied` with either a `CustomHook` or AccessCheck` structured + // error. + // - Returns `FailedPrecondition` in case updating the reference fails because + // of a concurrent write to the same reference. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is set this error case will + // instead return `FailedPrecondition` with a `ReferenceUpdate` structured error. UserDeleteBranch(context.Context, *UserDeleteBranchRequest) (*UserDeleteBranchResponse, error) // UserCreateTag creates a new tag. UserCreateTag(context.Context, *UserCreateTagRequest) (*UserCreateTagResponse, error) diff --git a/proto/operations.proto b/proto/operations.proto index 5ecf78553..927dc67a8 100644 --- a/proto/operations.proto +++ b/proto/operations.proto @@ -35,9 +35,14 @@ service OperationService { // // - Returns `InvalidArgument` in case either the branch name or user are not set. // - Returns `FailedPrecondition` in case the branch does not exist. - // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. - // - Returns `FailedPrecondition` in case updating the reference fails because of a concurrent - // write to the same reference. + // - Returns `OK` with a `PreReceiveError` in case custom hooks refused the update. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is enabled this error case will + // instead return `PermissionDenied` with either a `CustomHook` or AccessCheck` structured + // error. + // - Returns `FailedPrecondition` in case updating the reference fails because + // of a concurrent write to the same reference. If the + // `gitaly_user_delete_branch_structured_errors` feature flag is set this error case will + // instead return `FailedPrecondition` with a `ReferenceUpdate` structured error. rpc UserDeleteBranch(UserDeleteBranchRequest) returns (UserDeleteBranchResponse) { option (op_type) = { op: MUTATOR |