Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc middleware order assertion #1395

Merged

Conversation

vroldanbet
Copy link
Contributor

@vroldanbet vroldanbet commented Jun 13, 2023

⚠️ built on top of #1391

The behaviour of gRPC streaming API middlewares can be surprising w.r.t to order of execution. This is an attempt to force the developer introducing gRPC middleware in SpiceDB to be explicit about the order.

When run in tests, the fluent API builder will wrap each middlewares into another interceptor that will run assertions on the order of execution, and panic if that expected order is not met.

@vroldanbet vroldanbet changed the base branch from main to decouple-middleware-modifications June 13, 2023 13:14
@github-actions github-actions bot added area/CLI Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Jun 13, 2023
@vroldanbet vroldanbet force-pushed the grpc-middleware-order-assertion branch 2 times, most recently from 8a89d6f to 9d68e97 Compare June 14, 2023 11:56
@vroldanbet vroldanbet marked this pull request as ready for review June 15, 2023 10:48
@vroldanbet vroldanbet requested a review from a team as a code owner June 15, 2023 10:48
@vroldanbet vroldanbet force-pushed the grpc-middleware-order-assertion branch 3 times, most recently from 498f8eb to 413a39b Compare June 15, 2023 11:24
@vroldanbet vroldanbet force-pushed the grpc-middleware-order-assertion branch from 413a39b to f5e6ea1 Compare June 15, 2023 11:39
@vroldanbet vroldanbet self-assigned this Jun 15, 2023
pkg/cmd/server/defaults.go Outdated Show resolved Hide resolved
pkg/cmd/server/defaults.go Outdated Show resolved Hide resolved
pkg/cmd/server/middleware.go Show resolved Hide resolved
var none = uuid.NewString()

func inTest() bool {
return flag.Lookup("test.v") != nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the function we already have defined in the testutil package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any. Could you point me to it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func isInTests() bool {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unexported. If you are cool with that, I can export it

pkg/cmd/server/middleware.go Outdated Show resolved Hide resolved
@vroldanbet vroldanbet force-pushed the grpc-middleware-order-assertion branch from 035fd62 to baae1a7 Compare June 15, 2023 18:47
@vroldanbet vroldanbet merged commit d2560c7 into decouple-middleware-modifications Jun 19, 2023
@vroldanbet vroldanbet deleted the grpc-middleware-order-assertion branch June 19, 2023 09:00
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/CLI Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants