Skip to content

fix(gateway): return InvalidArgument for unknown land strategy - #997

Open
DivyanshGarg380 wants to merge 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/land-unknown-strategy-invalid-argument
Open

DivyanshGarg380 wants to merge 1 commit into
uber:mainfrom
DivyanshGarg380:DivyanshGarg380/land-unknown-strategy-invalid-argument

Conversation

@DivyanshGarg380

Copy link
Copy Markdown
Contributor

Why?

Land with an unrecognized Strategy value returned a plain error from mapper.ProtoToLandRequest. gatewayStatusError has no case for unclassified errors and returns them unchanged, so clients received codes.Unknown instead of InvalidArgument for bad input.

What?

  • Wrap the strategy-mapping error in errs.NewUserError so the gateway maps it to InvalidArgument.
  • Keep errors.Is(err, errUnknownStrategy) working through the wrapper (Unwrap).
  • Assert the user-error classification in the mapper test, and add a gateway test that an unknown strategy yields InvalidArgument through gatewayStatusError.
  • Add the matching deps to the affected BUILD.bazel files.

Test Plan

  • go test ./service/submitqueue/gateway/server/mapper -count=1
  • go test ./service/submitqueue/gateway/server -run TestGatewayStatusError -count=1
  • python .\tool\bazel --output_user_root=C:\bazel test //service/submitqueue/gateway/server/mapper:all //service/submitqueue/gateway/server:all

Issue

Closes #996

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Land returns codes.Unknown instead of InvalidArgument for an unrecognized strategy

1 participant

⌂ Proxy